Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!uwvax!mcvoy From: mcvoy@uwvax.UUCP Newsgroups: net.sources Subject: Smart finger Message-ID: <3471@rsch.WISC.EDU> Date: Sat, 18-Apr-87 18:54:32 EST Article-I.D.: rsch.3471 Posted: Sat Apr 18 18:54:32 1987 Date-Received: Sun, 19-Apr-87 07:57:30 EST Organization: U of Wisconsin CS Dept Lines: 132 Keywords: Aliases for finger(1) Hi there. Here's a hack that makes finger(1) smart about your internet mail aliases. It looks in ~/.fingerc (which is usually a link to ~/.mailrc) for lines of the form alias foo foo@xerox.com and if you said finger foo you will see (foo: foo@xerox.com) <== my stuff [foo@xexox.com] <== standard finger output The only thin it needs are index(3) (aka strchr) and $HOME in your environment. Oh yeah, FINGER is defined to the real finger (/usr/ucb/finger). For BSD systems this should slide right in; for others, well.... No man page, unless someone asks... Options: -I (ignore) ignores aliases. Enjoy, -larry # ----- cut here ---- # This is a shell archive. Remove anything before this line, then # unpack it by saving it in a file and typing "sh file". (Files # unpacked will be owned by you and have default permissions.) # # This archive contains: # finger.c echo x - finger.c cat > "finger.c" << '//E*O*F finger.c//' static char* id = "@(#)finger.c - main, strsav; mcvoy@rsch.wisc.edu"; /* finger - provide front end for finger that loads aliases. * * Look in ~/.fingerc for aliases. You could link this to .mailrc. * * An alias is the regular expression: * * ^alias[ ]+name[ ]+full_name * * and finger name gets translated to finger fullname. * Exception: any fullname that contains a "!" is ignored (can't do uucp, * only internet). * * Options: -I ignores the dotfiles; a good way to finger a local john instead * of an aliased john. */ # include # include # define FINGER "/usr/ucb/finger" main(ac, av, ev) char** av; char** ev; { char fingerc[255]; char buf[500]; register i; FILE* f = (FILE*)-1; char* strsav(); sprintf(fingerc, "%s/.fingerc", getenv("HOME")); if (!strcmp(av[1], "-I") || !(f = fopen(fingerc, "r"))) { if (f == (FILE*)-1) { /* shift av down. */ register i; for (i=1; i $temp <<\!!! 85 290 1956 finger.c !!! wc finger.c | sed 's=[^ ]*/==' | diff -b $temp - exit 0 -- Larry McVoy mcvoy@rsch.wisc.edu or uwvax!mcvoy "It's a joke, son! I say, I say, a Joke!!" --Foghorn Leghorn