error - but which program?? - (nf)
dan at haddock.UUCP
dan at haddock.UUCP
Wed Jun 13 13:46:54 AEST 1984
#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.
More information about the Comp.unix.wizards
mailing list