Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!hou3c!hocda!houxm!houxz!vax135!floyd!harpo!decvax!cca!ima!haddock!dan From: dan@haddock.UUCP Newsgroups: net.unix-wizards Subject: Re: Re: error - but which program?? - (nf) Message-ID: <188@haddock.UUCP> Date: Tue, 12-Jun-84 23:46:54 EDT Article-I.D.: haddock.188 Posted: Tue Jun 12 23:46:54 1984 Date-Received: Thu, 14-Jun-84 00:41:51 EDT Lines: 21 #R:umcp-cs:-742900:haddock:16800016:000:1120 haddock!dan Jun 11 14:20:00 1984 When I wrote a function like that a few years ago, I didn't have a 'quit' argument, as I wanted to minimize the number of arguments to encourage people to use the routine without thinking about it. Instead I defined variants on the routine which exited, aborted, and called reset() (the predecessor to setjmp/longjmp). The basic function was "cmderr", and the others were "ecmderr", "acmderr", and "rcmderr". If I were doing it over again I might add "jcmderr(jmpbuf, sys_errno, fmt, ...)". It was easy to convert most commands to use this format; just set the global "progname" at the beginning of "main" and then, almost mechanically, convert all the fprintf calls to cmderr calls. We even considered having crt0.o set "progname" to eliminate that part. One thing you discover after you do this is that the system message strings occupy a significant portion of the total address space on a 16-bit machine. We put them all into a file--except, of course, for EMFILE and ENFILE, which have to be compiled in. Having them in a file also made it easy to add new messages, or change the existing ones to be clearer.