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!linus!philabs!cmcl2!seismo!ut-sally!jsq
From: jsq@ut-sally.UUCP (John Quarterman)
Newsgroups: mod.std.unix
Subject: Re: standardized error messages
Message-ID: <2597@ut-sally.UUCP>
Date: Tue, 6-Aug-85 11:26:12 EDT
Article-I.D.: ut-sally.2597
Posted: Tue Aug  6 11:26:12 1985
Date-Received: Wed, 7-Aug-85 03:06:14 EDT
References: <2391@ut-sally.UUCP> <2461@ut-sally.UUCP> <2474@ut-sally.UUCP> <2560@ut-sally.UUCP>
Reply-To: std-unix@ut-sally.UUCP
Organization: U. Texas CS Dept., Austin, Texas
Lines: 41
Approved: jsq@ut-sally.UUCP

----------------------------------------------------------------------

From: Steve Glaser 
To: tektronix!ut-sally!std-unix@tektronix.CSNET,
        tektronix!std-unix%ut-sally.arpa@tektronix.CSNET
Date: Mon, 5 Aug 85 17:58:33 PDT
Subject: Re: standardized error messages

in Chris Torek's error example, please change:

>	if (e > 0) {
>		p = e < sys_nerr ? sys_errlist[e] : "unknown error";
>		(void) fprintf(stderr, ": %s", p);
>	}

to:

>	if (e > 0) {
>		if (e < sys_nerr)
>			(void) fprintf(stderr, ": %s", sys_errlist[e]);
>		else
>			(void) fprintf(stderr, ": unknown error number %d", e);
>	}

It's most annoying when an error message printing routine throws away
information.  Especially when you have new error codes cropping up and
programs that don't get recompiled (or at least relinked).

At least Chris checked against sys_nerr.  I've seen may programs that
don't bother and end up printing gibberish when a new error comes along.

	Steve Glaser
	tektronix!steveg

------------------------------

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)