[comp.misc] Fixing error messages

jtc@van-bc.wimsey.bc.ca (J.T. Conklin) (11/01/90)

In article <RZS6.:A@xds13.ferranti.com> peter@ficc.ferranti.com (Peter da Silva) writes:
>I'd be satisfied if one of them went through their source and whenever
>they have !fprintf(stderr, "Can't open %s\n", file);! replaced it with
>!perror(file)!.

I think you're on the right track.  But if vendors could be convinced
to change their error messages, I'd prefer something like this:

    fprintf(stderr, "%s: Can't open %s: %s\n", progname, strerror(errno));

As the program name, the kind of error the program "thinks" has happend,
and the perror() style error message are all present.

	--jtc

-- 
J.T. Conklin	UniFax Communications Inc.
		...!{uunet,ubc-cs}!van-bc!jtc, jtc@wimsey.bc.ca

peter@ficc.ferranti.com (Peter da Silva) (11/02/90)

In article <23@van-bc.wimsey.bc.ca> jtc@van-bc.wimsey.bc.ca (J.T. Conklin) writes:
> I think you're on the right track.  But if vendors could be convinced
> to change their error messages, I'd prefer something like this:

>     fprintf(stderr, "%s: Can't open %s: %s\n", progname, strerror(errno));

Be great. Even better have a routine like this:

error_message(short, long)
{
	char *errenv;
	int errlev = DEFAULT_LEVEL;

	if(errenv = getenv("ERROR_LEVEL"))
		errlev = atoi(errenv);

	switch(errlev) {
		...
	}
}

How long has perror been there? 12 years or so? If they haven't even done
that minimal amount of work in the past 12 years why expect them to do
something better. I mean, really!
-- 
Peter da Silva.   `-_-'
+1 713 274 5180.   'U`
peter@ferranti.com