BUG 748 - patch from jpeach@sgi.com (James Peach); relax arg parsing to sambalp script
authorGerald Carter <jerry@samba.org>
Tue, 16 Mar 2004 19:44:40 +0000 (19:44 +0000)
committerGerald Carter <jerry@samba.org>
Tue, 16 Mar 2004 19:44:40 +0000 (19:44 +0000)
(This used to be commit e2361da91f58e123c900f989b0afe94e93387a5d)

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>) {