diff options
-rw-r--r-- | configure.ac | 11 | ||||
-rw-r--r-- | doc/LinuxDocTools.pm | 1 | ||||
-rw-r--r-- | doc/bird.sgml | 10 | ||||
-rwxr-xr-x | doc/sgml2html | 3 | ||||
-rwxr-xr-x | doc/sgml2latex | 3 | ||||
-rwxr-xr-x | doc/sgml2txt | 3 | ||||
-rw-r--r-- | sysdep/unix/log.c | 38 | ||||
-rw-r--r-- | sysdep/unix/main.c | 19 | ||||
-rw-r--r-- | sysdep/unix/unix.h | 2 |
9 files changed, 44 insertions, 46 deletions
diff --git a/configure.ac b/configure.ac index 7abf88c8..ae2710f5 100644 --- a/configure.ac +++ b/configure.ac @@ -85,15 +85,10 @@ AC_SUBST([srcdir]) AS_IF([test -z "${runstatedir}"], [runstatedir='${localstatedir}/run']) AC_SUBST([runstatedir]) - -if test "$enable_debug" = yes ; then - CONFIG_FILE="bird.conf" - CONTROL_SOCKET="bird.ctl" -else - CONFIG_FILE="\$(sysconfdir)/bird.conf" - CONTROL_SOCKET="\$(runstatedir)/bird.ctl" -fi +CONFIG_FILE="\$(sysconfdir)/bird.conf" AC_SUBST([CONFIG_FILE]) + +CONTROL_SOCKET="\$(runstatedir)/bird.ctl" AC_SUBST([CONTROL_SOCKET]) AC_SEARCH_LIBS([clock_gettime], [rt posix4], diff --git a/doc/LinuxDocTools.pm b/doc/LinuxDocTools.pm index 39bb401d..d73fc759 100644 --- a/doc/LinuxDocTools.pm +++ b/doc/LinuxDocTools.pm @@ -242,6 +242,7 @@ sub process_options # removes iso-entites sub directory after doing make install.) # $ENV{SGML_CATALOG_FILES} .= (defined $ENV{SGML_CATALOG_FILES} ? ":" : "") . + "$main::prefix/share/sgml/sgml-iso-entities-8879.1986/catalog:"; "$main::prefix/share/sgml/entities/sgml-iso-entities-8879.1986/catalog"; $ENV{SGML_CATALOG_FILES} .= ":$main::DataDir/linuxdoc-tools.catalog"; $ENV{SGML_CATALOG_FILES} .= ":$main::/etc/sgml.catalog"; diff --git a/doc/bird.sgml b/doc/bird.sgml index da87d901..60c38fa4 100644 --- a/doc/bird.sgml +++ b/doc/bird.sgml @@ -149,10 +149,10 @@ BIRD executable by configuring out routing protocols you don't use, and use given configuration file instead of <it/prefix/<file>/etc/bird.conf</file>. <tag><label id="argv-debug">-d</tag> - enable debug messages and run bird in foreground. + enable debug messages to stderr, and run bird in foreground. - <tag><label id="argv-log-file">-D <m/filename of debug log/</tag> - log debugging information to given file instead of stderr. + <tag><label id="argv-debug-file">-D <m/filename of debug log/</tag> + enable debug messages to given file. <tag><label id="argv-foreground">-f</tag> run bird in foreground. @@ -483,7 +483,9 @@ include "tablename.conf";; <cf/auth/ about authentication failures, <cf/bug/ for internal BIRD bugs. You may specify more than one <cf/log/ line to establish logging to - multiple destinations. Default: log everything to the system log. + multiple destinations. Default: log everything to the system log, or + to the debug output if debugging is enabled by <cf/-d//<cf/-D/ + command-line option. <tag><label id="opt-debug-protocols">debug protocols all|off|{ states|routes|filters|interfaces|events|packets [, <m/.../] }</tag> Set global defaults of protocol debugging options. See <cf/debug/ in the diff --git a/doc/sgml2html b/doc/sgml2html index a5bbee9e..6072a7a3 100755 --- a/doc/sgml2html +++ b/doc/sgml2html @@ -34,7 +34,8 @@ $progs = { "GROFFMACRO" => "-ms", "AWK" => "/usr/share/linuxdoc-tools/awkwhich" }; -$ENV{"SGML_CATALOG_FILES"} = "$DataDir/dtd/catalog"; +$ENV{"SGML_CATALOG_FILES"} = "$DataDir/dtd/catalog" . + (defined $ENV{SGML_CATALOG_FILES} ? ":$ENV{SGML_CATALOG_FILES}" : ""); require "$FindBin::Bin/LinuxDocTools.pm"; &LinuxDocTools::init; diff --git a/doc/sgml2latex b/doc/sgml2latex index 02b60d94..c48f787d 100755 --- a/doc/sgml2latex +++ b/doc/sgml2latex @@ -34,7 +34,8 @@ $progs = { "GROFFMACRO" => "-ms", "AWK" => "/usr/share/linuxdoc-tools/awkwhich" }; -$ENV{"SGML_CATALOG_FILES"} = "$DataDir/dtd/catalog"; +$ENV{"SGML_CATALOG_FILES"} = "$DataDir/dtd/catalog" . + (defined $ENV{SGML_CATALOG_FILES} ? ":$ENV{SGML_CATALOG_FILES}" : ""); require "$FindBin::Bin/LinuxDocTools.pm"; &LinuxDocTools::init; diff --git a/doc/sgml2txt b/doc/sgml2txt index dfc017de..af0bcb49 100755 --- a/doc/sgml2txt +++ b/doc/sgml2txt @@ -34,7 +34,8 @@ $progs = { "GROFFMACRO" => "-ms", "AWK" => "/usr/share/linuxdoc-tools/awkwhich" }; -$ENV{"SGML_CATALOG_FILES"} = "$DataDir/dtd/catalog"; +$ENV{"SGML_CATALOG_FILES"} = "$DataDir/dtd/catalog" . + (defined $ENV{SGML_CATALOG_FILES} ? ":$ENV{SGML_CATALOG_FILES}" : ""); require "$FindBin::Bin/LinuxDocTools.pm"; &LinuxDocTools::init; diff --git a/sysdep/unix/log.c b/sysdep/unix/log.c index 9a0fa550..c9064834 100644 --- a/sysdep/unix/log.c +++ b/sysdep/unix/log.c @@ -170,7 +170,8 @@ log_commit(int class, buffer *buf) else { byte tbuf[TM_DATETIME_BUFFER_SIZE]; - if (!tm_format_real_time(tbuf, sizeof(tbuf), config->tf_log.fmt1, current_real_time())) + const char *fmt = config ? config->tf_log.fmt1 : "%F %T.%3f"; + if (!tm_format_real_time(tbuf, sizeof(tbuf), fmt, current_real_time())) strcpy(tbuf, "<error>"); if (l->limit) @@ -322,36 +323,45 @@ debug(const char *msg, ...) } static list * -default_log_list(int debug, int init, char **syslog_name) +default_log_list(int initial, char **syslog_name) { - static list init_log_list; - init_list(&init_log_list); + static list log_list; + init_list(&log_list); *syslog_name = NULL; #ifdef HAVE_SYSLOG_H - if (!debug) + if (!dbgf) { static struct log_config lc_syslog = { .mask = ~0 }; - add_tail(&init_log_list, &lc_syslog.n); + add_tail(&log_list, &lc_syslog.n); *syslog_name = bird_name; - if (!init) - return &init_log_list; } #endif - static struct log_config lc_stderr = { .mask = ~0, .terminal_flag = 1 }; - lc_stderr.fh = stderr; - add_tail(&init_log_list, &lc_stderr.n); - return &init_log_list; + if (dbgf && (dbgf != stderr)) + { + static struct log_config lc_debug = { .mask = ~0 }; + lc_debug.fh = dbgf; + add_tail(&log_list, &lc_debug.n); + } + + if (initial || (dbgf == stderr)) + { + static struct log_config lc_stderr = { .mask = ~0, .terminal_flag = 1}; + lc_stderr.fh = stderr; + add_tail(&log_list, &lc_stderr.n); + } + + return &log_list; } void -log_switch(int debug, list *logs, char *new_syslog_name) +log_switch(int initial, list *logs, char *new_syslog_name) { struct log_config *l; if (!logs || EMPTY_LIST(*logs)) - logs = default_log_list(debug, !logs, &new_syslog_name); + logs = default_log_list(initial, &new_syslog_name); /* Close the logs to avoid pinning them on disk when deleted */ if (current_log_list) diff --git a/sysdep/unix/main.c b/sysdep/unix/main.c index d2380501..c31ccd17 100644 --- a/sysdep/unix/main.c +++ b/sysdep/unix/main.c @@ -44,12 +44,6 @@ * Debugging */ -#ifdef DEBUGGING -static int debug_flag = 1; -#else -static int debug_flag = 0; -#endif - void async_dump(void) { @@ -185,7 +179,7 @@ sysdep_preconfig(struct config *c) int sysdep_commit(struct config *new, struct config *old UNUSED) { - log_switch(debug_flag, &new->logfiles, new->syslog_name); + log_switch(0, &new->logfiles, new->syslog_name); return 0; } @@ -750,21 +744,16 @@ parse_args(int argc, char **argv) while ((c = getopt(argc, argv, opt_list)) >= 0) switch (c) { - case 'b': - run_in_foreground = 0; - break; case 'c': config_name = optarg; config_changed = 1; break; case 'd': - debug_flag |= 1; + log_init_debug(""); run_in_foreground = 1; break; case 'D': log_init_debug(optarg); - debug_flag |= 2; - run_in_foreground = 1; break; case 'p': parse_and_exit = 1; @@ -822,9 +811,7 @@ main(int argc, char **argv) #endif parse_args(argc, argv); - if (debug_flag == 1) - log_init_debug(""); - log_switch(debug_flag, NULL, NULL); + log_switch(1, NULL, NULL); net_init(); resource_init(); diff --git a/sysdep/unix/unix.h b/sysdep/unix/unix.h index 12306167..0e1e98c0 100644 --- a/sysdep/unix/unix.h +++ b/sysdep/unix/unix.h @@ -116,7 +116,7 @@ void krt_io_init(void); void main_thread_init(void); void log_init_debug(char *); /* Initialize debug dump to given file (NULL=stderr, ""=off) */ -void log_switch(int debug, list *l, char *); /* Use l=NULL for initial switch */ +void log_switch(int initial, list *l, char *); struct log_config { node n; |