X-Git-Url: https://git.distorted.org.uk/~mdw/mLib/blobdiff_plain/0875b58fcccadd756e11487185c2ac1d3ed8ab4d..685b7e3e8c3436de0b719b53539d02651796c11a:/trace.c diff --git a/trace.c b/trace.c index c99c682..c1688ef 100644 --- a/trace.c +++ b/trace.c @@ -1,36 +1,46 @@ /* -*-c-*- * - * $Id: trace.c,v 1.1 1998/06/17 23:44:42 mdw Exp $ + * $Id: trace.c,v 1.4 1999/05/19 20:27:11 mdw Exp $ * * Tracing functions for debugging * * (c) 1998 Straylight/Edgeware */ -/*----- Licensing notice --------------------------------------------------* +/*----- Licensing notice --------------------------------------------------* * * This file is part of the mLib utilities library. * * mLib is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * * mLib is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with mLib; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with mLib; if not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. */ /*----- Revision history --------------------------------------------------* * * $Log: trace.c,v $ - * Revision 1.1 1998/06/17 23:44:42 mdw - * Initial revision + * Revision 1.4 1999/05/19 20:27:11 mdw + * Change naming to match newer mLib conventions. + * + * Revision 1.3 1999/05/06 19:51:35 mdw + * Reformatted the LGPL notice a little bit. + * + * Revision 1.2 1999/05/05 18:50:31 mdw + * Change licensing conditions to LGPL. + * + * Revision 1.1.1.1 1998/06/17 23:44:42 mdw + * Initial version of mLib * */ @@ -51,8 +61,8 @@ /*----- Private state information -----------------------------------------*/ -static FILE *trace__fp = 0; /* Where does debugging go? */ -static unsigned int trace__lvl = 0; /* How much tracing gets done? */ +static FILE *tracefp = 0; /* Where does debugging go? */ +static unsigned int tracelvl = 0; /* How much tracing gets done? */ /*----- Functions provided ------------------------------------------------*/ @@ -73,11 +83,11 @@ void trace(unsigned int l, const char *f, ...) if ((l & tracing()) == 0) return; va_start(ap, f); - fprintf(trace__fp, "*** %s: ", QUIS); - vfprintf(trace__fp, f, ap); + fprintf(tracefp, "*** %s: ", QUIS); + vfprintf(tracefp, f, ap); va_end(ap); - putc('\n', trace__fp); - fflush(trace__fp); + putc('\n', tracefp); + fflush(tracefp); } /* --- @trace_block@ --- * @@ -106,28 +116,28 @@ void trace_block(unsigned int l, const char *s, const void *b, size_t sz) /* --- Now start work --- */ - fprintf(trace__fp, "*** %s: %s\n", QUIS, s); + fprintf(tracefp, "*** %s: %s\n", QUIS, s); while (sz) { - fprintf(trace__fp, "*** %s: %08lx : ", QUIS, o); + fprintf(tracefp, "*** %s: %08lx : ", QUIS, o); for (i = 0; i < 8; i++) { if (i < sz) - fprintf(trace__fp, "%02x ", p[i]); + fprintf(tracefp, "%02x ", p[i]); else - fputs("** ", trace__fp); + fputs("** ", tracefp); } - fputs(": ", trace__fp); + fputs(": ", tracefp); for (i = 0; i < 8; i++) { if (i < sz) - fputc(isprint(p[i]) ? p[i] : '.', trace__fp); + fputc(isprint(p[i]) ? p[i] : '.', tracefp); else - fputc('*', trace__fp); + fputc('*', tracefp); } - fputc('\n', trace__fp); + fputc('\n', tracefp); c = (sz >= 8) ? 8 : sz; sz -= c, p += c, o += c; } - fflush(trace__fp); + fflush(tracefp); } /* --- @trace_on@ --- * @@ -142,9 +152,9 @@ void trace_block(unsigned int l, const char *s, const void *b, size_t sz) void trace_on(FILE *fp, unsigned int l) { - trace__fp = fp; - if (!trace__lvl) - trace__lvl = l; + tracefp = fp; + if (!tracelvl) + tracelvl = l; } /* --- @trace_setLevel@ --- * @@ -158,7 +168,7 @@ void trace_on(FILE *fp, unsigned int l) void trace_setLevel(unsigned int l) { - trace__lvl = l; + tracelvl = l; } /* --- @tracing@ --- * @@ -172,7 +182,7 @@ void trace_setLevel(unsigned int l) unsigned int tracing(void) { - return (trace__fp ? trace__lvl : 0u); + return (tracefp ? tracelvl : 0u); } /*----- That's all, folks -------------------------------------------------*/