--- gvpe/src/gvpe.C 2008/11/21 05:02:08 1.15 +++ gvpe/src/gvpe.C 2011/10/12 22:51:10 1.21 @@ -2,7 +2,7 @@ gvpe.C -- the main file for gvpe Copyright (C) 1998-2002 Ivo Timmermans 2000-2002 Guus Sliepen - 2003-2008 Marc Lehmann + 2003-2011 Marc Lehmann This file is part of GVPE. @@ -77,15 +77,15 @@ static int do_detach = 1; static struct option const long_options[] = - { - {"config", required_argument, NULL, 'c'}, - {"help", no_argument, &show_help, 1}, - {"version", no_argument, &show_version, 1}, - {"no-detach", no_argument, &do_detach, 0}, - {"log-level", required_argument, NULL, 'l'}, - {"mlock", no_argument, &do_mlock, 1}, - {NULL, 0, NULL, 0} - }; +{ + {"config", required_argument, NULL, 'c'}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, + {"no-detach", no_argument, &do_detach, 0}, + {"log-level", required_argument, NULL, 'l'}, + {"mlock", no_argument, &do_mlock, 1}, + {NULL, 0, NULL, 0} +}; static void usage (int status) @@ -99,7 +99,7 @@ (" -c, --config=DIR Read configuration options from DIR.\n" " -D, --no-detach Don't fork and detach.\n" " -l, --log-level=LEVEL Set logging level (info, notice, warn are common).\n" - " -L, --mlock Lock tinc into main memory.\n" + " -L, --mlock Lock gvpe into main memory.\n" " --help Display this help and exit.\n" " --version Output version information and exit.\n\n")); printf (_("Report bugs to .\n")); @@ -108,7 +108,7 @@ exit (status); } -void +static void parse_options (int argc, char **argv, char **envp) { int r; @@ -151,10 +151,9 @@ } } -/* - Close network connections, and terminate neatly -*/ -void cleanup_and_exit(int c) +// close network connections, and terminate neatly +static void +cleanup_and_exit (int c) { network.shutdown_all (); @@ -166,35 +165,33 @@ exit (c); } -/* - Signal handlers. -*/ -RETSIGTYPE +// signal handlers +static RETSIGTYPE sigterm_handler (int a) { network.events |= vpn::EVENT_SHUTDOWN; network.event.start (); } -RETSIGTYPE +static RETSIGTYPE sighup_handler (int a) { network.events |= vpn::EVENT_RECONNECT; network.event.start (); } -RETSIGTYPE +static RETSIGTYPE sigusr1_handler (int a) { network.dump_status (); } -RETSIGTYPE +static RETSIGTYPE sigusr2_handler (int a) { } -void +static void setup_signals (void) { struct sigaction act; @@ -237,7 +234,7 @@ printf (_ ("Copyright (C) 2003-2008 Marc Lehmann and others.\n" "See the AUTHORS file for a complete list.\n\n" - "tinc comes with ABSOLUTELY NO WARRANTY. This is free software,\n" + "GVPE comes with ABSOLUTELY NO WARRANTY. This is free software,\n" "and you are welcome to redistribute it under certain conditions;\n" "see the file COPYING for details.\n")); @@ -291,11 +288,11 @@ if (!network.setup ()) { - ev_loop (EV_DEFAULT_ 0); + ev_run (EV_DEFAULT_ 0); cleanup_and_exit (EXIT_FAILURE); } - slog (L_ERR, _("unable to setup network, unrecoverable error, exiting.")); + slog (L_ERR, _("unrecoverable error while setting up network, exiting.")); cleanup_and_exit (EXIT_FAILURE); }