TRACE

Section: C Library Functions (3)
Index Return to Main Contents
 

NAME

TRACE, TRACEF, traceset - trace package  

SYNOPSIS

#include <useful.h>

BOOL TRACEF(flag, level)
int flag;
int level;

TRACE(flag, level, (printf arguments));

void traceset(tracestring)
char *tracestring;  

DESCRIPTION

The traceset routine and the TRACE and TRACEF macros implement a simple trace flag package. A large number of trace flags (200 default) can each be set to a trace level varying from zero (no tracing for this flag) to 255 (full tracing).

The TRACEF macro tests whether the specified flag is set to at least the indicated level. For example:

       if (TRACEF(24, 3))

tests flag 24; if it is set to 3 or higher, the if statement succeeds.

The TRACE macro incorporates a printf(3) statement. For example, the code:

       TRACE(24, 3, ("xyzzy = %d, xyzzy));

Prints the ``xyzzy'' variable when trace flag 24 is set to level 3 or higher. The extra set of parentheses is important.

Flags can be adjusted using the traceset routine. This parses the trace string, setting indicated flags as it goes. The string is a comma-separated list of trace settings. Each setting has the syntax:

       flag[-flag][.level]

If the level is omitted, one is assumed. If only one flag is indicated, it is set individually. If a range of flags is given, all flags inclusively between the two values are set. For example:

       20-29.2

sets the ten flags numbered between 20 and 29 to level 2.

Flag names can be symbolic. Symbolic names are looked up in the file ``<searchpath>/lib/traceflags'', where <searchpath> is the default search path used by openpath(3). This file is a series of lines, each containing a flag name, white space, and the flag value. Blank lines and lines beginning with `#' are ignored. Case is ignored in flag names.  

SEE ALSO

openpath(3), parseargs(3)  

AUTHOR

Eric Allman, University of California, Berkeley


 

Index

NAME
SYNOPSIS
DESCRIPTION
SEE ALSO
AUTHOR

This document was created by man2html, using the manual pages.
Time: 21:53:14 GMT, February 02, 2023