Changeset 3865
- Timestamp:
- Jun 26, 2014, 4:25:29 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libc/src/libsyslog/syslog.c
r1200 r3865 45 45 #include <sys/un.h> 46 46 #include <netdb.h> 47 #ifdef __ EMX__47 #ifdef __KLIBC__ 48 48 # include <netinet/in.h> 49 49 #endif … … 51 51 #include <errno.h> 52 52 #include <fcntl.h> 53 #ifndef __ EMX__53 #ifndef __KLIBC__ 54 54 # include <paths.h> 55 55 #else … … 78 78 static void connectlog(void); /* (re)connect to syslogd */ 79 79 80 #ifndef __ EMX__80 #ifndef __KLIBC__ 81 81 /* 82 82 * Format of the magic cookie passed through the stdio hook … … 139 139 int fd, saved_errno; 140 140 char *stdp, tbuf[2048], fmt_cpy[1024], timbuf[26]; 141 #ifndef __ EMX__141 #ifndef __KLIBC__ 142 142 FILE *fp, *fmt_fp; 143 143 struct bufcookie tbuf_cookie; … … 163 163 pri |= LogFacility; 164 164 165 #ifndef __ EMX__165 #ifndef __KLIBC__ 166 166 /* Create the primary stdio hook */ 167 167 tbuf_cookie.base = tbuf; … … 174 174 /* Build the message. */ 175 175 (void)time(&now); 176 #ifndef __ EMX__176 #ifndef __KLIBC__ 177 177 (void)fprintf(fp, "<%d>", pri); 178 178 (void)fprintf(fp, "%.15s ", ctime_r(&now, timbuf) + 4); … … 182 182 #endif 183 183 if (LogStat & LOG_PERROR) { 184 #ifndef __ EMX__184 #ifndef __KLIBC__ 185 185 /* Transfer to string buffer */ 186 186 (void)fflush(fp); … … 193 193 LogTag = _getprogname(); 194 194 if (LogTag != NULL) 195 #ifndef __ EMX__195 #ifndef __KLIBC__ 196 196 (void)fprintf(fp, "%s", LogTag); 197 197 #else … … 199 199 #endif 200 200 if (LogStat & LOG_PID) 201 #ifndef __ EMX__201 #ifndef __KLIBC__ 202 202 (void)fprintf(fp, "[%d]", getpid()); 203 203 #else … … 205 205 #endif 206 206 if (LogTag != NULL) { 207 #ifndef __ EMX__207 #ifndef __KLIBC__ 208 208 (void)fprintf(fp, ": "); 209 209 #else … … 215 215 /* Check to see if we can skip expanding the %m */ 216 216 if (strstr(fmt, "%m")) { 217 #ifndef __ EMX__217 #ifndef __KLIBC__ 218 218 /* Create the second stdio hook */ 219 219 fmt_cookie.base = fmt_cpy; … … 236 236 if (ch == '%' && fmt[1] == 'm') { 237 237 ++fmt; 238 #ifndef __ EMX__238 #ifndef __KLIBC__ 239 239 fputs(strerror(saved_errno), fmt_fp); 240 240 #else … … 243 243 } else if (ch == '%' && fmt[1] == '%') { 244 244 ++fmt; 245 #ifndef __ EMX__245 #ifndef __KLIBC__ 246 246 fputc(ch, fmt_fp); 247 247 fputc(ch, fmt_fp); … … 251 251 #endif 252 252 } else { 253 #ifndef __ EMX__253 #ifndef __KLIBC__ 254 254 fputc(ch, fmt_fp); 255 255 #else … … 260 260 261 261 /* Null terminate if room */ 262 #ifndef __ EMX__262 #ifndef __KLIBC__ 263 263 /* Null terminate if room */ 264 264 fputc(0, fmt_fp); … … 273 273 } 274 274 275 #ifndef __ EMX__275 #ifndef __KLIBC__ 276 276 (void)vfprintf(fp, fmt, ap); 277 277 (void)fclose(fp); … … 318 318 */ 319 319 if (LogStat & LOG_CONS && 320 #ifndef __ EMX__320 #ifndef __KLIBC__ 321 321 (fd = _open(_PATH_CONSOLE, O_WRONLY|O_NONBLOCK, 0)) >= 0) { 322 322 #else … … 355 355 connectlog() 356 356 { 357 #ifndef __ EMX__357 #ifndef __KLIBC__ 358 358 struct sockaddr_un SyslogAddr; /* AF_UNIX address of local logger */ 359 359 #else … … 362 362 363 363 if (LogFile == -1) { 364 #ifndef __ EMX__364 #ifndef __KLIBC__ 365 365 if ((LogFile = _socket(AF_UNIX, SOCK_DGRAM, 0)) == -1) 366 366 #else … … 371 371 } 372 372 if (LogFile != -1 && !connected) { 373 #ifndef __ EMX__373 #ifndef __KLIBC__ 374 374 SyslogAddr.sun_len = sizeof(SyslogAddr); 375 375 SyslogAddr.sun_family = AF_UNIX; … … 388 388 sizeof(SyslogAddr)) != -1; 389 389 390 #ifndef __ EMX__390 #ifndef __KLIBC__ 391 391 if (!connected) { 392 392 /*
Note:
See TracChangeset
for help on using the changeset viewer.