openlog_internal(const char *ident, int logstat, int logfac)
static void openlog_internal(const char *, int, int) internal_function; static void closelog_internal(void); static void sigpipe_handler (int); #ifdef _LIBC_REENTRANT static void cancel_handler (void *); #endif   void #if __STDC__ syslog(int pri, const char *fmt, ...) #else syslog(pri, fmt, va_alist) int pri; char *fmt; va_dcl #endif
openlog_internal(const char *ident, int logstat, int logfac){	if (ident != NULL)		LogTag = ident;	LogStat = logstat;	if (logfac != 0 && (logfac &~ LOG_FACMASK) == 0)		LogFacility = logfac;	while (1) {		if (LogFile == -1) {			SyslogAddr.sa_family = AF_UNIX;			(void)strncpy(SyslogAddr.sa_data, _PATH_LOG,				      sizeof(SyslogAddr.sa_data));			if (LogStat & LOG_NDELAY) {				if ((LogFile = __socket(AF_UNIX, LogType, 0))				    == -1)					return;				(void)__fcntl(LogFile, F_SETFD, 1);			}		}		if (LogFile != -1 && !connected)		{			int old_errno = errno;			if (__connect(LogFile, &SyslogAddr, sizeof(SyslogAddr))			    == -1)			{				int saved_errno = errno;				(void)__close(LogFile);				LogFile = -1;				if (LogType == SOCK_DGRAM				    && saved_errno == EPROTOTYPE)				{					/* retry with next SOCK_STREAM: */					LogType = SOCK_STREAM;					__set_errno (old_errno);					continue;				}			} else				connected = 1;		}		break;	}}