Commit 931b2476 authored by Leigh Stoller's avatar Leigh Stoller

Fix the -o option, move the leading comment into ns2genilib.

parent d66ded24
......@@ -112,16 +112,15 @@ else {
my $xmlerrors = `$XMLLINT --noout $rspecfile 2>&1`;
if ($?) {
print STDERR $xmlerrors;
Fatal("rspec is not well formed");
fatal("rspec is not well formed");
}
my $rspec = GeniXML::ParseFile($rspecfile);
if (! defined($rspec)) {
Fatal("Could not parse rspec");
fatal("Could not parse rspec");
}
my $genilib =
"#\n" .
"# NOTE: This code was machine converted from an Emulab experiment that\n".
"# was originally written in NS syntax. An actual human would never\n".
"# NOTE: This code was machine converted. An actual human would never\n".
"# write code like this!\n".
"#\n" .
"import geni.portal\n" .
......@@ -706,8 +705,15 @@ foreach my $pool (@{ GeniXML::GetAddressPools($rspec) }) {
}
AddStatement("portal.printRequestRSpec(rspec)");
print "$genilib";
if (defined($ofile)) {
open(GENI, ">$ofile") or
fatal("Could not open output file");
print GENI $genilib;
close(GENI);
}
else {
print "$genilib";
}
exit(0);
sub fatal($) {
......@@ -715,6 +721,5 @@ sub fatal($) {
print STDERR "*** $0:\n".
" $mesg\n";
exit(-1);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment