Xref: utzoo comp.bugs.4bsd:1769 comp.misc:11927 alt.folklore.computers:10631 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!think.com!paperboy!hsdndev!spdcc!dirtydog!ico!rcd From: rcd@ico.isc.com (Dick Dunn) Newsgroups: comp.bugs.4bsd,comp.misc,alt.folklore.computers Subject: "Invalid null command" Message-ID: <1991Apr2.005620.11434@ico.isc.com> Date: 2 Apr 91 00:56:20 GMT Followup-To: comp.misc Organization: Interactive Systems Corporation, Boulder, CO Lines: 77 Bourne shell users, accustomed to creating or emptying a file with a command like: >splot or rewinding a tape with: splot seems a bit naked without some slashes and an EXEC PGM=, but that's the way these modern systems are... Some folks may note a more-than-coincidental resemblance between this version of IEFBR14 and older versions of /bin/true. So it is, but our example lacks the sophistication of the modern System V "true" command, which is now 9 lines long and includes - an entirely superfluous : - five lines of copyright notice (so don't y'all go trying to use empty files any more; AT&T owns the copyright) - a #ident--which, of course, is meaningless to the shell, but reveals the interesting fact that we're now up to version 2.3 of a formerly-empty file However, the preceding was only for illustration anyway. Nobody wants a dirty old shell script for the null command; it should of course be a C program for efficiency. So here we have the first cut at IEFBR14.c: main() { } This also serves only for illustration; it is historically accurate in that it contains the same bug as IBM's original IEFBR14. (It may be of some interest that IEFBR14 proved the old CS aphorism "Every program contains at least one bug and can be shortened by one instruction" at the inductive limit: It was a single instruction which didn't work...but I digress...) Here's the first correction: main() { exit(0); } But to make this proper in today's brave new world, we need . Also, for formality's sake and international propriety, we should add the normally-obligatory setlocale() call (actually not necessary--this may be the *only* program for which that's true--but it's hard to pass up poking fun at a requirement to set a default explicitly), and this in turn requires . OK, so here's the penultimate version of IEFBR14.c, our properly ANSI and internationalized (unless I screwed up) program-to- do-nothing: #include #include #ifndef lint static char *sccsid = "%W% - %E%"; #endif /*ARGSUSED*/ main(argc,argv) int argc; char **argv; { setlocale(LC_ALL, ""); exit(0); } To create the final version, all you need is your local draconian corporate screenful of copyright notice and disclaimer. -- Dick Dunn rcd@ico.isc.com -or- ico!rcd Boulder, CO (303)449-2870 The Official Colorado State Vegetable is now the "state legislator".