# 2.11BSD#431 - /usr/src/new/nntp/server/fakesyslog.c

##### Functions

    openlog           X
    syslog            X

       1: #if !defined(lint) && defined(DOSCCS)
       2: static char *sccsid = "@(#)fakesyslog.c	1.3.1	(2.11BSD) 1996/3/21";
       3: #endif
       4:
       5: /*
       6:  * Fake syslog routines for systems that don't have syslog.
       7:  * Taken from an idea by Paul McKenny, <mckenny@sri-unix.arpa>.
       8:  * (Unfortunately, Paul, I can't distribute the real syslog code
       9:  * as you suggested ... sigh.)
      10:  *
      11:  * Warning: this file contains joe code that may offend you.
      12:  */
      13:
      14: #include <stdio.h>
      15: #include <string.h>
      16: #include <errno.h>
      17:
      18: #include "../common/conf.h"
      19:
      20: #ifdef FAKESYSLOG
      21:
      22: static FILE *logfp;
      23:
      24: char    *ctime();
      25:
      26: openlog()
      27: {
      28:     logfp = fopen(FAKESYSLOG, "a");
      29: }
      30:
      31:
      32: syslog(pri, msg, x1, x2, x3, x4, x5, x6)
      33:     int pri;
      34:     char    *msg, *x1, *x2, *x3, *x4, *x5, *x6;
      35: {
      36:     char        buf[1024];
      37:     char        *cp, *bp;
      38:     long        clock;
      39:     static int  failed = 0;
      40:
      41:     if (failed)
      42:         return;
      43:
      44:     if (logfp == NULL) {
      45:         openlog();
      46:         if (logfp == NULL) {
      47:             failed = 1;
      48:             return;
      49:         }
      50:     }
      51:
      52:     (void) time(&clock);
      53:     (void) strcpy(buf, ctime(&clock));
      54:
      55:     bp = buf + strlen(buf)-1;
      56:     *bp++ = ' ';
      57:     *bp = '\0';
      58:     for (cp = msg; *cp; cp++) {
      59:         if (*cp == '%' && cp[1] == 'm') {
      60:             *bp = '\0';
      61:             (void) strcat(bp, strerror(errno));
      62:             bp = buf + strlen(buf);
      63:             cp++;
      64:         } else {
      65:             *bp++ = *cp;
      66:         }
      67:     }
      68:     *bp = '\0';
      69:     /* Ah, the semantic security of C ... */
      70:     if (bp[-1] != '\n')
      71:         (void) strcat(bp, "\n");
      72:
      73:     fprintf(logfp, buf, x1, x2, x3, x4, x5, x6);
      74: }
      75:
      76: #endif

#### Defined functions

openlog defined in line 26; used 5 times

- in line 45
- in /usr/src/new/nntp/server/main.c line 39-41(2)
- in /usr/src/new/nntp/server/serve.c line 109-111(2)

syslog defined in line 32; used 51 times

- in /usr/src/new/nntp/server/access.c line 92, 117, 129, 155
- in /usr/src/new/nntp/server/access_dnet.c line 59
- in /usr/src/new/nntp/server/access_inet.c line 49
- in /usr/src/new/nntp/server/active.c line 52, 59, 68, 77, 93
- in /usr/src/new/nntp/server/group.c line 68
- in /usr/src/new/nntp/server/ihave.c line 40, 61
- in /usr/src/new/nntp/server/list.c line 32
- in /usr/src/new/nntp/server/main.c line 62, 82, 94
- in /usr/src/new/nntp/server/misc.c line 127, 146, 158, 181, 191, 206
- in /usr/src/new/nntp/server/netaux.c line 107, 132, 141, 208
- in /usr/src/new/nntp/server/newgroups.c line 37
- in /usr/src/new/nntp/server/newnews.c line 59, 142, 412
- in /usr/src/new/nntp/server/post.c line 24, 35, 50
- in /usr/src/new/nntp/server/serve.c line 138, 224, 244, 270-276(3), 284, 309
- in /usr/src/new/nntp/server/spawn.c line 114-117(2), 131, 179, 197, 217, 224, 249

#### Defined variables

sccsid defined in line 2; never used

Last modified: 1996-03-22 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 1149 |