BUG 748 - patch from jpeach@sgi.com (James Peach); relax arg parsing to sambalp script
[kai/samba.git] / packaging / SGI / sambalp
index 61e62215c91b4463234fbc2876bd36fb421aea8e..27ca5165f9703232db2efacffb912dbf1108e47e 100644 (file)
@@ -50,8 +50,9 @@ $PSFIX = 1;                   # set to 0 if you don't want to run
 EOF
 $ENV{'PATH'} = join(':',@PATH);
 
-if ($#ARGV < 3) {
-    print STDERR "usage: $PROG printer file user system\n";
+        print "$#ARGV ".scalar(@ARGV)."\n";
+if (scalar(@ARGV) < 2) {
+    print STDERR "usage: $PROG printer file [user] [system]\n";
     exit;
 }
 
@@ -60,6 +61,9 @@ $file    = $ARGV[1];
 $user    = $ARGV[2];
 $system  = $ARGV[3];
 
+$user = "nobody" unless($user);
+$system = `hostname` unless($system);
+
 open(LPSTAT,"/usr/bin/lpstat -t|") || die("Can't get printer list.\n");
 @printers = ();
 while (<LPSTAT>) {