/[anubis]/anubis/src/log.c
ViewVC logotype

Diff of /anubis/src/log.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by gray, Thu Aug 14 12:30:39 2003 UTC revision 1.6 by polak, Fri Aug 15 09:56:49 2003 UTC
# Line 27  Line 27 
27  #include "rcfile.h"  #include "rcfile.h"
28    
29  void  void
30  mprintf(char *format, ...)  mprintf(const char *fmt, ...)
31  {  {
32          va_list arglist;          va_list arglist;
33          char txt[LINEBUFFER+1];          char txt[LINEBUFFER+1];
# Line 35  mprintf(char *format, ...) Line 35  mprintf(char *format, ...)
35          if (options.termlevel == SILENT)          if (options.termlevel == SILENT)
36                  return;                  return;
37    
38          va_start(arglist, format);          va_start(arglist, fmt);
39          vsnprintf(txt, LINEBUFFER, format, arglist);          vsnprintf(txt, LINEBUFFER, fmt, arglist);
40          va_end(arglist);          va_end(arglist);
41    
42          puts(txt);          puts(txt);
         return;  
43  }  }
44    
45  void  void
46  info(int mode, char *format, ...)  info(int mode, const char *fmt, ...)
47  {  {
48          va_list arglist;          va_list arglist;
49          char txt[LINEBUFFER+1];          char txt[LINEBUFFER+1];
# Line 52  info(int mode, char *format, ...) Line 51  info(int mode, char *format, ...)
51          if (mode > options.termlevel)          if (mode > options.termlevel)
52                  return;                  return;
53    
54          va_start(arglist, format);          va_start(arglist, fmt);
55          vsnprintf(txt, LINEBUFFER, format, arglist);          vsnprintf(txt, LINEBUFFER, fmt, arglist);
56          va_end(arglist);          va_end(arglist);
57    
58  #ifdef HAVE_SYSLOG  #ifdef HAVE_SYSLOG
# Line 81  filelog(char *logfile, char *txt) Line 80  filelog(char *logfile, char *txt)
80          FILE *fplog;          FILE *fplog;
81    
82          fplog = fopen(logfile, "a");          fplog = fopen(logfile, "a");
83          if (fplog == 0)          if (fplog == NULL)
84                  return;                  return;
85          else {          else {
86                  time_t tp;                  time_t tp;
# Line 96  filelog(char *logfile, char *txt) Line 95  filelog(char *logfile, char *txt)
95                  fprintf(fplog, "%s [%d] %s\n", timebuf, (int)getpid(), txt);                  fprintf(fplog, "%s [%d] %s\n", timebuf, (int)getpid(), txt);
96                  fclose(fplog);                  fclose(fplog);
97          }          }
         return;  
98  }  }
99    
100  void  void
# Line 104  trace(RC_LOC *loc, const char *fmt, ...) Line 102  trace(RC_LOC *loc, const char *fmt, ...)
102  {  {
103          va_list ap;          va_list ap;
104          int n = 0;          int n = 0;
105          char txt[LINEBUFFER];          char txt[LINEBUFFER+1];
106    
107          if (VERBOSE > options.termlevel)          if (options.termlevel < VERBOSE)
108                  return;                  return;
109    
110          if (loc)          if (loc)
111                  n = snprintf(txt, sizeof(txt), "%s:%lu: ",                  n = snprintf(txt, sizeof(txt), "%s:%lu: ",
112                               loc->file, (unsigned long)loc->line);                               loc->file, (unsigned long)loc->line);
113          va_start(ap, fmt);          va_start(ap, fmt);
114          vsnprintf(txt + n, sizeof(txt) - n, fmt, ap);          vsnprintf(txt + n, LINEBUFFER - n, fmt, ap);
115          va_end(ap);          va_end(ap);
116          info(VERBOSE, "%s", txt);          info(VERBOSE, "%s", txt);
117  }  }

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26