Path: utzoo!attcan!uunet!lll-winken!lll-tis!mordor!joyce!sri-unix!quintus!ok From: ok@quintus Newsgroups: comp.sources.bugs Subject: Haugh's "env" Message-ID: <168@quintus.UUCP> Date: 14 Jul 88 23:35:45 GMT Sender: news@quintus.UUCP Reply-To: ok@quintus () Organization: Quintus Computer Systems, Inc. Lines: 20 "john f. haugh ii" recently sent out public domain code which implements the System V "env" command. There are a number of problems: (1) It uses strchr() rather than index(); if you have an older BSD system (why else would you lack "env"?) you probably haven't got strchr() either. (2) main() doesn't end with a call to exit(0); but just falls off the end. (3) When a command can't be executed, the diagnostic message is: whereas the real "env" command prints : This one's pretty minor. (4) When a command can't be executed, Haugh's version does _exit(127); the status returned by the real env is 1, so change that 127 to 1. (5) Haugh's version calls execve(*argv, argv, env); which means that e.g. "env fred=47 sh" doesn't work. This should be extern char **environ; environ = env; execvp(*argv, argv); {Why is there no execvep() library routine?}