Annotation of embedaddon/ntp/sntp/log.c, revision 1.1.1.1
1.1 misho 1: #include <config.h>
2:
3: #include "log.h"
4:
5: char *progname = "sntp"; /* for msyslog use too */
6:
7: static void cleanup_log(void);
8:
9: void
10: init_logging(void)
11: {
12: openlog(progname, LOG_PID | LOG_CONS, OPENLOG_FAC);
13: msyslog_term = TRUE;
14: }
15:
16:
17: void
18: open_logfile(
19: const char *logfile
20: )
21: {
22: syslog_file = fopen(logfile, "a");
23: if (syslog_file == NULL) {
24: msyslog(LOG_ERR, "sntp: Cannot open logfile %s",
25: logfile);
26: return;
27: }
28: syslogit = FALSE;
29: atexit(cleanup_log);
30: }
31:
32:
33: static void
34: cleanup_log(void)
35: {
36: syslogit = TRUE;
37: fflush(syslog_file);
38: fclose(syslog_file);
39: syslog_file = NULL;
40: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>