Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site ut-sally.UUCP Path: utzoo!decvax!genrad!panda!talcott!harvard!seismo!ut-sally!jsq From: jsq@ut-sally.UUCP (John Quarterman) Newsgroups: mod.std.unix Subject: Re: standardized error messages Message-ID: <2560@ut-sally.UUCP> Date: Thu, 1-Aug-85 16:43:46 EDT Article-I.D.: ut-sally.2560 Posted: Thu Aug 1 16:43:46 1985 Date-Received: Sat, 3-Aug-85 03:08:38 EDT References: <2391@ut-sally.UUCP> <2461@ut-sally.UUCP> <2474@ut-sally.UUCP> Reply-To: std-unix@ut-sally.UUCP Organization: U. Texas CS Dept., Austin, Texas Lines: 132 Approved: jsq@ut-sally.UUCP Summary: if this doesn't get standardized, everybody will do it anyway From: John Quarterman (moderator) Topic: standardized error messages ---------------------------------------------------------------------- From: oakhill!mot!fred (Fred Christiansen) Date: Fri, 26 Jul 85 16:19:00 cdt To: oakhill!ut-sally!jsq@tzec.UTEXAS.ARPA Subject: Re: standardized error messages the SVID has specifics in Appendix BASE 5.6 (p. 341), which i shall attempt to summarize: the std error msg has 5 parts: Label who's issuing this msg Severity 4 possible codes (halt, error, warning, fyi) Problem what went wrong Action "TO FIX" do such and such Tag unique error msg id which can be used to track down more info Fred Christiansen ("Canajun, eh?") @ Motorola Microsystems, Tempe, AZ UUCP: ihnp4!{attunix, btlunix, drivax, sftig, ut-sally!oakhill}!mot!fred ARPA: oakhill!mot!fred@ut-sally.ARPA AT&T: 602-438-3472 ------------------------------ From: Mike Trachtman Date: Sun, 28 Jul 85 14:59:04 -0200 To: std-unix@ut-sally.arpa Subject: standard error messages. A standard for error messages should be very strict about punctuation, and where line numbers go. somthing like command: filename (linenumber) - severity - message this is getting kind of IBMsh, but programs should be able to parse errors, and thus errors should be in a standard form. errors should definitely include the following 1) the filename where the error was 2) the line number 3) the error, (or in greps case, the line that contained the word optionally, but in a set format 1) the command or routine that found the error 2) the Unix errno 3) some program generated error number 4) an indication of the severity Of course, these are only opinions, and they are only my opinions. Mike wizard@wisdom (BITNET) wizard%wisdom.bitnet@wiscvm.ARPA (ARPA/CSNET) wizard%wisdom.bitnet@berkley (ARPA/CSNET) and if all else fails (ONLY for VERY short items) ...!decvax!humus!wisdom!wizard (UUCP) ------------------------------ Date: Wed, 24 Jul 85 16:18:22 edt From: Chris Torek To: std-unix@ut-sally Subject: Re: standardized error messages Hm. It's probably too late, but I would suggest that any standard library routine for printing error message use printf-style conversions (preferably it should be exactly like printf once you get past severity stuff and whatnot). In case anyone wants it, here's the routine I installed in our C library on our "experimental" machine (it wants a bit of support in the startup code to set _argv0 to argv[0], so that the program name is included in error messages, but will work without it). It is not (alas!) portable, but can be made to work on any of the popular Unix machines. (I have a manual entry, if anyone cares.) Chris #include char *_argv0; /* argv[0], set by C startup code */ /* * error - University of Maryland specific (sigh) * * Useful for printing error messages. Will print the program name * and (optionally) the system error associated with the values in * . * * Note that the type (and even the existence!) of ``arg'' is undefined. */ error(quit, e, fmt, arg) int quit; register int e; char *fmt; { extern char *sys_errlist[]; extern int sys_nerr; register char *p = _argv0; if (p != NULL) { #ifdef optional char *s, *rindex(); if ((s = rindex(p, '/')) != NULL) p = s + 1; #endif (void) fprintf(stderr, "%s: ", p); } _doprnt(fmt, &arg, stderr); /* magic */ if (e > 0) { p = e < sys_nerr ? sys_errlist[e] : "unknown error"; (void) fprintf(stderr, ": %s", p); } (void) putc('\n', stderr); (void) fflush(stderr); if (quit) exit(quit); } ------------------------------ Discussions-Of: UNIX standards, particularly the IEEE P1003 draft standard. Submissions-To: ut-sally!std-unix or std-unix@ut-sally.ARPA Comments-To: ut-sally!std-unix-request or std-unix-request@ut-sally.ARPA UUCP-Routes: {ihnp4,seismo,harvard,gatech}!ut-sally!std-unix Archives-In: ~ftp/pub/mod.std.unix on ut-sally.ARPA (soon sally.UTEXAS.EDU)