]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Merge psp-deb1.ntp.org:/home/stenn/ntp-stable
authorHarlan Stenn <stenn@ntp.org>
Thu, 4 Aug 2011 22:43:46 +0000 (18:43 -0400)
committerHarlan Stenn <stenn@ntp.org>
Thu, 4 Aug 2011 22:43:46 +0000 (18:43 -0400)
into  psp-deb1.ntp.org:/home/stenn/ntp-dev

bk: 4e3b20a27FIAK3P242VGvd8D0EMQXg

1  2 
sntp/main.c
sntp/sntp-opts.def

diff --cc sntp/main.c
index ca66034953ae8a11702d93b86b0cd98ef5421437,9ddb5bfa8f129e1ff944d616588d85196b61c724..2e408f506a50a9a2366990b1c4087516a810dfd6
@@@ -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) {
Simple merge