Deleted Added
full compact
syslog.c (91940) syslog.c (93399)
1/*
2 * Copyright (c) 1983, 1988, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 21 unchanged lines hidden (view full) ---

30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#if defined(LIBC_SCCS) && !defined(lint)
35static char sccsid[] = "@(#)syslog.c 8.5 (Berkeley) 4/29/95";
36#endif /* LIBC_SCCS and not lint */
37#include <sys/cdefs.h>
1/*
2 * Copyright (c) 1983, 1988, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 21 unchanged lines hidden (view full) ---

30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#if defined(LIBC_SCCS) && !defined(lint)
35static char sccsid[] = "@(#)syslog.c 8.5 (Berkeley) 4/29/95";
36#endif /* LIBC_SCCS and not lint */
37#include <sys/cdefs.h>
38__FBSDID("$FreeBSD: head/lib/libc/gen/syslog.c 91940 2002-03-09 11:38:01Z dwmalone $");
38__FBSDID("$FreeBSD: head/lib/libc/gen/syslog.c 93399 2002-03-29 22:43:43Z markm $");
39
40#include "namespace.h"
41#include <sys/types.h>
42#include <sys/socket.h>
43#include <sys/syslog.h>
44#include <sys/uio.h>
45#include <sys/un.h>
46#include <netdb.h>
47
48#include <errno.h>
49#include <fcntl.h>
50#include <paths.h>
51#include <stdio.h>
39
40#include "namespace.h"
41#include <sys/types.h>
42#include <sys/socket.h>
43#include <sys/syslog.h>
44#include <sys/uio.h>
45#include <sys/un.h>
46#include <netdb.h>
47
48#include <errno.h>
49#include <fcntl.h>
50#include <paths.h>
51#include <stdio.h>
52#include <stdlib.h>
52#include <string.h>
53#include <time.h>
54#include <unistd.h>
55
56#if __STDC__
57#include <stdarg.h>
58#else
59#include <varargs.h>
60#endif
61#include "un-namespace.h"
62
53#include <string.h>
54#include <time.h>
55#include <unistd.h>
56
57#if __STDC__
58#include <stdarg.h>
59#else
60#include <varargs.h>
61#endif
62#include "un-namespace.h"
63
64#include "libc_private.h"
65
63static int LogFile = -1; /* fd for log */
64static int connected; /* have done connect */
65static int opened; /* have done openlog() */
66static int LogStat = 0; /* status bits, set by openlog() */
67static const char *LogTag = NULL; /* string to tag the entry with */
68static int LogFacility = LOG_USER; /* default facility code */
69static int LogMask = 0xff; /* mask of priorities to be logged */
66static int LogFile = -1; /* fd for log */
67static int connected; /* have done connect */
68static int opened; /* have done openlog() */
69static int LogStat = 0; /* status bits, set by openlog() */
70static const char *LogTag = NULL; /* string to tag the entry with */
71static int LogFacility = LOG_USER; /* default facility code */
72static int LogMask = 0xff; /* mask of priorities to be logged */
70extern char *__progname; /* Program name, from crt0. */
71
72static void disconnectlog(void); /* disconnect from syslogd */
73static void connectlog(void); /* (re)connect to syslogd */
74
75/*
76 * Format of the magic cookie passed through the stdio hook
77 */
78struct bufcookie {

--- 97 unchanged lines hidden (view full) ---

176 (void)fprintf(fp, "<%d>", pri);
177 (void)fprintf(fp, "%.15s ", ctime_r(&now, timbuf) + 4);
178 if (LogStat & LOG_PERROR) {
179 /* Transfer to string buffer */
180 (void)fflush(fp);
181 stdp = tbuf + (sizeof(tbuf) - tbuf_cookie.left);
182 }
183 if (LogTag == NULL)
73
74static void disconnectlog(void); /* disconnect from syslogd */
75static void connectlog(void); /* (re)connect to syslogd */
76
77/*
78 * Format of the magic cookie passed through the stdio hook
79 */
80struct bufcookie {

--- 97 unchanged lines hidden (view full) ---

178 (void)fprintf(fp, "<%d>", pri);
179 (void)fprintf(fp, "%.15s ", ctime_r(&now, timbuf) + 4);
180 if (LogStat & LOG_PERROR) {
181 /* Transfer to string buffer */
182 (void)fflush(fp);
183 stdp = tbuf + (sizeof(tbuf) - tbuf_cookie.left);
184 }
185 if (LogTag == NULL)
184 LogTag = __progname;
186 LogTag = _getprogname();
185 if (LogTag != NULL)
186 (void)fprintf(fp, "%s", LogTag);
187 if (LogStat & LOG_PID)
188 (void)fprintf(fp, "[%d]", getpid());
189 if (LogTag != NULL) {
190 (void)fprintf(fp, ": ");
191 }
192

--- 173 unchanged lines hidden ---
187 if (LogTag != NULL)
188 (void)fprintf(fp, "%s", LogTag);
189 if (LogStat & LOG_PID)
190 (void)fprintf(fp, "[%d]", getpid());
191 if (LogTag != NULL) {
192 (void)fprintf(fp, ": ");
193 }
194

--- 173 unchanged lines hidden ---