/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1985-2012 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* syslog implementation
*/
#include <ast.h>
#if _lib_syslog
#else
#define LOG_TABLES
#include "sysloglib.h"
#include <error.h>
#include <tm.h>
{
#if _UWIN
#endif
};
const Namval_t log_facility[] =
{
"default", 0,
"user", LOG_USER,
"kernel", LOG_KERN,
"mail", LOG_MAIL,
"daemon", LOG_DAEMON,
"security", LOG_AUTH,
"syslog", LOG_SYSLOG,
"lpr", LOG_LPR,
"news", LOG_NEWS,
"uucp", LOG_UUCP,
"cron", LOG_CRON,
"audit", LOG_AUDIT,
"logalert", LOG_LFMT,
#ifdef LOG_SYSTEM2
"system2", LOG_SYSTEM2,
#endif
#ifdef LOG_SYSTEM1
"system1", LOG_SYSTEM1,
#endif
#ifdef LOG_SYSTEM0
"system0", LOG_SYSTEM0,
#endif
0, 0
};
const Namval_t log_severity[] =
{
"panic", LOG_EMERG,
"alert", LOG_ALERT,
"critical", LOG_CRIT,
"error", LOG_ERR,
"warning", LOG_WARNING,
"notice", LOG_NOTICE,
"info", LOG_INFO,
"debug", LOG_DEBUG,
0, 0
};
#if _UWIN
/*
*/
#include <ctype.h>
#include <ls.h>
#include <netdb.h>
#if !defined(htons) && !_lib_htons
# define htons(x) (x)
#endif
#if !defined(htonl) && !_lib_htonl
# define htonl(x) (x)
#endif
#ifndef INADDR_LOOPBACK
#define INADDR_LOOPBACK 0x7f000001L
#endif
/*
* convert s to sockaddr_in
* -1 returned on error
*/
static int
{
register int c;
register int v;
register int n = 0;
unsigned long a = 0;
unsigned short p = 0;
{
a = INADDR_LOOPBACK;
n = 4;
s += 6;
}
else if (!isdigit(*s))
{
char* e = strchr(s, '/');
if (!(e = strchr(s, '/')))
return -1;
*e = 0;
hp = gethostbyname(s);
*e = '/';
return -1;
n = 6;
s = e + 1;
}
for (;;)
{
v = 0;
while ((c = *s++) >= '0' && c <= '9')
v = v * 10 + c - '0';
if (++n <= 4)
a = (a << 8) | (v & 0xff);
else
{
if (n <= 5)
a = htonl(a);
if (c)
{
return -1;
}
else
p = htons(v);
break;
}
if (c != '.' && c != '/')
return -1;
}
return 0;
}
/*
* call this after open fails to see if path is a socket
*/
int
{
int fd;
struct sockaddr_in addr;
{
return -1;
}
#if LOCAL
{
int ul;
struct sockaddr_un ua;
{
return -1;
return fd;
return -1;
}
}
#endif
return -1;
buf[8] = 0;
return -1;
return -1;
{
return -1;
}
return fd;
}
#else
int
{
return -1;
}
#endif
void
{
register char* s;
register Namval_t* p;
register int n;
for (;;)
{
{
break;
continue;
continue;
continue;
#if !O_cloexec
#endif
}
break;
}
}
static int
{
{
}
return 0;
}
void
{
register int c;
register char* s;
char buf[16];
if (!LOG_FACILITY(priority))
return;
{
{
s = (char*)log_severity[c].name;
else
s = (char*)log_facility[c].name;
else
}
#if _lib_gethostname
#endif
if (*log.ident)
{
if (!*log.ident)
}
if (format)
{
}
sendlog(s);
sfstrclose(sp);
}
}
void
{
}
#endif