]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Cleanup from Ralf Wildenhues
authorHarlan Stenn <stenn@ntp.org>
Mon, 23 Jan 2006 06:20:16 +0000 (01:20 -0500)
committerHarlan Stenn <stenn@ntp.org>
Mon, 23 Jan 2006 06:20:16 +0000 (01:20 -0500)
bk: 43d475a0MTTJIT4y-HzKgnVep4Bizg

12 files changed:
include/ntp_stdlib.h
include/ntpd.h
libntp/ntp_rfc2553.c
ntpd/cmd_args.c
ntpd/ntp_control.c
ntpd/ntp_util.c
ntpd/ntpd.c
ntpd/refclock_acts.c
ntpd/refclock_neoclock4x.c
ntpdc/ntpdc.c
ntpq/ntpq.c
util/ntp-keygen.c

index 3e15bc301a37ba7a2a7cd75ab964096ba9b3978a..c389d1ecc98b900b95abedb03054401deb033753 100644 (file)
@@ -100,7 +100,7 @@ extern      const char *    FindConfig      P((const char *));
 
 extern void    signal_no_reset P((int, RETSIGTYPE (*func)(int)));
 
-extern void    getauthkeys     P((char *));
+extern void    getauthkeys     P((const char *));
 extern void    auth_agekeys    P((void));
 extern void    rereadkeys      P((void));
 
index e91dd2372274eec59d70d7c7e180f7c72f9ea873..695112c6e67ea491f58ec3f75868056b8b6c7e5d 100644 (file)
@@ -59,7 +59,7 @@ struct ctl_var {
 extern  char *  add_var P((struct ctl_var **, u_long, u_short));
 extern  void    free_varlist P((struct ctl_var *));
 extern  void    set_var P((struct ctl_var **, const char *, u_long, u_short));
-extern  void    set_sys_var P((char *, u_long, u_short));
+extern  void    set_sys_var P((const char *, u_long, u_short));
 
 /* ntp_intres.c */
 extern void    ntp_res_name    P((struct sockaddr_storage, u_short));
@@ -210,7 +210,7 @@ extern      l_fp    sys_revoketime;
 /* ntp_util.c */
 extern void    init_util       P((void));
 extern void    hourly_stats    P((void));
-extern void    stats_config    P((int, char *));
+extern void    stats_config    P((int, const char *));
 extern void    record_peer_stats P((struct sockaddr_storage *, int, double, double, double, double));
 extern void    record_loop_stats P((double, double, double, double, int));
 extern void    record_clock_stats P((struct sockaddr_storage *, const char *));
index 231aea1ffabc710a2098943b44c71b53fb116bdb..9f7c790acad4e7c44f1b1db196116e3dc50fa155 100644 (file)
@@ -229,7 +229,7 @@ getaddrinfo (const char *nodename, const char *servname,
                port = 0;
 
        /*
-       /*
+        *
         * Set up the port number
         */
        if (ai->ai_family == AF_INET)
index d0bbebea2f089f367038dc473b26a8b8e2b58df3..0c30f32dda7f8c0339576187ad340e834a95b9d8 100644 (file)
@@ -184,7 +184,7 @@ getCmdOpts(
        char *argv[]
        )
 {
-       extern char *config_file;
+       extern const char *config_file;
        int errflg;
        tOptions myOptions =
 #ifdef SIM
@@ -254,12 +254,12 @@ getCmdOpts(
        if (HAVE_OPT( PROPAGATIONDELAY ))
                do {
                        double tmp;
-                       char *ntp_optarg = OPT_ARG( PROPAGATIONDELAY );
+                       const char *my_ntp_optarg = OPT_ARG( PROPAGATIONDELAY );
 
-                       if (sscanf(ntp_optarg, "%lf", &tmp) != 1) {
+                       if (sscanf(my_ntp_optarg, "%lf", &tmp) != 1) {
                                msyslog(LOG_ERR,
                                        "command line broadcast delay value %s undecodable",
-                                       ntp_optarg);
+                                       my_ntp_optarg);
                        } else {
                                proto_config(PROTO_BROADDELAY, 0, tmp, NULL);
                        }
@@ -269,12 +269,12 @@ getCmdOpts(
                stats_config(STATS_STATSDIR, OPT_ARG( STATSDIR ));
 
        if (HAVE_OPT( TRUSTEDKEY )) {
-               int     ct = STACKCT_OPT(  TRUSTEDKEY );
-               char**  pp = STACKLST_OPT( TRUSTEDKEY );
+               int           ct = STACKCT_OPT(  TRUSTEDKEY );
+               const char**  pp = STACKLST_OPT( TRUSTEDKEY );
 
                do  {
                        u_long tkey;
-                       char* p = *pp++;
+                       const char* p = *pp++;
 
                        tkey = (int)atol(p);
                        if (tkey <= 0 || tkey > NTP_MAXKEY) {
@@ -307,25 +307,25 @@ getCmdOpts(
        }
 
        if (HAVE_OPT( VAR )) {
-               int     ct = STACKCT_OPT(  VAR );
-               char**  pp = STACKLST_OPT( VAR );
+               int           ct = STACKCT_OPT(  VAR );
+               const char**  pp = STACKLST_OPT( VAR );
 
                do  {
-                       char* ntp_optarg = *pp++;
+                       const char* my_ntp_optarg = *pp++;
 
-                       set_sys_var(ntp_optarg, strlen(ntp_optarg)+1,
+                       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 );
-               char**  pp = STACKLST_OPT( DVAR );
+               int           ct = STACKCT_OPT(  DVAR );
+               const char**  pp = STACKLST_OPT( DVAR );
 
                do  {
-                       char* ntp_optarg = *pp++;
+                       const char* my_ntp_optarg = *pp++;
 
-                       set_sys_var(ntp_optarg, strlen(ntp_optarg)+1,
+                       set_sys_var(my_ntp_optarg, strlen(my_ntp_optarg)+1,
                            (u_short) (RW | DEF));
                } while (--ct > 0);
        }
index e734f27109e59a59c7f00110c2fca5afc35c9375..47842ab18e3d3cf12cd438e536dde05987bc0a09 100644 (file)
@@ -60,7 +60,9 @@ static        void    ctl_putid       P((const char *, char *));
 static void    ctl_putarray    P((const char *, double *, int));
 static void    ctl_putsys      P((int));
 static void    ctl_putpeer     P((int, struct peer *));
+#ifdef OPENSSL
 static void    ctl_putfs       P((const char *, tstamp_t));
+#endif
 #ifdef REFCLOCK
 static void    ctl_putclock    P((int, struct refclockstat *, int));
 #endif /* REFCLOCK */
@@ -1004,6 +1006,7 @@ ctl_putuint(
 /*
  * ctl_putfs - write a decoded filestamp into the response
  */
+#ifdef OPENSSL
 static void
 ctl_putfs(
        const char *tag,
@@ -1033,6 +1036,7 @@ ctl_putfs(
                cp++;
        ctl_putdata(buffer, (unsigned)( cp - buffer ), 0);
 }
+#endif
 
 
 /*
@@ -2965,7 +2969,7 @@ set_var(
 
 void
 set_sys_var(
-       char *data,
+       const char *data,
        u_long size,
        u_short def
        )
index c6fa4651279d6700ec598c20ba1c216c98c8d0f4..b43e83a4b6e9251f9acb3a38ec75a20bbbc80446 100644 (file)
@@ -251,11 +251,11 @@ hourly_stats(void)
 void
 stats_config(
        int item,
-       char *invalue   /* only one type so far */
+       const char *invalue     /* only one type so far */
        )
 {
        FILE *fp;
-       char *value;
+       const char *value;
        int len;
 
        /*
@@ -644,7 +644,7 @@ record_crypto_stats(
  */
 void
 getauthkeys(
-       char *keyfile
+       const char *keyfile
        )
 {
        int len;
index 62f51bb0681e54713ce19475844757dd7b9a6335..cda0bc85ae59a82a65ef0671f11370d7f1a40106 100644 (file)
@@ -222,7 +222,7 @@ static void setup_logfile           P((void));
 void
 init_logging(char const *name)
 {
-       char *cp;
+       const char *cp;
 
        /*
         * Logging.  This may actually work on the gizmo board.  Find a name
@@ -230,7 +230,7 @@ init_logging(char const *name)
         */
        cp = strrchr(name, '/');
        if (cp == 0)
-               cp = (char*)name;
+               cp = name;
        else
                cp++;
 
@@ -268,18 +268,18 @@ setup_logfile(
        )
 {
        if (HAVE_OPT( LOGFILE )) {
-               const char *optarg = OPT_ARG( LOGFILE );
+               const char *my_optarg = OPT_ARG( LOGFILE );
                FILE *new_file;
 
-               if(strcmp(optarg, "stderr") == 0)
+               if(strcmp(my_optarg, "stderr") == 0)
                        new_file = stderr;
-               else if(strcmp(optarg, "stdout") == 0)
+               else if(strcmp(my_optarg, "stdout") == 0)
                        new_file = stdout;
                else
-                       new_file = fopen(optarg, "a");
+                       new_file = fopen(my_optarg, "a");
                if (new_file != NULL) {
                        NLOG(NLOG_SYSINFO)
-                               msyslog(LOG_NOTICE, "logging to file %s", optarg);
+                               msyslog(LOG_NOTICE, "logging to file %s", my_optarg);
                        if (syslog_file != NULL &&
                                fileno(syslog_file) != fileno(new_file))
                                (void)fclose(syslog_file);
@@ -290,7 +290,7 @@ setup_logfile(
                else
                        msyslog(LOG_ERR,
                                "Cannot open log file %s",
-                               optarg);
+                               my_optarg);
        }
 }
 
index e8400f2ce28556cb771340f622560b549a624a97..9cc8bce7cf55fb848ab6a63ef669fe0a67cef9c7 100644 (file)
@@ -368,7 +368,7 @@ acts_message(
        up = (struct actsunit *)pp->unitptr;
 #ifdef DEBUG
        ioctl(pp->io.fd, TIOCMGET, (char *)&modem);
-       sprintf(tbuf, "acts: %04x (%d %d) %d %s", modem, up->state,
+       sprintf(tbuf, "acts: %04x (%d %d) %lu %s", modem, up->state,
            up->timer, strlen(pp->a_lastcode), pp->a_lastcode);
        if (debug)
                printf("%s\n", tbuf);
index 8bee2925b29b76f9cf0a6c2bf01027bddd2cc235..5efefd060101a0027b7f29d25a0d2d8c64a2bf02 100644 (file)
@@ -631,7 +631,7 @@ neoclock4x_receive(struct recvbuf *rbufp)
 #if defined(NTP_PRE_420)
               pp->msec
 #else
-              pp->nsec/1000
+              (int)(pp->nsec/1000)
 #endif
               );
     }
index 7ad97776aee82a373e2934df6eadf6218b2e618a..987e9192be7e8e4041d372908a97597a1a836ceb 100644 (file)
@@ -328,8 +328,8 @@ ntpdcmain(
        }
 
        if (HAVE_OPT(COMMAND)) {
-               int     cmdct = STACKCT_OPT( COMMAND );
-               char**  cmds  = STACKLST_OPT( COMMAND );
+               int             cmdct = STACKCT_OPT( COMMAND );
+               const char**    cmds  = STACKLST_OPT( COMMAND );
 
                while (cmdct-- > 0) {
                        ADDCMD(*cmds++);
index 40ce6b4655b9ffcec39ab5635cdd36dfb38ee361..16c1c6bd5ef6d8a61fe36924f981c5945a3be335 100644 (file)
@@ -537,8 +537,8 @@ ntpqmain(
        }
 
        if (HAVE_OPT(COMMAND)) {
-               int     cmdct = STACKCT_OPT( COMMAND );
-               char**  cmds  = STACKLST_OPT( COMMAND );
+               int             cmdct = STACKCT_OPT( COMMAND );
+               const char**    cmds  = STACKLST_OPT( COMMAND );
 
                while (cmdct-- > 0) {
                        ADDCMD(*cmds++);
index 4b4b3296fd796525e22fa5b68deff7a21c533990..ed7b35328c623bd0312e7fdfb072da1deba6cbc5 100644 (file)
@@ -242,10 +242,10 @@ main(
        char    *grpkey = NULL; /* identity extension */
        int     nid;            /* X509 digest/signature scheme */
        FILE    *fstr = NULL;   /* file handle */
+       u_int   temp;
 #define iffsw   HAVE_OPT(ID_KEY)
 #endif /* OPENSSL */
        char    hostbuf[MAXHOSTNAME + 1];
-       u_int   temp;
 
 #ifdef SYS_WINNT
        /* Initialize before OpenSSL checks */