Added support for TESTING.

This commit is contained in:
Joey Schulze 1998-10-12 16:58:12 +00:00
parent 3aed3fb33a
commit 30271480d1

View File

@ -180,7 +180,9 @@ vsyslog(pri, fmt, ap)
(void)close(fd); (void)close(fd);
} }
#ifndef TESTING
static struct sockaddr SyslogAddr; /* AF_UNIX address of local logger */ static struct sockaddr SyslogAddr; /* AF_UNIX address of local logger */
#endif
/* /*
* OPENLOG -- open system log * OPENLOG -- open system log
*/ */
@ -200,6 +202,7 @@ openlog(ident, logstat, logfac)
#endif #endif
LogFacility = logfac; LogFacility = logfac;
#ifndef TESTING
if (LogFile == -1) { if (LogFile == -1) {
SyslogAddr.sa_family = AF_UNIX; SyslogAddr.sa_family = AF_UNIX;
strncpy(SyslogAddr.sa_data, _PATH_LOGNAME, strncpy(SyslogAddr.sa_data, _PATH_LOGNAME,
@ -212,6 +215,9 @@ openlog(ident, logstat, logfac)
if (LogFile != -1 && !connected && if (LogFile != -1 && !connected &&
connect(LogFile, &SyslogAddr, sizeof(SyslogAddr.sa_family)+ connect(LogFile, &SyslogAddr, sizeof(SyslogAddr.sa_family)+
strlen(SyslogAddr.sa_data)) != -1) strlen(SyslogAddr.sa_data)) != -1)
#else
LogFile = fileno(stdout);
#endif
connected = 1; connected = 1;
} }
@ -221,7 +227,9 @@ openlog(ident, logstat, logfac)
void void
closelog() closelog()
{ {
#ifndef TESTING
(void) close(LogFile); (void) close(LogFile);
#endif
LogFile = -1; LogFile = -1;
connected = 0; connected = 0;
} }