Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!watdragon!jmsellens From: jmsellens@watdragon.UUCP Newsgroups: comp.unix.questions Subject: Re: rsh, rcp and the message "Where are you?" Message-ID: <4110@watdragon.waterloo.edu> Date: Fri, 13-Nov-87 00:52:03 EST Article-I.D.: watdrago.4110 Posted: Fri Nov 13 00:52:03 1987 Date-Received: Sat, 14-Nov-87 15:17:33 EST References: <173@tarski.quintus.UUCP> <9312@mimsy.UUCP> Reply-To: jmsellens@watdragon.waterloo.edu (John M. Sellens) Organization: U. of Waterloo, Ontario Lines: 46 In article <9312@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes: >This (message from biff), by the way, points up the fact that >every program that prints error messages should also print its >own name. If Gregg had seen > > % rcp otherhost:file here > biff: Where are you > % > >he might at least have had *one* clue as to where to look. And if biff had printed some sort of reasonable error message, like "biff: standard error is not attached to a terminal" it might be a useful error message. And if that myriad of programs that print "Who are you?" when they can't figure something out printed something reasonable instead, the world would be a better place in which to live. If I may, I would like to propose some error message guidelines, which some of you undoubtedly will think of as obvious. - Always always always put the program's name in the error message. And not the name you think it should be called, the argv[0] name that it actually was called. - Don't use "cute" error messages (like the one above) - say what is really wrong. - Always print error messages on the error output (stderr or 2). - Don't print a message like "prog: can't open file", say which file you can't open, and why, as in: if ( ( fp = fopen( file, "r" ) ) == (FILE *) NULL ) { fprintf(stderr,"%s: can't open file '%s' for reading\n", argv[0],file); perror( argv[0] ); /* or use sys_errlist[errno] */ exit(1); } i.e. Say what you can't do something to (the quotes are around it so that you can see if there are any extraneous spaces or tabs in the name), say what you can't do to it, and why. - Always use exit() to set the exit status of your program. If you don't call exit(0) at the end of main(), your program will exit with some random exit code, causing many to think that it failed somehow. Sorry - if I stated the obvious. I hate goofy "error" messages. John