Version of id(1).

Randal Schwartz merlyn at iwarp.intel.com
Sat Mar 3 08:02:09 AEST 1990


In article <2964 at jato.Jpl.Nasa.Gov>, lwall at jato (Larry Wall) writes:
[21 lines of code deleted...]
| No doubt Randal could write it shorter...

Well, OK, taking on the challenge, how about:

#!/usr/bin/perl
sub u { local($name)=getpwuid($_[0]); $name && "($name)";}
sub g { local($name)=getgrgid($_[0]); $name && "($name)";}
sub bynum { $a - $b; }
print "uid=$<",&u($<);
print " gid=", $(+0,&g($();
print " euid=$>",&u($>) if $> != $<;
print " egid=", $)+0,&g($)) if $) != $(;
@groups=split(' ',$(); shift(@groups);
print " groups=", join(',',sort bynum grep(($_ .= &g($_)) || 1, @groups))
	unless $#groups < $[;
print "\n";

Something like that, Larry?

print pack('C25',grep($_ = 32 + y/ / /, split(/\n/, <<END)));
                                          X
                                                                                     X
                                                                                   X
                                                                                    X
X
                                                                 X
                                                                              X
                                                                               X
                                                                                    X
                                                                        X
                                                                     X
                                                                                  X
X
                                                X
                                                                     X
                                                                                  X
                                                                            X
X
                                                                        X
                                                                 X
                                                                   X
                                                                           X
                                                                     X
                                                                                  X
            X
END
-- 
/=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\
| on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III      |
| merlyn at iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn |
\=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/



More information about the Alt.sources mailing list