Path: utzoo!utgpu!watmath!clyde!att!ihlpb!gregg
From: gregg@ihlpb.ATT.COM (Wonderly)
Newsgroups: comp.unix.wizards
Subject: Re: Weird Problem with cat
Message-ID: <9146@ihlpb.ATT.COM>
Date: 5 Dec 88 23:31:14 GMT
References: <360@stca77.stc.oz>
Organization: AT&T Bell Laboratories - Naperville, Illinois
Lines: 34

>>How can we get programmers to do this right?
> From the security point of view, it is right.
> 
> Having said all that, I agree that messages like "Permission Denied" are
> a severe pain when one is trying to debug a system.  I tend towards the
> view that you always provide additional information - just not necesssarily
> in a form useful to the end user (like giving the source file/line and
> internal error numbers when an error occurs) when the end-user is just
> a user.

The biggest problem is getting people to use the OS error messages and
capabilities instead of inventing their own.  Time after time I have
changed.

	if ((fd = creat (file, 0600)) == -1) {
		printf ("Can't create some file\n");
		handle_the_error_exit();
	}

to

	if ((fd = creat (file, 0600)) == -1) {
		perror (file);
		handle_the_error_exit();
	}

in code I have ported from the net.  Perror(3) (and the associated
sys_errlist array) is one of the MOST useful parts of the C-library
under UN*X (please don't start another 'errno should not be global'
war though).

-- 
It isn't the DREAM that NASA's missing...  DOMAIN: gregg@ihlpb.att.com
It's a direction!                          UUCP:   att!ihlpb!gregg