]> granicus.if.org Git - docbook-dsssl/commitdiff
Handle no CLASSPATH and improve parameter parsing
authorNorman Walsh <ndw@nwalsh.com>
Fri, 9 Feb 2007 13:20:02 +0000 (13:20 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Fri, 9 Feb 2007 13:20:02 +0000 (13:20 +0000)
cvstools/saxon

index 80183a1fe71d8a36c922817b796e18d676524c44..fcfc3a2f6a5fe1b428c82435217ef84bdeb7a0ae 100755 (executable)
@@ -124,8 +124,8 @@ if (!defined($version)) {
 }
 
 my $optsname = "saxon";
-$optsname .= $saxonsa if defined($saxonsa);
 $optsname .= "-$version";
+$optsname .= "a" if defined($saxonsa);
 
 # Inelegantly, these are used as globals by several functions
 my %seenopts = ();
@@ -145,7 +145,8 @@ die "Unexpected root element in configuration file.\n" if !$doc;
 # Figure out the class path separator before we go any further
 my $cpseparator = $doc->getAttribute('classpath-separator');
 # Default to ';' if it appears in $CLASSPATH, otherwise ':'
-$cpseparator = ($ENV{'CLASSPATH'} =~ /;/ ? ";" : ":")
+my $CLASSPATH = $ENV{'CLASSPATH'} || "";
+$cpseparator = ($CLASSPATH =~ /\;/ ? ";" : ":")
     if !defined($cpseparator) or $cpseparator eq '';
 
 foreach my $name (@opts, $optsname) {
@@ -154,7 +155,7 @@ foreach my $name (@opts, $optsname) {
 
 $java = "java" if $java eq '';
 
-foreach my $path (reverse split(/$cpseparator/, $ENV{'CLASSPATH'})) {
+foreach my $path (reverse split(/$cpseparator/, $CLASSPATH)) {
     unshift(@classpath, $path);
 }
 
@@ -166,7 +167,16 @@ my $jopts = join(" ", @javaopts);
 my $jprops = join(" ", @systemprops);
 my $jcp = join($cpseparator, @classpath);
 my $sopts = join(" ", @saxonopts);
-my $sparam = join(" ", @params);
+
+my $sparam = "";
+foreach my $param (@params) {
+    $sparam .= " " if $sparam ne '';
+    if ($param =~ /^(.+?)=(.+)$/) {
+       $sparam .= "$1=\"$2\"";
+    } else {
+       $sparam .= "$param";
+    }
+}
 
 if ($cpseparator eq ';') {
     # This must be cygwin or some windows flavor, let's try to make it work
@@ -179,7 +189,7 @@ if ($cpseparator eq ';') {
     }
 }
 
-print "$java $jopts $classname $sopts $input $style $sparam\n" if $debug;
+print "$java $jopts -cp $jcp $jprops $classname $sopts $input $style $sparam\n" if $debug;
 exec("$java $jopts -cp $jcp $jprops $classname $sopts $input $style $sparam");
 
 # ============================================================