version 1.2, 2004/07/27 16:19:41 |
version 1.3, 2004/08/05 13:32:08 |
|
|
#include <syslog.h> |
#include <syslog.h> |
|
|
#include "log.h" |
#include "log.h" |
|
#include "cvs.h" |
|
|
extern char *__progname; |
extern char *__progname; |
|
|
|
|
#ifdef unused |
#ifdef unused |
static char *cvs_log_levels[] = { |
static char *cvs_log_levels[] = { |
"debug", |
"debug", |
|
|
if (level == LP_ERRNO) |
if (level == LP_ERRNO) |
ecp = errno; |
ecp = errno; |
|
|
strlcpy(prefix, __progname, sizeof(prefix)); |
#ifdef CVS |
|
/* The cvs program appends the command name to the program name */ |
|
if (cvs_command != NULL) { |
|
snprintf(prefix, sizeof(prefix), "%s %s", __progname, |
|
cvs_command); |
|
} |
|
else /* just use the standard strlcpy */ |
|
#endif |
|
strlcpy(prefix, __progname, sizeof(prefix)); |
|
|
if (cvs_log_flags & LF_PID) { |
if (cvs_log_flags & LF_PID) { |
snprintf(buf, sizeof(buf), "[%d]", (int)getpid()); |
snprintf(buf, sizeof(buf), "[%d]", (int)getpid()); |
strlcat(prefix, buf, sizeof(prefix)); |
strlcat(prefix, buf, sizeof(prefix)); |
|
|
out = stdout; |
out = stdout; |
else |
else |
out = stderr; |
out = stderr; |
|
|
|
#ifdef CVS |
|
if (cvs_cmdop == CVS_OP_SERVER) { |
|
if (out == stdout) |
|
putc('M', out); |
|
else |
|
putc('E', out); |
|
putc(' ', out); |
|
} |
|
#endif |
|
|
fprintf(out, "%s: %s\n", prefix, buf); |
fprintf(out, "%s: %s\n", prefix, buf); |
} |
} |