]> git.ipfire.org Git - thirdparty/bird.git/blobdiff - sysdep/unix/main.c
Unix: Remove removed option from help
[thirdparty/bird.git] / sysdep / unix / main.c
index c1b92b7eb64130962d287571b647fff1317f16d9..921115b1a9cff12568e6ebe7a3bd0f7548fb27ff 100644 (file)
@@ -27,6 +27,7 @@
 #include "lib/resource.h"
 #include "lib/socket.h"
 #include "lib/event.h"
+#include "lib/timer.h"
 #include "lib/string.h"
 #include "nest/route.h"
 #include "nest/protocol.h"
  *     Debugging
  */
 
-#ifdef DEBUGGING
-static int debug_flag = 1;
-#else
-static int debug_flag = 0;
-#endif
-
 void
 async_dump(void)
 {
@@ -56,7 +51,7 @@ async_dump(void)
 
   rdump(&root_pool);
   sk_dump_all();
-  tm_dump_all();
+  // XXXX tm_dump_all();
   if_dump_all();
   neigh_dump_all();
   rta_dump_all();
@@ -131,7 +126,7 @@ read_iproute_table(char *file, char *prefix, int max)
 
     if (*p == '#' || *p == '\n' || *p == 0)
       continue;
-   
+
     if (sscanf(p, "0x%x %s\n", &val, name) != 2 &&
        sscanf(p, "0x%x %s #", &val, name) != 2 &&
        sscanf(p, "%d %s\n", &val, name) != 2 &&
@@ -184,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;
 }
 
@@ -212,7 +207,7 @@ read_config(void)
   if (!unix_read_config(&conf, config_name))
     {
       if (conf->err_msg)
-       die("%s, line %d: %s", conf->err_file_name, conf->err_lino, conf->err_msg);
+       die("%s:%d:%d %s", conf->err_file_name, conf->err_lino, conf->err_chno, conf->err_msg);
       else
        die("Unable to open configuration file %s: %m", config_name);
     }
@@ -229,7 +224,7 @@ async_config(void)
   if (!unix_read_config(&conf, config_name))
     {
       if (conf->err_msg)
-       log(L_ERR "%s, line %d: %s", conf->err_file_name, conf->err_lino, conf->err_msg);
+       log(L_ERR "%s:%d:%d %s", conf->err_file_name, conf->err_lino, conf->err_chno, conf->err_msg);
       else
        log(L_ERR "Unable to open configuration file %s: %m", config_name);
       config_free(conf);
@@ -250,7 +245,7 @@ cmd_read_config(char *name)
   if (!unix_read_config(&conf, name))
     {
       if (conf->err_msg)
-       cli_msg(8002, "%s, line %d: %s", conf->err_file_name, conf->err_lino, conf->err_msg);
+       cli_msg(8002, "%s:%d:%d %s", conf->err_file_name, conf->err_lino, conf->err_chno, conf->err_msg);
       else
        cli_msg(8002, "%s: %m", name);
       config_free(conf);
@@ -302,7 +297,7 @@ cmd_reconfig_undo_notify(void)
 }
 
 void
-cmd_reconfig(char *name, int type, int timeout)
+cmd_reconfig(char *name, int type, uint timeout)
 {
   if (cli_access_restricted())
     return;
@@ -521,7 +516,7 @@ write_pid_file(void)
   rv = ftruncate(pid_fd, 0);
   if (rv < 0)
     die("fruncate: %m");
-    
+
   rv = write(pid_fd, ps, pl);
   if(rv < 0)
     die("write: %m");
@@ -623,7 +618,7 @@ signal_init(void)
  *     Parsing of command-line arguments
  */
 
-static char *opt_list = "c:dD:ps:P:u:g:flRh";
+static char *opt_list = "bc:dD:ps:P:u:g:flRh";
 static int parse_and_exit;
 char *bird_name;
 static char *use_user;
@@ -644,15 +639,15 @@ display_help(void)
   fprintf(stderr,
     "\n"
     "Options: \n"
-    "  -c <config-file>     Use given configuration file instead\n"
-    "                       of prefix/etc/bird.conf\n"
+    "  -c <config-file>     Use given configuration file instead of\n"
+    "                       "  PATH_CONFIG_FILE "\n"
     "  -d                   Enable debug messages and run bird in foreground\n"
     "  -D <debug-file>      Log debug messages to given file instead of stderr\n"
     "  -f                   Run bird in foreground\n"
     "  -g <group>           Use given group ID\n"
     "  -h, --help           Display this information\n"
-    "  -l                   Look for a configuration file and a communication socket\n"
-    "                       file in the current working directory\n"
+    "  -l                   Look for a configuration file and a control socket\n"
+    "                       in the current working directory\n"
     "  -p                   Test configuration file and exit without start\n"
     "  -P <pid-file>        Create a PID file with given filename\n"
     "  -R                   Apply graceful restart recovery after start\n"
@@ -753,11 +748,11 @@ parse_args(int argc, char **argv)
        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;
        break;
       case 'p':
        parse_and_exit = 1;
@@ -815,11 +810,11 @@ 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();
+  timer_init();
   olock_init();
   io_init();
   rt_init();
@@ -854,7 +849,7 @@ main(int argc, char **argv)
   if (parse_and_exit)
     exit(0);
 
-  if (!(debug_flag||run_in_foreground))
+  if (!run_in_foreground)
     {
       pid_t pid = fork();
       if (pid < 0)