diewarn.h
header#include "/package/prog/prjlibs/include/diewarn.h" { /* logic errors */ DIE1X(100, "something bad happened"); DIE2X(100, "something bad happened: ", "here's what"); DIE3X(100, "one, ", "two, ", "three"); DIE4X(100, "one, ", "two, ", "three, ", "four"); DIE_USAGE(" expected arguments"); DIE_OVERFLOW(); DIE_MALFORMED("some-parameter", "bad value"); /* operating system errors */ WARN0(operation); WARN1(operation, "arg"); WARN2(operation, "arg0", "arg1"); DIE0(operation); DIE1(operation, "arg"); DIE2(operation, "arg0", "arg1"); }
The diewarn.h
C header file defines macros to easily produce
uniform error messages. These macros expand to calls to
strerr_*
and error_temp
functions; they should work
with any existing implementation, although I have only tested with the
implementation in
skalibs.
0-argument operations: alloc, fork, wait, dup, dup2, pipe, setuid, setgid, setgroups, tcgetattr, tcsetattr, tcsetpgrp, setpgid, setsid, sigemptyset, sigaddset, sigdelset, sigaction, sigprocmask, sigsuspend, setitimer, tioccons, vt_act, vt_qry, vt_getm, vt_setm, gethostname, buffer_prefeed.
1-argument operations: mkdir, chdir, chroot, chown, stat, exec, unlink, utimes, open, close, read, write, getfl, setfl, mmap, lseek, fsync.
2-argument operations: link, rename.