/* ***************************************************************************** * * Copyright 1992, Xylogics, Inc. ALL RIGHTS RESERVED. * * ALL RIGHTS RESERVED. Licensed Material - Property of Xylogics, Inc. * This software is made available solely pursuant to the terms of a * software license agreement which governs its use. * Unauthorized duplication, distribution or sale are strictly prohibited. * * Module Description:: * * Debugging support routines for systems with vfprintf. * * Original Author: James Carlson Created on: 05AUG92 * * Module Reviewers: * lint * * Revision Control Information: * $Id: debugging.vf,v 1.3 1992/09/03 10:39:36 carlson Rel $ * * This file created by RCS from * $Source: /annex/common/src/./newrtelnet/RCS/debugging.vf,v $ * * Revision History: * $Log: debugging.vf,v $ * Revision 1.3 1992/09/03 10:39:36 carlson * Added config.h for SCO Unix -- alignment problems with fprintf. * * Revision 1.2 92/08/05 15:57:27 carlson * Added missing module header. * * This file is currently under revision by: $Locker: $ * ***************************************************************************** */ /* * Include Files */ #include "../inc/config.h" #include #include #include #include #include "rtelnet.h" #ifndef NO_DEBUG /* * External Definitions */ extern int debug,process_id; /* * Global Data Declarations */ char dbgrev[] = "$Revision: 1.3 $"; char dbgsrc[] = "$Source: /annex/common/src/./newrtelnet/RCS/debugging.vf,v $"; /* * Static Data Declarations */ static char *severity[] = { "INIT", /* Entry/Exit messages */ "INFO", /* Informational messages */ "WARN", /* Warnings */ "ERR ", /* Errors */ "FATL" /* Fatal internal problems */ }; static char dbuf[1024]; void initialize_debugging() { } /*VARARGS 3*/ void _DBG(va_alist) va_dcl { va_list ap; int level,sever; char *fmt; time_t thetime; register struct tm *tm; va_start(ap); level = va_arg(ap,int); sever = va_arg(ap,int); fmt = va_arg(ap,char *); if (debug >= level) { thetime = time(NULL); tm = localtime(&thetime); (void)sprintf(dbuf,"%s:%d:%d%02d%02d%02d%02d%02d: ", severity[sever],process_id,tm->tm_year+1900, tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min, tm->tm_sec); (void)vsprintf(dbuf+strlen(dbuf),fmt,ap); (void)fprintf(stderr,"%s\n",dbuf); } va_end(ap); } #endif /* NO_DEBUG */