friendly messages
Dave Hammond
daveh at marob.MASA.COM
Fri Mar 31 08:54:36 AEST 1989
In article <1411 at moscom.UUCP> jgp at 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 at marob.masa.com
More information about the Comp.unix.wizards
mailing list