Changeset 3865


Ignore:
Timestamp:
Jun 26, 2014, 4:25:29 PM (11 years ago)
Author:
bird
Message:

libsyslog & watcom.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libc/src/libsyslog/syslog.c

    r1200 r3865  
    4545#include <sys/un.h>
    4646#include <netdb.h>
    47 #ifdef __EMX__
     47#ifdef __KLIBC__
    4848# include <netinet/in.h>
    4949#endif
     
    5151#include <errno.h>
    5252#include <fcntl.h>
    53 #ifndef __EMX__
     53#ifndef __KLIBC__
    5454# include <paths.h>
    5555#else
     
    7878static void     connectlog(void);       /* (re)connect to syslogd */
    7979
    80 #ifndef __EMX__
     80#ifndef __KLIBC__
    8181/*
    8282 * Format of the magic cookie passed through the stdio hook
     
    139139        int fd, saved_errno;
    140140        char *stdp, tbuf[2048], fmt_cpy[1024], timbuf[26];
    141 #ifndef __EMX__
     141#ifndef __KLIBC__
    142142        FILE *fp, *fmt_fp;
    143143        struct bufcookie tbuf_cookie;
     
    163163                pri |= LogFacility;
    164164
    165 #ifndef __EMX__
     165#ifndef __KLIBC__
    166166        /* Create the primary stdio hook */
    167167        tbuf_cookie.base = tbuf;
     
    174174        /* Build the message. */
    175175        (void)time(&now);
    176 #ifndef __EMX__
     176#ifndef __KLIBC__
    177177        (void)fprintf(fp, "<%d>", pri);
    178178        (void)fprintf(fp, "%.15s ", ctime_r(&now, timbuf) + 4);
     
    182182#endif
    183183        if (LogStat & LOG_PERROR) {
    184 #ifndef __EMX__
     184#ifndef __KLIBC__
    185185                /* Transfer to string buffer */
    186186                (void)fflush(fp);
     
    193193                LogTag = _getprogname();
    194194        if (LogTag != NULL)
    195 #ifndef __EMX__
     195#ifndef __KLIBC__
    196196            (void)fprintf(fp, "%s", LogTag);
    197197#else
     
    199199#endif
    200200        if (LogStat & LOG_PID)
    201 #ifndef __EMX__
     201#ifndef __KLIBC__
    202202            (void)fprintf(fp, "[%d]", getpid());
    203203#else
     
    205205#endif
    206206        if (LogTag != NULL) {
    207 #ifndef __EMX__
     207#ifndef __KLIBC__
    208208            (void)fprintf(fp, ": ");
    209209#else
     
    215215        /* Check to see if we can skip expanding the %m */
    216216        if (strstr(fmt, "%m")) {
    217 #ifndef __EMX__
     217#ifndef __KLIBC__
    218218                /* Create the second stdio hook */
    219219                fmt_cookie.base = fmt_cpy;
     
    236236                    if (ch == '%' && fmt[1] == 'm') {
    237237                            ++fmt;
    238 #ifndef __EMX__
     238#ifndef __KLIBC__
    239239                            fputs(strerror(saved_errno), fmt_fp);
    240240#else
     
    243243                    } else if (ch == '%' && fmt[1] == '%') {
    244244                            ++fmt;
    245 #ifndef __EMX__
     245#ifndef __KLIBC__
    246246                            fputc(ch, fmt_fp);
    247247                            fputc(ch, fmt_fp);
     
    251251#endif
    252252                    } else {
    253 #ifndef __EMX__
     253#ifndef __KLIBC__
    254254                        fputc(ch, fmt_fp);
    255255#else
     
    260260
    261261            /* Null terminate if room */
    262 #ifndef __EMX__
     262#ifndef __KLIBC__
    263263            /* Null terminate if room */
    264264            fputc(0, fmt_fp);
     
    273273        }
    274274
    275 #ifndef __EMX__
     275#ifndef __KLIBC__
    276276        (void)vfprintf(fp, fmt, ap);
    277277        (void)fclose(fp);
     
    318318         */
    319319        if (LogStat & LOG_CONS &&
    320 #ifndef __EMX__
     320#ifndef __KLIBC__
    321321            (fd = _open(_PATH_CONSOLE, O_WRONLY|O_NONBLOCK, 0)) >= 0) {
    322322#else
     
    355355connectlog()
    356356{
    357 #ifndef __EMX__
     357#ifndef __KLIBC__
    358358        struct sockaddr_un SyslogAddr;  /* AF_UNIX address of local logger */
    359359#else
     
    362362
    363363        if (LogFile == -1) {
    364 #ifndef __EMX__
     364#ifndef __KLIBC__
    365365                if ((LogFile = _socket(AF_UNIX, SOCK_DGRAM, 0)) == -1)
    366366#else
     
    371371        }
    372372        if (LogFile != -1 && !connected) {
    373 #ifndef __EMX__
     373#ifndef __KLIBC__
    374374                SyslogAddr.sun_len = sizeof(SyslogAddr);
    375375                SyslogAddr.sun_family = AF_UNIX;
     
    388388                        sizeof(SyslogAddr)) != -1;
    389389
    390 #ifndef __EMX__
     390#ifndef __KLIBC__
    391391                if (!connected) {
    392392                        /*
Note: See TracChangeset for help on using the changeset viewer.