Re: Kannel 1.5.0 compilation
Alexander Malysh <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
CODE is defined in syslog.h. Does Solaris don't have syslog.h?
Please try attached patch.
Thanks,
Alex
Am 22.07.2011 um 21:29 schrieb Nikos Balkanas:
> Hi,
>
> I am getting this trying to build latest kannel svn in Solaris:
>
> gwlib/log.c:155: error: syntax error before "CODE"
>
> gwlib/log.c:155:
>
> /*
> * Decode the syslog name to its int value
> */
> static int decode(char *name, CODE *facilities)
> {
> register CODE *c;
>
>
> Where is this CODE defined? Couldn't find it anywhere in kannel sources and is not a C primitive type. Is it a Linux thingie?
>
> BR,
> Nikos
>
syslog.diff
(application/octet-stream, 1.7 KB)
diff --git a/gwlib/log.c b/gwlib/log.c
index a327116..a731dfa 100644
--- a/gwlib/log.c
+++ b/gwlib/log.c
@@ -75,6 +75,26 @@
#if HAVE_SYSLOG_H
#define SYSLOG_NAMES
#include <syslog.h>
+
+/*
+ * Decode the syslog name to its int value
+ */
+static int decode(char *name)
+{
+ register CODE *c;
+ CODE *facilities = facilitynames;
+
+ if (isdigit(*name)) {
+ return (atoi(name));
+ }
+ for (c = facilities; c->c_name; c++) {
+ if (!strcasecmp(name, c->c_name)) {
+ return (c->c_val);
+ }
+ }
+ return LOG_DAEMON;
+}
+
#else
/*
@@ -86,11 +106,16 @@ enum {
LOG_PID, LOG_DAEMON, LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERR, LOG_ALERT
};
+static int decode(char *name)
+{
+ return LOG_DAEMON;
+}
+
static void openlog(const char *ident, int option, int facility)
{
}
-static void syslog(int translog, const char *buf)
+static void syslog(int translog, const char *msg, ...)
{
}
@@ -150,24 +175,6 @@ static int syslogfacility = LOG_DAEMON;
static int dosyslog = 0;
/*
- * Decode the syslog name to its int value
- */
-static int decode(char *name, CODE *facilities)
-{
- register CODE *c;
-
- if (isdigit(*name)) {
- return (atoi(name));
- }
- for (c = facilities; c->c_name; c++) {
- if (!strcasecmp(name, c->c_name)) {
- return (c->c_val);
- }
- }
- return LOG_DAEMON;
-}
-
-/*
* Make sure stderr is included in the list.
*/
static void add_stderr(void)
@@ -235,7 +242,7 @@ void log_set_log_level(enum output_level level)
void log_set_syslog_facility(char *facility)
{
if (facility != NULL)
- syslogfacility = decode(facility, facilitynames);
+ syslogfacility = decode(facility);
}
void log_set_syslog(const char *ident, int syslog_level)