]> granicus.if.org Git - fcron/commitdiff
modified to be able to print the uid (not only the gid)
authorthib <thib>
Sat, 10 Aug 2002 20:41:18 +0000 (20:41 +0000)
committerthib <thib>
Sat, 10 Aug 2002 20:41:18 +0000 (20:41 +0000)
script/has_usrgrp.pl

index c0dfb3160e7fe153b87c5a4ca5c58019b60d51fb..96f0e6ea82c8718ba860f7fffe6656601937ac60 100755 (executable)
@@ -5,7 +5,7 @@
 #   even if NYS (or similar) is used)
 
 sub usage {
-    return "usage:\n  has_usrgrp.pl [-user user|-group group] [-printgid]\n";
+    return "usage:\n  has_usrgrp.pl [-user user|-group group] [-printuid|-printgid]\n";
 }
 
 if ( @ARGV < 2 || @ARGV > 3) {
@@ -22,12 +22,20 @@ else {
     die usage();
 }
 
-if ($name) {
-    if ( @ARGV == 3 && $ARGV[2] eq "-printgid" ) {
+if ( ! $name) {
+    exit 1;
+}
+
+if ( @ARGV == 3 ) {
+    if ( $ARGV[2] eq "-printgid" ) {
        print $gid, "\n";
     }
-    exit 0;
-}
-else {
-    exit 1;
+    elsif ( $ARGV[2] eq "-printuid" ) {
+       if ( defined $uid ) {
+           print $uid, "\n";
+       } else {
+           die usage();
+       }
+    }
 }
+exit 0;