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>
10 # Do not use 'perl -W' here, as with perl-5.20 we'll get
11 # Use of uninitialized value in string ne at /usr/lib/..../perl/5.20/File/Spec/Unix.pm line 92.
12 # Maybe sometime later we could use -W again?
15 use File::Temp qw/tempfile/;
17 BEGIN { unshift @INC, $ENV{L4DIR}.'/tool/lib'
18 if $ENV{L4DIR} && -d $ENV{L4DIR}.'/tool/lib/L4';}
22 unless (defined $ARGV[1]) {
23 print "ERROR: Need to give command and modules file!\n";
27 my @e = L4::ModList::get_entries($ARGV[1]);
29 if ($ARGV[0] eq 'menu')
31 my ($tmpfd, $tmpfilename) = tempfile();
34 if (defined $ENV{BACKTITLE})
36 $backtitle = $ENV{BACKTITLE};
37 $backtitle =~ s/"/\\"/g;
38 $backtitle = "--backtitle \"$backtitle\"";
41 system("dialog $backtitle --title 'Entry selection' "
42 ." --menu 'Select entry to launch' 18 65 18 ".
43 join(' ', map { "$_ '$e[$_]'" } (0 .. $#e) )." 2> $tmpfilename");
47 print "ERROR: dialog aborted!\n";
60 print "ERROR: Invalid return value from dialog!\n";
67 elsif ($ARGV[0] eq 'list')
69 print join("\n ", "Entries in modules file:", @e), "\n";