From: thib Date: Sat, 10 Aug 2002 20:41:18 +0000 (+0000) Subject: modified to be able to print the uid (not only the gid) X-Git-Tag: ver1564~66 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=07e0c9ce629322e93b1638fa87d9ecce4cb9ada7;p=fcron modified to be able to print the uid (not only the gid) --- diff --git a/script/has_usrgrp.pl b/script/has_usrgrp.pl index c0dfb31..96f0e6e 100755 --- a/script/has_usrgrp.pl +++ b/script/has_usrgrp.pl @@ -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;