]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Merge bk://www.ntp.org/home/bk/ntp-dev
authorFrank Kardel <kardel@ntp.org>
Tue, 6 Jun 2006 06:41:29 +0000 (06:41 +0000)
committerFrank Kardel <kardel@ntp.org>
Tue, 6 Jun 2006 06:41:29 +0000 (06:41 +0000)
into  pogo.udel.edu:/pogo/users/kardel/dynamic-if/ntp-dev

bk: 44852399UMSBYF7rvmvt4i4d_bezug

1  2 
configure.ac
include/ntpd.h
ntpd/cmd_args.c
ntpd/ntp_config.c
ntpd/ntp_control.c
ntpd/ntp_util.c
ntpd/ntpd.c
ntpdc/ntpdc.c

diff --cc configure.ac
Simple merge
diff --cc include/ntpd.h
Simple merge
diff --cc ntpd/cmd_args.c
index 0c30f32dda7f8c0339576187ad340e834a95b9d8,e395a4d95f87394dda647682e77ad7a9176bf6e3..c93cd9d7695f20f84aaf3f48e1519206e0eab5e9
   * Definitions of things either imported from or exported to outside
   */
  extern char const *progname;
 +extern const char *specific_interface;
  extern int default_ai_family;
 -int   listen_to_virtual_ips = 1;
 -char  *specific_interface = NULL;        /* interface name or IP address to bind to */
 -
 -static const char *ntp_options = "46aAbB:c:C:dD:f:gHi:k:l:L:nNO:p:P:qr:s:S:t:T:W:U:u:v:V:xY:Z:-:";
  
  #ifdef HAVE_NETINFO
  extern int    check_netinfo;
  #endif
@@@ -240,132 -272,165 +239,145 @@@ getCmdOpts
  #else
                        errflg++;
  #endif
 -                  case 'k':
 -                      getauthkeys(ntp_optarg);
 -                      break;
 +      }
  
 -                  case 'L':   /* already done at pre-scan */
 -                  case 'l':   /* already done at pre-scan */
 -                      break;
 +      if (HAVE_OPT( KEYFILE ))
 +              getauthkeys(OPT_ARG( KEYFILE ));
  
 -                  case 'n':   /* already done at pre-scan */
 -                      break;
 +      if (HAVE_OPT( PIDFILE ))
 +              stats_config(STATS_PID_FILE, OPT_ARG( PIDFILE ));
  
 -                  case 'N':   /* already done at pre-scan */
 -                      break;
 +      if (HAVE_OPT( QUIT ))
 +              mode_ntpdate = TRUE;
  
 -                  case 'p':
 -                      stats_config(STATS_PID_FILE, ntp_optarg);
 -                      break;
 +      if (HAVE_OPT( PROPAGATIONDELAY ))
 +              do {
 +                      double tmp;
 +                      const char *my_ntp_optarg = OPT_ARG( PROPAGATIONDELAY );
  
 -                  case 'P':
 -#if defined(HAVE_SCHED_SETSCHEDULER)
 -                      config_priority = (int)atol(ntp_optarg);
 -                      config_priority_override = 1;
 -#else
 -                      errflg++;
 -#endif
 -                      break;
 +                      if (sscanf(my_ntp_optarg, "%lf", &tmp) != 1) {
 +                              msyslog(LOG_ERR,
 +                                      "command line broadcast delay value %s undecodable",
 +                                      my_ntp_optarg);
 +                      } else {
 +                              proto_config(PROTO_BROADDELAY, 0, tmp, NULL);
 +                      }
 +              } while (0);
  
 -                  case 'q':
 -                      mode_ntpdate = TRUE;
 -                      break;
 +      if (HAVE_OPT( STATSDIR ))
 +              stats_config(STATS_STATSDIR, OPT_ARG( STATSDIR ));
  
 -                  case 'r':
 -                      do {
 -                              double tmp;
 +      if (HAVE_OPT( TRUSTEDKEY )) {
 +              int           ct = STACKCT_OPT(  TRUSTEDKEY );
 +              const char**  pp = STACKLST_OPT( TRUSTEDKEY );
  
 -                              if (sscanf(ntp_optarg, "%lf", &tmp) != 1) {
 -                                      msyslog(LOG_ERR,
 -                                              "command line broadcast delay value %s undecodable",
 -                                              ntp_optarg);
 -                              } else {
 -                                      proto_config(PROTO_BROADDELAY, 0, tmp, NULL);
 -                              }
 -                      } while (0);
 -                      break;
 -                      
 -                  case 'u':
 -#ifdef HAVE_DROPROOT
 -                      droproot = 1;
 -                      if( ! ntp_optarg ) {
 -                              errflg++;
 +              do  {
 +                      u_long tkey;
 +                      const char* p = *pp++;
 +
 +                      tkey = (int)atol(p);
 +                      if (tkey <= 0 || tkey > NTP_MAXKEY) {
 +                              msyslog(LOG_ERR,
 +                                  "command line trusted key %s is invalid",
 +                                  p);
                        } else {
 -                              user = malloc(strlen(ntp_optarg) + 1);
 -                              if (user == NULL) {
 -                                      errflg++;
 -                              } else {
 -                                      (void)strncpy(user, ntp_optarg, strlen(ntp_optarg) + 1);
 -                                      group = rindex(user, ':');
 -                                      if (group)
 -                                              *group++ = '\0'; /* get rid of the ':' */
 -                              }
 +                              authtrust(tkey, 1);
                        }
 -#else
 +              } while (--ct > 0);
 +      }
 +
 +      if (HAVE_OPT( USER )) {
 +#ifdef HAVE_DROPROOT
 +              char *ntp_optarg = OPT_ARG( USER );
 +
 +              droproot = 1;
 +              user = malloc(strlen(ntp_optarg) + 1);
 +              if (user == NULL) {
                        errflg++;
 +              } else {
 +                      (void)strncpy(user, ntp_optarg, strlen(ntp_optarg) + 1);
 +                      group = rindex(user, ':');
 +                      if (group)
 +                              *group++ = '\0'; /* get rid of the ':' */
 +              }
 +#else
 +              errflg++;
  #endif
 -                      break;
 -                  case 's':
 -                      stats_config(STATS_STATSDIR, ntp_optarg);
 -                      break;
 -                      
 -                  case 't':
 -                      do {
 -                              u_long tkey;
 -                              
 -                              tkey = (int)atol(ntp_optarg);
 -                              if (tkey <= 0 || tkey > NTP_MAXKEY) {
 -                                      msyslog(LOG_ERR,
 -                                          "command line trusted key %s is invalid",
 -                                          ntp_optarg);
 -                              } else {
 -                                      authtrust(tkey, 1);
 -                              }
 -                      } while (0);
 -                      break;
 +      }
  
 -                  case 'U':
 -                    do 
 -                      {
 -                        long val;
 -                        extern int interface_interval;
 -                        
 -                        if ((1 == sscanf(ntp_optarg, "%ld", &val)) && ((val >= 60) || (val == 0)))
 -                          interface_interval = val;
 -                        else 
 -                          {
 -                            msyslog(LOG_ERR,
 -                                    "command line interface update interval %s must be 0 or longer than 60 seconds",
 -                                    ntp_optarg);
 -                            errflg++;
 -                          }
 -                      }
 -                    while(0);
 -                    break;
 +      if (HAVE_OPT( VAR )) {
 +              int           ct = STACKCT_OPT(  VAR );
 +              const char**  pp = STACKLST_OPT( VAR );
  
 -                  case 'v':
 -                  case 'V':
 -                      set_sys_var(ntp_optarg, strlen(ntp_optarg)+1,
 -                          (u_short) (RW | ((c == 'V') ? DEF : 0)));
 -                      break;
 +              do  {
 +                      const char* my_ntp_optarg = *pp++;
  
 -                  case 'x':
 -                      clock_max = 600;
 -                      break;
 +                      set_sys_var(my_ntp_optarg, strlen(my_ntp_optarg)+1,
 +                          (u_short) (RW));
 +              } while (--ct > 0);
 +      }
 +
 +      if (HAVE_OPT( DVAR )) {
 +              int           ct = STACKCT_OPT(  DVAR );
 +              const char**  pp = STACKLST_OPT( DVAR );
 +
 +              do  {
 +                      const char* my_ntp_optarg = *pp++;
 +
 +                      set_sys_var(my_ntp_optarg, strlen(my_ntp_optarg)+1,
 +                          (u_short) (RW | DEF));
 +              } while (--ct > 0);
 +      }
 +
 +      if (HAVE_OPT( SLEW ))
 +              clock_max = 600;
 +
++      if (HAVE_OPT( UPDATEINTERVAL ) {
++              long val;
++              extern int interface_interval;
++                        
++              if ((1 == sscanf(OPT_ARG( UPDATEINTERVAL ), "%ld", &val)) && ((val >= 60) || (val == 0)))
++                      interface_interval = val;
++              else {
++                      msyslog(LOG_ERR,
++                              "command line interface update interval %s must be 0 or longer than 60 seconds",
++                                    ntp_optarg);
++                      errflg++;
++              }
++      }
  #ifdef SIM
 -              case 'B':
 -                      sscanf(ntp_optarg, "%lf", &ntp_node.bdly);
 -                        break;
 +      if (HAVE_OPT( SIMBROADCASTDELAY ))
 +              sscanf(OPT_ARG( SIMBROADCASTDELAY ), "%lf", &ntp_node.bdly);
  
 -              case 'C':
 -                      sscanf(ntp_optarg, "%lf", &ntp_node.snse);
 -                        break;
 +      if (HAVE_OPT( PHASENOISE ))
 +              sscanf(OPT_ARG( PHASENOISE ), "%lf", &ntp_node.snse);
  
 -              case 'H':
 -                      sscanf(ntp_optarg, "%lf", &ntp_node.slew);
 -                        break;
 +      if (HAVE_OPT( SIMSLEW ))
 +              sscanf(OPT_ARG( SIMSLEW ), "%lf", &ntp_node.slew);
  
 -              case 'O':
 -                      sscanf(ntp_optarg, "%lf", &ntp_node.clk_time);
 -                        break;
 +      if (HAVE_OPT( SERVERTIME ))
 +              sscanf(OPT_ARG( SERVERTIME ), "%lf", &ntp_node.clk_time);
  
 -              case 'S':
 -                      sscanf(ntp_optarg, "%lf", &ntp_node.sim_time);
 -                        break;
 +      if (HAVE_OPT( ENDSIMTIME ))
 +              sscanf(OPT_ARG( ENDSIMTIME ), "%lf", &ntp_node.sim_time);
  
 -              case 'T':
 -                      sscanf(ntp_optarg, "%lf", &ntp_node.ferr);
 -                        break;
 +      if (HAVE_OPT( FREQERR ))
 +              sscanf(OPT_ARG( FREQERR ), "%lf", &ntp_node.ferr);
  
 -              case 'W':
 -                      sscanf(ntp_optarg, "%lf", &ntp_node.fnse);
 -                        break;
 +      if (HAVE_OPT( WALKNOISE ))
 +              sscanf(OPT_ARG( WALKNOISE ), "%lf", &ntp_node.fnse);
  
 -              case 'Y':
 -                      sscanf(ntp_optarg, "%lf", &ntp_node.ndly);
 -                        break;
 +      if (HAVE_OPT( NDELAY ))
 +              sscanf(OPT_ARG( NDELAY ), "%lf", &ntp_node.ndly);
  
 -              case 'Z': 
 -                      sscanf(ntp_optarg, "%lf", &ntp_node.pdly);
 -                        break;
 +      if (HAVE_OPT( PDELAY ))
 +              sscanf(OPT_ARG( PDELAY ), "%lf", &ntp_node.pdly);
  
  #endif /* SIM */
 -                  default:
 -                      errflg++;
 -                      break;
 -              }
 -      }
  
 -      if (errflg || ntp_optind != argc) {
 -              ntpd_usage();
 -              exit(2);
 +      if (errflg || argc) {
 +              printf("argc is <%d>\n", argc);
 +              optionUsage(&myOptions, 2);
        }
        return;
  }
Simple merge
Simple merge
diff --cc ntpd/ntp_util.c
Simple merge
diff --cc ntpd/ntpd.c
Simple merge
diff --cc ntpdc/ntpdc.c
Simple merge