void suppl_log_log_header(void) { char *fnam; nlstime t; assert(suppl_Stack); if(!suppl_log_lock()) return; /* Open the logfile if not done so already */ if(!suppl_l_logfile) { /* If to lock the debug package fails, _item() and _trailer() will silently ignore any calls */ chkHeap if((fnam = appNameEx()) == 0) Esuppl_noMem(); fnam = EStrConcat(2, fnam, DBG_EXTENSION); suppl_l_logfile = Eopen(fnam, suppl_l_openmode); chkHeap free(fnam); }
void openlog(const char * const ident, int option, int facility) { static FLAG8 recursive = 0; /* to prevent recursive calls to openlog() when using syslogo() */ DBG_ENTER("openlog", Suppl_syslog) /* "++semaphore" is considered an atomic operation by many programs; it's native C's best approximation for the P(semaphore) operation */ if(++recursive == 1 /* not recursively called */ && ++syslog_opencount == 1) { /* not opened til now */ /* When these statements are executed, no logfile has been opened so far. That means that they can be logged onto STDERR only. */ chkHeap syslog_options = option; syslog_facility = facility; syslog_ident = Estrdup(ident); if((syslog_fnam = appNameEx()) == 0) Esuppl_noMem(); syslog_fnam = SYSLOG_FNAM(syslog_fnam); syslog_logfile = Eopen(syslog_fnam, syslog_openmode); chkHeap }