Table of Contents
dprintf - debug level dependant formatted output conversion
extern int debug_level;
void nemo_dprintf(int level, char *format, ...);
void dprintf(int level, char *format, ...);
bool nemo_debug(int level);
dprintf can be used much in the same way as UNIX counterpart
printf(3)
and fprintf(3)
, except that the output of dprintf is always to
the standard output device, stderr, and is only done when the input parameter
level is less or equal a user or system defined debug_level. The user can
set debug_level by using a system keyword debug= or setting an environment
variable DEBUG (this is done by initparam(3NEMO)
). format is the string
to be encoded. The optional remaining arguments arg are handled through
a variable argument mechanism (see also printf(3)
).
nemo_debug can be used
to test for a debug level. Thus equivalent statements are:
dprintf(3,"Hello world0);
if (nemo_debug(3)) fprintf(stderr,"Hello world0);
Note dprintf(int,char *,...) is now used by the snprintfv package
see http://www.gnu.org/software/autogen/
The official name for NEMO's function
is now nemo_dprintf() although a macro will accept dprintf() since their
prototype happens to be the same as ours. You just don't have acccess to
their code.
getparam(3NEMO)
, printf(3)
~/src/josh/clib getparam.c dprintf.3
Peter Teuben
xx-mar-88 added to getparam.c Peter Teuben
26-sep-01 official name now nemo_dprintf() PJT
28-jul-02 implemented nemo_debug() PJT