mirror of
https://github.com/ksherlock/qserver.git
synced 2024-09-07 06:54:24 +00:00
script to convert unix fortunes to qserver rez file
This commit is contained in:
parent
1840352173
commit
e3bfd5f549
41
fortune.pl
Executable file
41
fortune.pl
Executable file
@ -0,0 +1,41 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use strict;
|
||||
|
||||
# this perl script will convert a unix fortune file (from stdin)
|
||||
# to a IIgs rez file (on stdout) for use with the quote-of-the-day
|
||||
# server. Rez file will need to be compiled, naturally.
|
||||
#
|
||||
# use at your own risk.
|
||||
|
||||
|
||||
my $cnt = 0;
|
||||
my $line;
|
||||
|
||||
print '#include "Types.rez"',"\n\n";
|
||||
|
||||
# quotes are freetext, separated by %
|
||||
while (<>)
|
||||
{
|
||||
chomp; # remove trailing linefeed
|
||||
|
||||
$line = $_;
|
||||
if ($line =~ m/^%/)
|
||||
{
|
||||
print "}", "\n\n" if ($cnt++);
|
||||
|
||||
print "resource rTextForLETextBox2($cnt) {\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
# remove any trailing whitespace.
|
||||
$line =~ s/\s*$//;
|
||||
# escape any quote marks.
|
||||
$line =~ s/"/\\"/g;
|
||||
|
||||
print ' "',$line,'\n"',"\n";
|
||||
}
|
||||
}
|
||||
print "};", "\n\n" if ($cnt);
|
||||
exit;
|
||||
|
Loading…
Reference in New Issue
Block a user