The GNU `error' function is good for this; see <error.h>. It is takes a
printf format, but also takes an argument that if non-zero is an exit code
(if zero it does not exit) and an argument that if non-zero is an errno
code to print after the formatted message (and a colon). So do:
err = mach_msg (...);
if (err)
{
error (0, err, "mach_msg %s", "blah");
return 1;
}
or if you want to just die:
err = mach_msg (...);
if (err)
error (1, err, "mach_msg %s", "blah");
It will print:
program: mach_msg blah: error string
to stderr.
_______________________________________________
Bug-hurd mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-hurd