1N/A * Copyright (c) 2000, 2001, 2003, 2004 Sendmail, Inc. and its suppliers. 1N/A * All rights reserved. 1N/A * By using this file, you agree to the terms and conditions set 1N/A * forth in the LICENSE file which can be found at the top level of 1N/A * the sendmail distribution. 1N/A** libsm debugging and tracing 1N/A#
endif /* _FFR_DEBUG_PID_TIME */ 1N/A** Abstractions for printing trace messages. 1N/A** The output file to which trace output is directed. 1N/A** There is a controversy over whether this variable 1N/A** should be process global or thread local. 1N/A** To make the interface more abstract, we've hidden the 1N/A** variable behind access functions. 1N/A** SM_DEBUG_FILE -- Returns current debug file pointer. 1N/A** current debug file pointer. 1N/A** SM_DEBUG_SETFILE -- Sets debug file pointer. 1N/A** fp -- new debug file pointer. 1N/A** Sets SmDebugOutput. 1N/A** SM_DEBUG_CLOSE -- Close debug file pointer. 1N/A** Closes SmDebugOutput. 1N/A** SM_DPRINTF -- printf() for debug output. 1N/A** fmt -- format for printf() 1N/A "@(#)$Debug: sm_trace_pid_time - print pid and time in debug $");
1N/A#
endif /* _FFR_DEBUG_PID_TIME */ 1N/A#
else /* SM_VA_STD */ 1N/A#
endif /* SM_VA_STD */ 1N/A /* note: this is ugly if the output isn't a full line! */ 1N/A static char str[
32] =
"[1900-00-00/00:00:00] ";
1N/A#
endif /* _FFR_DEBUG_PID_TIME */ 1N/A** SM_DFLUSH -- Flush debug output. 1N/A** This is the internal database of debug settings. 1N/A** The semantics of looking up a setting in the settings database 1N/A** are that the *last* setting specified in a -d option on the sendmail 1N/A** command line that matches a given SM_DEBUG structure is the one that is 1N/A** used. That is necessary to conform to the existing semantics of 1N/A** the sendmail -d option. We store the settings as a linked list in 1N/A** reverse order, so when we do a lookup, we take the *first* entry 1N/A** We keep a linked list of SM_DEBUG structures that have been initialized, 1N/A** for use by sm_debug_reset. 1N/A** SM_DEBUG_RESET -- Reset SM_DEBUG structures. 1N/A** Reset all SM_DEBUG structures back to the uninitialized state. 1N/A** This is used by sm_debug_addsetting to ensure that references to 1N/A** SM_DEBUG structures that occur before sendmail processes its -d flags 1N/A** do not cause those structures to be permanently forced to level 0. 1N/A** SM_DEBUG_ADDSETTING_X -- add an entry to the database of debug settings 1N/A** pattern -- a shell-style glob pattern (see sm_match). 1N/A** WARNING: the storage for 'pattern' will be owned by 1N/A** the debug package, so it should either be a string 1N/A** literal or the result of a call to sm_strdup_x. 1N/A** level -- a non-negative integer. 1N/A** F:sm_heap -- out of memory 1N/A** PARSE_NAMED_SETTING_X -- process a symbolic debug setting 1N/A** s -- Points to a non-empty \0 or , terminated string, 1N/A** of which the initial character is not a digit. 1N/A** pointer to terminating \0 or , character. 1N/A** adds the setting to the database. 1N/A while (*s !=
'\0' && *s !=
',' && *s !=
'.')
1N/A /* skip trailing junk */ 1N/A while (*s !=
'\0' && *s !=
',')
1N/A** SM_DEBUG_ADDSETTINGS_X -- process a list of debug options 1N/A** s -- a list of debug settings, eg the argument to the 1N/A** sendmail -d option. 1N/A** The syntax of the string s is as follows: 1N/A** <settings> ::= <setting> | <settings> "," <setting> 1N/A** <setting> ::= <categories> | <categories> "." <level> 1N/A** <categories> ::= [a-zA-Z_*?][a-zA-Z0-9_*?]* 1N/A** However, note that we skip over anything we don't 1N/A** understand, rather than report an error. 1N/A** updates the database of debug settings. 1N/A** SM_DEBUG_LOADLEVEL -- Get activation level of the specified debug object. 1N/A** debug -- debug object. 1N/A** Activation level of the specified debug object. 1N/A** Ensures that the debug object is initialized. 1N/A** SM_DEBUG_LOADACTIVE -- Activation level reached? 1N/A** debug -- debug object. 1N/A** level -- level to check. 1N/A** true iff the activation level of the specified debug 1N/A** Ensures that the debug object is initialized.