From: Thibault Godouet 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: ver2_9_4~140 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8057783778a021e1a00c183bd3195c63b4f98398;p=thirdparty%2Ffcron.git 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;