Commit | Line | Data |
---|---|---|
6a28abbc NC |
1 | #!/usr/bin/perl |
2 | ||
3 | while (@ARGV and $ARGV[0] =~ /^-/) { | |
4 | my $switch = shift; | |
5 | if ($switch eq '-Y') { | |
6 | $YAML = '-Y '; | |
7 | } | |
8 | else { | |
9 | die "Unrecognized switch: -$switch"; | |
10 | } | |
11 | } | |
12 | ||
13 | my $file = shift; | |
14 | my $infile = $file; | |
15 | ||
16 | unlink "$file.msg"; | |
17 | my $top = "/home/larry/src/p55"; | |
18 | ||
19 | my $text; | |
20 | open(FILE, $file) or die "Can't open $file: $!\n"; | |
21 | { | |
22 | local $/; | |
23 | $text = <FILE>; | |
24 | } | |
25 | close FILE; | |
26 | my $T; | |
27 | $switches = $1 if $text =~ /^#!.*?\s(-.*)/; | |
28 | $switches =~ s/\s+-[-*].*//; | |
29 | $switches =~ s/\s+#.*//; | |
30 | ||
31 | #if ($text =~ s/\bexit\b/DUMMYEXIT/g) { | |
32 | # $infile = "$file.tmp"; | |
33 | # open FILE, ">$infile"; | |
34 | # print FILE $text; | |
35 | # close FILE; | |
36 | #} | |
37 | ||
38 | unlink "$file.xml", "$file.msg", "$file.err", "$file.diff", "$file.p5"; | |
39 | print "PERL_XMLDUMP='$file.xml' $top/perl $switches -I lib $infile 2>$file.err\n"; | |
40 | system "PERL_XMLDUMP='$file.xml' $top/perl $switches -I lib $infile 2>$file.err"; | |
41 | ||
42 | if ($?) { | |
43 | print "Exit status $?\n"; | |
44 | system "cat $file.err"; | |
45 | exit 1; | |
46 | } | |
47 | ||
48 | if (not -s "$file.xml") { | |
49 | die "Didn't produce an xml file!?!\n" | |
50 | } | |
51 | ||
52 | if ($YAML) { | |
53 | system "$top/nomad -Y $file.xml"; | |
54 | exit; | |
55 | } | |
56 | ||
57 | system "$top/nomad $file.xml >$file.p5 2>$file.msg"; | |
58 | ||
59 | if ($?) { | |
60 | print "Oops!\n" unless -s "$file.msg"; | |
61 | system "cat $file.msg"; | |
62 | exit 1; | |
63 | } | |
64 | ||
65 | system "diff -u $file $file.p5 >$file.diff"; | |
66 | if (-s "$file.diff") { | |
67 | system "cat $file.diff"; | |
68 | exit 1; | |
69 | } |