3 # (c) 2009-2011 Technische Universität Dresden
4 # This file is part of TUD:OS and distributed under the terms of the
5 # GNU General Public License 2.
6 # Please see the COPYING-GPL-2 file for details.
8 # Adam Lackorzynski <adam@os.inf.tu-dresden.de>
12 use File::Temp qw/tempfile/;
14 BEGIN { unshift @INC, $ENV{L4DIR}.'/tool/lib'
15 if $ENV{L4DIR} && -d $ENV{L4DIR}.'/tool/lib/L4';}
19 unless (defined $ARGV[1]) {
20 print "ERROR: Need to give command and modules file!\n";
24 my @e = L4::ModList::get_entries($ARGV[1]);
26 if ($ARGV[0] eq 'menu')
28 my ($tmpfd, $tmpfilename) = tempfile();
31 if (defined $ENV{BACKTITLE})
33 $backtitle = $ENV{BACKTITLE};
34 $backtitle =~ s/"/\\"/g;
35 $backtitle = "--backtitle \"$backtitle\"";
38 system("dialog $backtitle --title 'Entry selection' "
39 ." --menu 'Select entry to launch' 18 65 18 ".
40 join(' ', map { "$_ '$e[$_]'" } (0 .. $#e) )." 2> $tmpfilename");
44 print "ERROR: dialog aborted!\n";
57 print "ERROR: Invalid return value from dialog!\n";
64 elsif ($ARGV[0] eq 'list')
66 print join("\n ", "Entries in modules file:", @e), "\n";