home *** CD-ROM | disk | FTP | other *** search
-
- /*
- * @(#)traceMsg.c 1.2 2/23/90
- */
-
- /* File: /u1/Eden/Source/MsgOps/TraceMsg.c */
- /* V2.0: /u1/Eden/Kernel/MsgOps/traceMsg.c */
-
- /*
- * $Header: /u1/Eden/Kernel/MsgOps/RCS/TraceMsg.v Revision 1.3 85/03/14 12:17:22 eric Exp$
- * INTERFACE: Defined by exported procedures.
- *
- * FUNCTION: Provides Message Module trace facility.
- *
- * IMPORTS: None.
- *
- * EXPORTS: MMTrace, MMTraceHost, MMTraceMsg.
- *
- * DESIGN: None.
- *
- * $Log: /u1/Eden/Source/MsgOps/RCS/TraceMsg.v $
- * Revision 1.3 85/03/14 12:17:22 eric
- * Changed trace output levels and made the indentation correspond to the
- * trace level.
- *
- * Revision 1.2 83/02/25 12:17:22 cady
- * No change.
- *
- * Revision 1.1 83/02/24 16:34:58 cady
- * Initial revision
- *
- */
-
-
- /****************************************************************/
- /* */
- /* Message Module Trace Facility */
- /* */
- /****************************************************************/
-
- #include <stdio.h>
- #include "Kernel/h/stdTypes.h"
-
- #include "Kernel/h/kmdTypes.h"
-
- /****************************************************************/
- /* */
- /* MMTraceMsg */
- /* */
- /* MMTraceMsg prints out a message to help with debugging. */
- /* This is an old Unix hack to allow a variable number of */
- /* arguments to doprnt. This should eventually be changed to */
- /* put messages in a file or out an IPC port or something. */
- /* The trace flag MMTrace is initialized to 0 and is set */
- /* somewhere else depending on the higher-level code using */
- /* the Message Module. */
- /* */
- /****************************************************************/
-
- int MMTrace = 0;
- char MMTraceHost[100] = "\0";
- static char *Blanks[] = {
- " ", " ", " ", " ", " ", " ", " ", " ", " "};
-
- /*VARARGS2*/
- void MMTraceMsg( fLevel,
- fFormat,
- fArgs
- )
- int fLevel;
- char *fFormat;
- char *fArgs;
- {
- struct _iobuf _strbuf;
- char fullfmt[2000];
- char formatbuf[2000];
-
- /* Indent according to level. */
- if ( (fLevel < 1) || (fLevel > 8) ) {
- (void) sprintf(formatbuf, "%d: %s", fLevel, fFormat);
- } else {
- (void) sprintf(formatbuf, "%s%s", Blanks[fLevel], fFormat);
- }
-
- if ( MMTrace >= fLevel ){
- if ( MMTraceHost[0] != '\0' )
- printf("%s:", MMTraceHost);
-
- #ifdef BSD
- _doprnt( formatbuf, &fArgs, stdout );
- #else
- _strbuf._flag = _IOWRT+_IOSTRG;
- #ifdef vax
- _strbuf._ptr = fullfmt;
- #else
- _strbuf._ptr = (unsigned char *)fullfmt;
- #endif
-
- _strbuf._cnt = 32767;
- _doprnt(formatbuf, &fArgs, &_strbuf);
- putc('\0',&_strbuf);
- printf("%s",fullfmt);
- #endif
- }
- KMDTracex("MMTraceMsg", fLevel, formatbuf, &fArgs);
- }
-