From: utzoo!decvax!duke!harpo!utah-cs!utah-gr!thomas
Newsgroups: net.unix-wizards
Title: Re:  Identify program error messages, please!
Article-I.D.: utah-gr.538
Posted: Sat Aug 21 10:57:14 1982
Received: Sun Aug 22 03:34:53 1982
References: sri-unix.2810

We have a macro, called SCREAM, which prints the file name, a colon, and
an error message.  Not quite as good as the program name, but it is
easily determined by the pre-processor at compile time.  The text is:

#define	SCREAM(msg)	(fprintf(stderr,"%s: ",__FILE__),\
 			eprintf msg)	/* print an error msg */

eprintf is like printf, but printes on stderr.  The only weird thing with
this macro is that it takes only a single argument:  The printf argument
list, enclosed in parens.  Thus, an invocation might be:
	SCREAM( ("Can't open file %s\n", filename) );

=Spencer