From: Harlan Stenn Date: Thu, 4 Aug 2011 22:43:46 +0000 (-0400) Subject: Merge psp-deb1.ntp.org:/home/stenn/ntp-stable X-Git-Tag: NTP_4_2_7P201~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7190aa418fb54cede61d42232227f947fc5d919a;p=thirdparty%2Fntp.git Merge psp-deb1.ntp.org:/home/stenn/ntp-stable into psp-deb1.ntp.org:/home/stenn/ntp-dev bk: 4e3b20a27FIAK3P242VGvd8D0EMQXg --- 7190aa418fb54cede61d42232227f947fc5d919a diff --cc sntp/main.c index ca6603495,9ddb5bfa8..2e408f506 --- a/sntp/main.c +++ b/sntp/main.c @@@ -122,63 -31,36 +122,63 @@@ int gettimeofday_cached(struct event_b /* * The actual main function. */ -int +int sntp_main ( - int argc, + int argc, char **argv - ) + ) { - register int c; - struct kod_entry *reason = NULL; - int optct; - /* boolean, u_int quiets gcc4 signed overflow warning */ - u_int sync_data_suc; - struct addrinfo **bcastaddr = NULL; - struct addrinfo **resh = NULL; - struct addrinfo *ai; - int resc; - int kodc; - int ow_ret; - int bcast = 0; - char *hostname; + int i; + int exitcode; + int optct; + struct event_config * evcfg; + + /* Initialize logging system - sets up progname */ + sntp_init_logging(argv[0]); - optct = optionProcess(&sntpOptions, argc, argv); + if (!libevent_version_ok()) + exit(EX_SOFTWARE); + + init_lib(); + + optct = ntpOptionProcess(&sntpOptions, argc, argv); argc -= optct; - argv += optct; + argv += optct; + + debug = DESC(DEBUG_LEVEL).optOccCt; + TRACE(1, ("%s\n", Version)); + + TRACE(2, ("init_lib() done, %s%s\n", + (ipv4_works) + ? "ipv4_works " + : "", + (ipv6_works) + ? "ipv6_works " + : "")); + ntpver = OPT_VALUE_NTPVERSION; + steplimit = OPT_VALUE_STEPLIMIT / 1e3; + gap.tv_usec = max(0, OPT_VALUE_GAP * 1000); + gap.tv_usec = min(gap.tv_usec, 999999); - if (HAVE_OPT(FILELOG)) - open_logfile(OPT_ARG(FILELOG)); - /* Initialize logging system */ - init_logging(); + if (HAVE_OPT(LOGFILE)) + open_logfile(OPT_ARG(LOGFILE)); - msyslog(LOG_NOTICE, "Started sntp"); + if (0 == argc && !HAVE_OPT(BROADCAST) && !HAVE_OPT(CONCURRENT)) { + printf("%s: Must supply at least one of -b hostname, -c hostname, or hostname.\n", + progname); + exit(EX_USAGE); + } + + + /* + ** Eventually, we probably want: + ** - separate bcst and ucst timeouts + ** - multiple --timeout values in the commandline + */ + bcst_timeout_tv.tv_sec = OPT_VALUE_BCTIMEOUT; + bcst_timeout_tv.tv_usec = 0; + + ucst_timeout = OPT_VALUE_UCTIMEOUT; /* IPv6 available? */ if (isc_net_probeipv6() != ISC_R_SUCCESS) {