]> granicus.if.org Git - fcron/commitdiff
code cleaning
authorthib <thib>
Mon, 20 Aug 2001 11:01:25 +0000 (11:01 +0000)
committerthib <thib>
Mon, 20 Aug 2001 11:01:25 +0000 (11:01 +0000)
script/has_usrgrp.pl

index 63d73de1a1800546612eda62fd3c05c1593e965b..c0dfb3160e7fe153b87c5a4ca5c58019b60d51fb 100755 (executable)
@@ -4,25 +4,26 @@
 #   on the system (getpwnam() and getgrnam() use nsswitch.conf, so it works
 #   even if NYS (or similar) is used)
 
-if ( $#ARGV < 1 || $#ARGV > 2) {
-    print "usage:\n  has_usrgrp.pl [-user user|-group group] [-printgid]\n";
-    exit 1;
+sub usage {
+    return "usage:\n  has_usrgrp.pl [-user user|-group group] [-printgid]\n";
+}
+
+if ( @ARGV < 2 || @ARGV > 3) {
+    die usage();
 }
 
 if ( $ARGV[0] eq "-user" ) {
-    ($name, $passwd, $uid, $gid, $quota, $comment,
-     $gcos, $dir, $shell, $expire) = getpwnam($ARGV[1]);
+    ($name, $passwd, $uid, $gid) = getpwnam($ARGV[1]);
 }
 elsif ( $ARGV[0] eq "-group" ) {
-    ($name, $passwd, $gid, $members) = getgrnam($ARGV[1]);
+    ($name, $passwd, $gid) = getgrnam($ARGV[1]);
 }
 else {
-    print "usage:\n  has_usrgrp.pl [-user user|-group group] [-printgid]\n";
-    exit 1;
+    die usage();
 }
 
 if ($name) {
-    if ( $#ARGV == 2 && $ARGV[2] eq "-printgid" ) {
+    if ( @ARGV == 3 && $ARGV[2] eq "-printgid" ) {
        print $gid, "\n";
     }
     exit 0;