1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
#!/usr/bin/perl
# This small script creates a dialog-script with a program starting
# dialog for allegro example programs
open(fh,"<debian/tests.dsc");
while (<fh>) {
if(/(.*) - (.*)/) {
$prg = $1;
$dsc = $2;
$prg = $1;
$dsc = $2;
$prg =~ s/\.c.*//;
$dsc =~ s/\'/\"/g;
$db{$prg} = $dsc;
# print "$prg $dsc
# ";
}
}
close(fh);
print '#!/bin/sh
DIALOG=${DIALOG=dialog}
tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$
trap "rm -f $tempfile" 0 1 2 5 15
$DIALOG --clear --title "Examples programs for the Allegro library" \
--menu "\nHi, using this menu you can run some of example \
programs and utilities distributed with the Allegro library.\
Some of them may work on your system, some may not. Just try and \
you could find some nice looking demos and useful tools.\n\n" \
20 80 10 \
';
for (sort(keys %db)) {
print "\'$_\' \'".$db{$_}.'\' \\
';
}
print ' 2> $tempfile
retval=$?
choice=`cat $tempfile`
case $retval in
0)
cd /usr/lib/games/allegro-examples/
/usr/lib/games/allegro-examples/$choice
echo Press RETURN to continue...
read
exec $0;;
1)
echo "Cancel pressed.";;
255)
echo "ESC pressed.";;
esac
'
|