Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!haven!rutgers!cmcl2!phri!marob!daveh From: daveh@marob.MASA.COM (Dave Hammond) Newsgroups: comp.unix.wizards Subject: Re: friendly messages Message-ID: <604@marob.MASA.COM> Date: 30 Mar 89 22:54:36 GMT Reply-To: daveh@marob.masa.com (Dave Hammond) Organization: ESCC New York City Lines: 20 In article <1411@moscom.UUCP> jgp@moscom.UUCP posts his favorite error message printer. I note that for a return value it provides the return from vsprintf. Since error message printers are typically invoked prior to a return, or exit, I opt to have my favorite error printer return -1. While this, perhaps, bastardizes the significance of the function's return value, it (more often than not) makes for convenient error handling: ... if (an_error_occurred) return(errmsg(errcode, "Can't open file %s.", fname)); Obviously this presumes that the calling function normally returns -1 as an its error condition value. Functions which don't employ a -1 error return just void the return from the error printer. -- Dave Hammond daveh@marob.masa.com