aboutsummaryrefslogtreecommitdiff
path: root/src/log.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2009-04-21 16:04:01 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2009-04-21 16:09:41 +0300
commiteb0b1eef83ca77da145264c81631299ffc4cc574 (patch)
tree60d62365877e47a6d80e15ef4b42430171b34e62 /src/log.c
parentdbc2333c048514d0bbdade8a680c3933c7dc79a4 (diff)
downloadtagr-eb0b1eef83ca77da145264c81631299ffc4cc574.tar.gz
tagr-eb0b1eef83ca77da145264c81631299ffc4cc574.tar.bz2
Use "grecs" submodule for configuration parsing.
* Makefile.am (ACLOCAL_AMFLAGS): Add -I grecs/am. (SUBDIRS): grecs (ChangeLog): New rule. * ChangeLog: Rename to ChangeLog.svn * doc: Rename to etc. * etc/upgrade.awk: New file. * bootstrap.conf: Initialize "grecs". * configure.ac: Call GRECS_SETUP. (AC_CONFIG_FILES): Add grecs/Makefile and grecs/src/Makefile. * gnulib.modules: Add gitlog-to-changelog and sysexits. * src/Makefile.am (LDADD, INCLUDES): Add grecs. (AM_CPPFLAGS): Define additional variables. * src/log.c (use_stderr): Remove. Use log_to_stderr instead. (grecs_print_diag): New function. * src/main.c: Redo command-line support. (listen_sockaddr): New global. * src/readconfig.c: Rewrite. * src/tagr.h: Include sysexits.h and grecs.h (listen_sockaddr, log_to_stderr, pidfile): New externs. * src/main.c, src/stat.c, src/report.c: Use sysexits codes.
Diffstat (limited to 'src/log.c')
-rw-r--r--src/log.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/log.c b/src/log.c
index 950068c..7aa99d5 100644
--- a/src/log.c
+++ b/src/log.c
@@ -1,5 +1,5 @@
/* This file is part of tagr.
- Copyright (C) 2000, 2005, Max Bouglacoff, Sergey Poznyakoff
+ Copyright (C) 2000, 2005, 2009 Max Bouglacoff, Sergey Poznyakoff
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -32,7 +32,6 @@
#include <tagr.h>
char *progname;
-int use_stderr = 1;
void
init_syslog (char *name)
@@ -66,7 +65,7 @@ logmsg (int level, const char *fmt, ...)
va_list ap;
va_start (ap, fmt);
- if (use_stderr)
+ if (grecs_log_to_stderr)
{
fprintf (stderr, "%s: %s: ", progname, level_str[level]);
vfprintf (stderr, fmt, ap);
@@ -104,3 +103,27 @@ verbose (int level, const char *fmt, ...)
va_end (ap);
}
+
+
+void
+grecs_print_diag (grecs_locus_t *locus, int err, int errcode, const char *msg)
+{
+ if (locus)
+ {
+ if (errcode)
+ logmsg (err ? L_ERR : L_WARNING, "%s:%lu: %s: %s",
+ locus->file, (unsigned long)locus->line, msg,
+ strerror (errcode));
+ else
+ logmsg (err ? L_ERR : L_WARNING, "%s:%lu: %s",
+ locus->file, (unsigned long)locus->line, msg);
+ }
+ else
+ {
+ if (errcode)
+ logmsg (err ? L_ERR : L_WARNING, "%s: %s", msg,
+ strerror (errcode));
+ else
+ logmsg (err ? L_ERR : L_WARNING, "%s", msg);
+ }
+}

Return to:

Send suggestions and report system problems to the System administrator.