From: Dave Burke (daveb at domain esat.net)
Date: Mon 08 Apr 2002 - 10:34:25 IST
Morn,
Just a simple C question...how do I syslog from C ?
I've tried something simple like......
#include <syslog.h>
openlog("Testing", LOG_CONS | LOG_NDELAY, LOG_LOCAL3);
syslog(LOG_INFO, "Testing from C program");
closelog();
Which, according to my reading of the syslog man page, looks ok. But when I
try and complile it (gcc -Wall syslog.c -o syslog), I'm getting....
syslog.c:3: parse error before string constant
syslog.c:4: parse error before `6'
syslog.c:4: warning: type defaults to `int' in declaration of `syslog'
syslog.c:4: conflicting types for `syslog'
/usr/include/sys/syslog.h:183: previous declaration of `syslog'
syslog.c:4: warning: data definition has no type or storage class
syslog.c:5: warning: type defaults to `int' in declaration of `closelog'
syslog.c:5: conflicting types for `closelog'
/usr/include/sys/syslog.h:172: previous declaration of `closelog'
syslog.c:5: warning: data definition has no type or storage class
Anyone any ideas?
Dave
PS This is soooo much easier with perl ;)
This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:15:53 GMT