mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-08 17:13:56 +00:00
Removed \r for syslog
SVN revision: 1020
This commit is contained in:
parent
381037236d
commit
2fd25cdb3d
29
src/elogd.c
29
src/elogd.c
@ -6,6 +6,9 @@
|
|||||||
Contents: Web server program for Electronic Logbook ELOG
|
Contents: Web server program for Electronic Logbook ELOG
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.434 2004/08/04 13:38:43 midas
|
||||||
|
Removed \r for syslog
|
||||||
|
|
||||||
Revision 1.433 2004/08/04 13:32:27 midas
|
Revision 1.433 2004/08/04 13:32:27 midas
|
||||||
Fixed windows service related problems
|
Fixed windows service related problems
|
||||||
|
|
||||||
@ -981,11 +984,22 @@ HANDLE hEventLog;
|
|||||||
/* Print MSG to syslog */
|
/* Print MSG to syslog */
|
||||||
void print_syslog(const char *msg)
|
void print_syslog(const char *msg)
|
||||||
{
|
{
|
||||||
|
char *p;
|
||||||
|
|
||||||
|
/* strip trailing \r and \n */
|
||||||
|
p = malloc(strlen(msg));
|
||||||
|
assert(p);
|
||||||
|
strcpy(p, msg);
|
||||||
|
while (p[strlen(p)-1] == '\r' || p[strlen(p)-1] == '\n')
|
||||||
|
p[strlen(p)-1] = 0;
|
||||||
|
|
||||||
#ifdef OS_UNIX
|
#ifdef OS_UNIX
|
||||||
syslog(SYSLOG_PRIORITY, "%s", msg);
|
syslog(SYSLOG_PRIORITY, "%s", msg);
|
||||||
#else
|
#else
|
||||||
ReportEvent(hEventLog, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, &msg, NULL);
|
ReportEvent(hEventLog, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, &msg, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print MSG to stderr */
|
/* Print MSG to stderr */
|
||||||
@ -997,11 +1011,22 @@ void print_stderr(const char *msg)
|
|||||||
/* Dump BUF to syslog */
|
/* Dump BUF to syslog */
|
||||||
void fputs_syslog(const char *buf)
|
void fputs_syslog(const char *buf)
|
||||||
{
|
{
|
||||||
|
char *p;
|
||||||
|
|
||||||
|
/* strip trailing \r and \n */
|
||||||
|
p = malloc(strlen(buf));
|
||||||
|
assert(p);
|
||||||
|
strcpy(p, buf);
|
||||||
|
while (p[strlen(p)-1] == '\r' || p[strlen(p)-1] == '\n')
|
||||||
|
p[strlen(p)-1] = 0;
|
||||||
|
|
||||||
#ifdef OS_UNIX
|
#ifdef OS_UNIX
|
||||||
syslog(SYSLOG_PRIORITY, "%s", buf);
|
syslog(SYSLOG_PRIORITY, "%s", p);
|
||||||
#else
|
#else
|
||||||
ReportEvent(hEventLog, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, &buf, NULL);
|
ReportEvent(hEventLog, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, &p, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dump BUF to stderr */
|
/* Dump BUF to stderr */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user