]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Use TRACE() instead of DPRINTF() for libntp and utilities, which
authorDave Hart <hart@ntp.org>
Sat, 5 Mar 2011 22:35:37 +0000 (22:35 +0000)
committerDave Hart <hart@ntp.org>
Sat, 5 Mar 2011 22:35:37 +0000 (22:35 +0000)
  use the "debug" variable regardless of #ifdef DEBUG.
Declare debug in libntp instead of each program.  Expose extern declaration
  to utilities, libntp, and DEBUG ntpd.

bk: 4d72bab91NmUO24GvCJNOIHx44Kp_Q

46 files changed:
ChangeLog
clockstuff/chutest.c
clockstuff/propdelay.c
include/Makefile.am
include/declcond.h [new file with mode: 0644]
include/ntp_debug.h
include/ntp_stdlib.h
include/ntpd.h
libntp/lib_strbuf.c
libntp/machines.c
libntp/msyslog.c
libntp/ntp_intres.c
libntp/socket.c
libntp/socktohost.c
libntp/work_fork.c
libntp/work_thread.c
ntpd/Makefile.am
ntpd/check_y2k.c
ntpd/declcond.h [new file with mode: 0644]
ntpd/keyword-gen.c
ntpd/ntp_scanner.c
ntpd/ntpd.c
ntpd/refclock_bancomm.c
ntpdate/ntpdate.c
ntpdate/ntptimeset.c
ntpdc/ntpdc.c
ntpq/ntpq.c
ports/winnt/include/gaa_compat.h
ports/winnt/libntp/dnslookup.c [deleted file]
ports/winnt/libntp/mexit.c [deleted file]
ports/winnt/libntp/setpriority.c
ports/winnt/libntp/termios.c
ports/winnt/ntpd/ntservice.c
ports/winnt/vs2008/libntp/libntp.vcproj
ports/winnt/vs2008/ntpd/ntpd.vcproj
sntp/kod_management.c
sntp/main.c
sntp/networking.c
sntp/sntp.c
sntp/tests/Makefile.am
sntp/tests/sntptest.cpp [deleted file]
tests/libntp/libntptest.cpp
util/jitter.c
util/ntp-keygen.c
util/ntptime.c
util/tickadj.c

index 7a095558ac56a1b54cee7aaa1c5217183c716980..f169a32b2cba4c1995cc23c2cd137f36a39340a9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,5 @@
+* Use TRACE() instead of DPRINTF() for libntp and utilities, which
+  use the "debug" variable regardless of #ifdef DEBUG.
 (4.2.7p136) 2011/03/02 Released by Harlan Stenn <stenn@ntp.org>
 * [Bug 1839] 4.2.7p135 still installs libevent ev*.h headers.
 (4.2.7p135) 2011/03/02 Released by Harlan Stenn <stenn@ntp.org>
index e5ec554f97a73d154e67e93f2004788dfb3e6368..488a0d16e0ffed01f166a3aa14cb9679141e4db4 100644 (file)
@@ -57,7 +57,6 @@ struct chucode {
 #define        STREQ(a, b)     (*(a) == *(b) && strcmp((a), (b)) == 0)
 
 char *progname;
-int debug;
 
 int dofilter = 0;      /* set to 1 when we should run filter algorithm */
 int showtimes = 0;     /* set to 1 when we should show char arrival times */
index 3a73fb58dea91a2870bf33a3b55094cfc9c582b0..f9303f35faf04b1fc49474ce6ad5afe1dff8a669 100644 (file)
@@ -118,7 +118,6 @@ int Gflag = 0;
 int height;
 
 char *progname;
-volatile int debug;
 
 static void    doit            (double, double, double, double, double, char *);
 static double  latlong         (char *, int);
index 9294f3f44ffacc1f548fe1efddfc2820c2b7f5f1..a9070b0ead1a431713d179cb73dce5e8f625de59 100644 (file)
@@ -8,6 +8,7 @@ noinst_HEADERS =        \
        ascii.h         \
        audio.h         \
        binio.h         \
+       declcond.h      \
        gps.h           \
        hopf6039.h      \
        icom.h          \
diff --git a/include/declcond.h b/include/declcond.h
new file mode 100644 (file)
index 0000000..e1c72ac
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * declcond.h - declarations conditionalized for ntpd
+ *
+ * The NTP reference implementation distribution includes two distinct
+ * declcond.h files, one in ntpd/ used only by ntpd, and another in
+ * include/ used by libntp and utilities.  This relies on the source
+ * file's directory being ahead of include/ in the include search.
+ *
+ * The ntpd variant of declcond.h declares "debug" only #ifdef DEBUG,
+ * as the --disable-debugging version of ntpd should not reference
+ * "debug".  The libntp and utilities variant always declares debug,
+ * as it is used in those codebases even without DEBUG defined.
+ */
+
+/* #ifdef DEBUG */             /* uncommented in ntpd/declcond.h */
+extern int debug;
+/* #endif */                   /* uncommented in ntpd/declcond.h */
index e9e3f03641e33971636c09025f43b34f6234372e..b0e846e0b3757d08581dd2b5d98b881f34fba65a 100644 (file)
@@ -8,24 +8,20 @@
 #ifndef NTP_DEBUG_H
 #define NTP_DEBUG_H
 
-#include "ntp_assert.h"
-#include "ntp_stdlib.h"
-
 /*
- * macros for debugging output - cut down on #ifdef pollution in the code
+ * macro for debugging output - cut down on #ifdef pollution.
+ *
+ * TRACE() is similar to ntpd's DPRINTF() for utilities and libntp.
+ * Uses mprintf() and so supports %m, replaced by strerror(errno).
+ *
+ * The calling convention is not attractive:
+ *     TRACE(debuglevel, (fmt, ...));
+ *     TRACE(2, ("this will appear on stdout if debug >= %d\n", 2));
  */
-
-#ifdef DEBUG
-#define DPRINTF(_lvl_, _arg_)                          \
+#define TRACE(lvl, arg)                                        \
        do {                                            \
-               if (debug >= (_lvl_))                   \
-                       mprintf _arg_;                  \
+               if (debug >= (lvl))                     \
+                       mprintf arg;                    \
        } while (0)
-#else
-#define DPRINTF(_lvl_, _arg_)  do {} while (0)
-#endif
 
-#endif
-/*
- * $Log$
- */
+#endif /* NTP_DEBUG_H */
index 9c560d49a7c1494e1b0bdf3372c9e54fdd4f42ff..c6c6e95932d3a7d74f2f7863ed1ef59679e9aaf9 100644 (file)
@@ -9,10 +9,12 @@
 #include <sys/socket.h>
 #endif
 
+#include "declcond.h"  /* ntpd uses ntpd/declcond.h, others include/ */
 #include "l_stdlib.h"
+#include "ntp_net.h"
+#include "ntp_debug.h"
 #include "ntp_malloc.h"
 #include "ntp_string.h"
-#include "ntp_net.h"
 #include "ntp_syslog.h"
 
 
@@ -181,11 +183,6 @@ extern     void    rereadkeys      (void);
  * Variable declarations for libntp.
  */
 
-/*
- * Defined by any program.
- */
-extern volatile int debug;             /* debugging flag */
-
 /* authkeys.c */
 extern u_long  authkeynotfound;        /* keys not found */
 extern u_long  authkeylookups;         /* calls to lookup keys */
index 7c27c3a523d91036d44a2fdecdce782454c41e7d..84930809b6b7d40b45f9cf0a66d4f21ab13adecb 100644 (file)
  * -----------------------------------------
  */
 
+/*
+ * macro for debugging output - cut down on #ifdef pollution.
+ *
+ * DPRINTF() is for use by ntpd only, and compiles away to nothing
+ * without DEBUG (configure --disable-debugging).
+ *
+ * TRACE() is similar for libntp and utilities, which retain full
+ * debug capability even when compiled without DEBUG.
+ *
+ * The calling convention is not attractive:
+ *     DPRINTF(debuglevel, (fmt, ...));
+ *     DPRINTF(2, ("shows #ifdef DEBUG and if debug >= %d\n", 2));
+ */
+#ifdef DEBUG
+# define DPRINTF(lvl, arg)                             \
+       do {                                            \
+               if (debug >= (lvl))                     \
+                       mprintf arg;                    \
+       } while (0)
+#else
+# define DPRINTF(lvl, arg)     do {} while (0)
+#endif
+
 
 /* nt_clockstuff.c */
 #ifdef SYS_WINNT
@@ -509,7 +532,6 @@ extern      double  stats_write_tolerance;
 extern double  wander_threshold;
 
 /* ntpd.c */
-extern volatile int debug;     /* debugging flag */
 extern int     nofork;         /* no-fork flag */
 extern int     initializing;   /* initializing flag */
 #ifdef HAVE_DROPROOT
index 1551b9f69d61cd6466f4f00dfbbe1b3a1efbb3f5..9ddf5cf5059b83c442462cd41ed8f409d494b873 100644 (file)
 /*
  * Storage declarations
  */
-libbufstr lib_stringbuf[LIB_NUMBUF];
-int lib_nextbuf;
-int ipv4_works;
-int ipv6_works;
-int lib_inited;
+int            debug;
+libbufstr      lib_stringbuf[LIB_NUMBUF];
+int            lib_nextbuf;
+int            ipv4_works;
+int            ipv6_works;
+int            lib_inited;
 
 /*
  * initialization routine.  Might be needed if the code is ROMized.
index 9ff8d61e7785fe4dff54ed840d32fa98f31b2019..96ffaffa1cd3ad62f229bd45f765018e5a6427a6 100644 (file)
@@ -436,7 +436,7 @@ ntp_set_tod(
        int             rc;
        int             saved_errno;
 
-       DPRINTF(1, ("In ntp_set_tod\n"));
+       TRACE(1, ("In ntp_set_tod\n"));
        rc = -1;
        saved_errno = 0;
 
@@ -451,7 +451,7 @@ ntp_set_tod(
                errno = 0;
                rc = clock_settime(CLOCK_REALTIME, &ts);
                saved_errno = errno;
-               DPRINTF(1, ("ntp_set_tod: clock_settime: %d %m\n", rc));
+               TRACE(1, ("ntp_set_tod: clock_settime: %d %m\n", rc));
                if (!tod && !rc)
                        tod = SET_TOD_CLOCK_SETTIME;
 
@@ -470,7 +470,7 @@ ntp_set_tod(
                errno = 0;
                rc = SETTIMEOFDAY(tvp, tzp);
                saved_errno = errno;
-               DPRINTF(1, ("ntp_set_tod: settimeofday: %d %m\n", rc));
+               TRACE(1, ("ntp_set_tod: settimeofday: %d %m\n", rc));
                if (!tod && !rc)
                        tod = SET_TOD_SETTIMEOFDAY;
        }
@@ -482,15 +482,15 @@ ntp_set_tod(
                errno = 0;
                rc = stime(&tp); /* lie as bad as SysVR4 */
                saved_errno = errno;
-               DPRINTF(1, ("ntp_set_tod: stime: %d %m\n", rc));
+               TRACE(1, ("ntp_set_tod: stime: %d %m\n", rc));
                if (!tod && !rc)
                        tod = SET_TOD_STIME;
        }
 #endif /* HAVE_STIME */
 
        errno = saved_errno;    /* for %m below */
-       DPRINTF(1, ("ntp_set_tod: Final result: %s: %d %m\n",
-               set_tod_used[tod], rc));
+       TRACE(1, ("ntp_set_tod: Final result: %s: %d %m\n",
+                 set_tod_used[tod], rc));
        /*
         * Say how we're setting the time of day
         */
index 67f7acd200c69d0718ffe21d3cddcaf63a8a0bf3..c0114fb1d196ba4ed91a43e44773c908e400ded3 100644 (file)
@@ -471,7 +471,7 @@ change_logfile(
                } else
 #endif
                        abs_fname = estrdup(log_fname);
-               DPRINTF(1, ("attempting to open log %s\n", abs_fname));
+               TRACE(1, ("attempting to open log %s\n", abs_fname));
                new_file = fopen(abs_fname, "a");
        }
 
index 1c7cf55628568eef5678c2a025055c590bb45b70..1cedfe450b11db09e509e5da42b48c65bc54e004 100644 (file)
@@ -341,9 +341,9 @@ blocking_getaddrinfo(
        resp = emalloc_zero(resp_octets);
        gai_resp = (void *)(resp + 1);
 
-       DPRINTF(2, ("blocking_getaddrinfo given node %s serv %s fam %d flags %x\n", 
-                   node, service, gai_req->hints.ai_family,
-                   gai_req->hints.ai_flags));
+       TRACE(2, ("blocking_getaddrinfo given node %s serv %s fam %d flags %x\n", 
+                 node, service, gai_req->hints.ai_family,
+                 gai_req->hints.ai_flags));
 #ifdef DEBUG
        if (debug >= 2)
                fflush(stdout);
@@ -376,12 +376,8 @@ blocking_getaddrinfo(
                if (gai_resp->retry > INITIAL_DNS_RETRY) {
                        time_now = time(NULL);
                        worker_ctx->ignore_scheduled_before = time_now;
-                       DPRINTF(1, ("DNS success after retry, ignoring sleeps scheduled before now (%s)",
-                               humantime(time_now)));
-#ifdef DEBUG
-                       if (debug >= 1)
-                               fflush(stdout);
-#endif 
+                       TRACE(1, ("DNS success after retry, ignoring sleeps scheduled before now (%s)\n",
+                                 humantime(time_now)));
                }
        }
 
@@ -500,8 +496,8 @@ getaddrinfo_sometime_complete(
                if (gai_resp->retry > INITIAL_DNS_RETRY) {
                        time_now = time(NULL);
                        child_ctx->next_dns_timeslot = time_now;
-                       DPRINTF(1, ("DNS success after retry, %u next_dns_timeslot reset (%s)",
-                               gai_req->dns_idx, humantime(time_now)));
+                       TRACE(1, ("DNS success after retry, %u next_dns_timeslot reset (%s)\n",
+                                 gai_req->dns_idx, humantime(time_now)));
                }
        } else {
                again = should_retry_dns(gai_resp->retcode,
@@ -592,28 +588,28 @@ void gai_test_callback(int rescode, int gai_errno, void *context, const char *na
        sockaddr_u addr;
 
        if (rescode) {
-               DPRINTF(1, ("gai_test_callback context %p error rescode %d %s serv %s\n",
-                           context, rescode, name, service));
+               TRACE(1, ("gai_test_callback context %p error rescode %d %s serv %s\n",
+                         context, rescode, name, service));
                return;
        }
        while (!rescode && NULL != ai_res) {
                ZERO_SOCK(&addr);
                memcpy(&addr, ai_res->ai_addr, ai_res->ai_addrlen);
-               DPRINTF(1, ("ctx %p fam %d addr %s canon '%s' type %s at %p ai_addr %p ai_next %p\n", 
-                           context,
-                           AF(&addr),
-                           stoa(&addr), 
-                           (ai_res->ai_canonname)
-                               ? ai_res->ai_canonname
-                               : "",
-                           (SOCK_DGRAM == ai_res->ai_socktype) 
-                               ? "DGRAM" 
-                               : (SOCK_STREAM == ai_res->ai_socktype) 
-                                       ? "STREAM" 
-                                       : "(other)",
-                           ai_res,
-                           ai_res->ai_addr,
-                           ai_res->ai_next));
+               TRACE(1, ("ctx %p fam %d addr %s canon '%s' type %s at %p ai_addr %p ai_next %p\n", 
+                         context,
+                         AF(&addr),
+                         stoa(&addr), 
+                         (ai_res->ai_canonname)
+                             ? ai_res->ai_canonname
+                             : "",
+                         (SOCK_DGRAM == ai_res->ai_socktype) 
+                             ? "DGRAM" 
+                             : (SOCK_STREAM == ai_res->ai_socktype) 
+                                   ? "STREAM" 
+                                   : "(other)",
+                         ai_res,
+                         ai_res->ai_addr,
+                         ai_res->ai_next));
 
                getnameinfo_sometime((sockaddr_u *)ai_res->ai_addr, 128, 32, 0, gni_test_callback, context);
 
@@ -732,9 +728,9 @@ blocking_getnameinfo(
        resp = emalloc_zero(resp_octets);
        gni_resp = (void *)((char *)resp + sizeof(*resp));
 
-       DPRINTF(2, ("blocking_getnameinfo given addr %s flags 0x%x hostlen %lu servlen %lu\n",
-                   stoa(&gni_req->socku), gni_req->flags,
-                   (u_long)gni_req->hostoctets, (u_long)gni_req->servoctets));
+       TRACE(2, ("blocking_getnameinfo given addr %s flags 0x%x hostlen %lu servlen %lu\n",
+                 stoa(&gni_req->socku), gni_req->flags,
+                 (u_long)gni_req->hostoctets, (u_long)gni_req->servoctets));
        
        gni_resp->retcode = getnameinfo(&gni_req->socku.sa,
                                        SOCKLEN(&gni_req->socku),
@@ -765,7 +761,7 @@ blocking_getnameinfo(
                if (gni_req->retry > INITIAL_DNS_RETRY) {
                        time_now = time(NULL);
                        worker_ctx->ignore_scheduled_before = time_now;
-                       DPRINTF(1, ("DNS success after retrying, ignoring sleeps scheduled before now (%s)",
+                       TRACE(1, ("DNS success after retrying, ignoring sleeps scheduled before now (%s)\n",
                                humantime(time_now)));
                }
        }
@@ -836,8 +832,8 @@ getnameinfo_sometime_complete(
                if (gni_resp->retry > INITIAL_DNS_RETRY) {
                        time_now = time(NULL);
                        child_ctx->next_dns_timeslot = time_now;
-                       DPRINTF(1, ("DNS success after retry, %u next_dns_timeslot reset (%s)",
-                               gni_req->dns_idx, humantime(time_now)));
+                       TRACE(1, ("DNS success after retry, %u next_dns_timeslot reset (%s)\n",
+                                 gni_req->dns_idx, humantime(time_now)));
                }
        } else {
                again = should_retry_dns(gni_resp->retcode, gni_resp->gni_errno);
@@ -885,11 +881,11 @@ getnameinfo_sometime_complete(
 void gni_test_callback(int rescode, int gni_errno, sockaddr_u *psau, int flags, const char *host, const char *service, void *context)
 {
        if (!rescode)
-               DPRINTF(1, ("gni_test_callback got host '%s' serv '%s' for addr %s context %p\n", 
-                           host, service, stoa(psau), context));
+               TRACE(1, ("gni_test_callback got host '%s' serv '%s' for addr %s context %p\n", 
+                         host, service, stoa(psau), context));
        else
-               DPRINTF(1, ("gni_test_callback context %p rescode %d gni_errno %d flags 0x%x addr %s\n",
-                           context, rescode, gni_errno, flags, stoa(psau)));
+               TRACE(1, ("gni_test_callback context %p rescode %d gni_errno %d flags 0x%x addr %s\n",
+                         context, rescode, gni_errno, flags, stoa(psau)));
 }
 #endif /* TEST_BLOCKING_WORKER */
 
@@ -1022,18 +1018,18 @@ scheduled_sleep(
        time_t now;
 
        if (scheduled < worker_ctx->ignore_scheduled_before) {
-               DPRINTF(1, ("ignoring sleep until %s scheduled at %s (before %s)\n",
-                       humantime(earliest), humantime(scheduled),
-                       humantime(worker_ctx->ignore_scheduled_before)));
+               TRACE(1, ("ignoring sleep until %s scheduled at %s (before %s)\n",
+                         humantime(earliest), humantime(scheduled),
+                         humantime(worker_ctx->ignore_scheduled_before)));
                return;
        }
 
        now = time(NULL);
 
        if (now < earliest) {
-               DPRINTF(1, ("sleep until %s scheduled at %s (>= %s)\n",
-                       humantime(earliest), humantime(scheduled),
-                       humantime(worker_ctx->ignore_scheduled_before)));
+               TRACE(1, ("sleep until %s scheduled at %s (>= %s)\n",
+                         humantime(earliest), humantime(scheduled),
+                         humantime(worker_ctx->ignore_scheduled_before)));
                if (-1 == worker_sleep(worker_ctx->c, earliest - now)) {
                        /* our sleep was interrupted */
                        now = time(NULL);
@@ -1043,8 +1039,8 @@ scheduled_sleep(
                        next_res_init = worker_ctx->next_res_init;
                        res_init();
 #endif
-                       DPRINTF(1, ("sleep interrupted by daemon, ignoring sleeps scheduled before now (%s)\n",
-                               humantime(worker_ctx->ignore_scheduled_before)));
+                       TRACE(1, ("sleep interrupted by daemon, ignoring sleeps scheduled before now (%s)\n",
+                                 humantime(worker_ctx->ignore_scheduled_before)));
                }
        }
 }
@@ -1129,15 +1125,15 @@ should_retry_dns(
                again = 1;
 # ifdef DEBUG
                errno_to_str(res_errno, msg, sizeof(msg));
-               DPRINTF(1, ("intres: EAI_SYSTEM errno %d (%s) means try again, right?\n",
-                           res_errno, msg));
+               TRACE(1, ("intres: EAI_SYSTEM errno %d (%s) means try again, right?\n",
+                         res_errno, msg));
 # endif
                break;
 #endif
        }
 
-       DPRINTF(2, ("intres: resolver returned: %s (%d), %sretrying\n",
-               gai_strerror(rescode), rescode, again ? "" : "not "));
+       TRACE(2, ("intres: resolver returned: %s (%d), %sretrying\n",
+                 gai_strerror(rescode), rescode, again ? "" : "not "));
 
        return again;
 }
index ccea6f0fd19511d8bfec85e0dded8d1c21cd35ff..1a490ae19285b2061accf95900cab430c6a83a0f 100644 (file)
@@ -100,9 +100,9 @@ move_fd(
        if (socket_boundary == -1) {
                socket_boundary = max(0, min(GETDTABLESIZE() - FD_CHUNK,
                                             min(FOPEN_MAX, FD_PREFERRED_SOCKBOUNDARY)));
-               DPRINTF(1,("move_fd: estimated max descriptors: %d, "
-                       "initial socket boundary: %d\n",
-                       GETDTABLESIZE(), socket_boundary));
+               TRACE(1, ("move_fd: estimated max descriptors: %d, "
+                         "initial socket boundary: %d\n",
+                         GETDTABLESIZE(), socket_boundary));
        }
 
        /*
@@ -124,8 +124,8 @@ move_fd(
                        return fd;
                }
                socket_boundary = max(0, socket_boundary - FD_CHUNK);
-               DPRINTF(1, ("move_fd: selecting new socket boundary: %d\n",
-                       socket_boundary));
+               TRACE(1, ("move_fd: selecting new socket boundary: %d\n",
+                         socket_boundary));
        } while (socket_boundary > 0);
 #else
        NTP_REQUIRE((int)fd >= 0);
@@ -375,13 +375,13 @@ open_socket(
                                "setsockopt SO_TIMESTAMP on fails on address %s: %m",
                                stoa(addr));
                else
-                       DPRINTF(4, ("setsockopt SO_TIMESTAMP enabled on fd %d address %s\n",
-                                   fd, stoa(addr)));
+                       TRACE(4, ("setsockopt SO_TIMESTAMP enabled on fd %d address %s\n",
+                                 fd, stoa(addr)));
        }
 #endif
-       DPRINTF(4, ("bind(%d) AF_INET%s, addr %s%%%d#%d, flags 0x%x\n",
-                  fd, IS_IPV6(addr) ? "6" : "", stoa(addr),
-                  SCOPE(addr), SRCPORT(addr), interf->flags));
+       TRACE(4, ("bind(%d) AF_INET%s, addr %s%%%d#%d, flags 0x%x\n",
+                 fd, IS_IPV6(addr) ? "6" : "", stoa(addr),
+                 SCOPE(addr), SRCPORT(addr), interf->flags));
 
        init_nonblocking_io(fd);
 
@@ -392,8 +392,8 @@ open_socket(
        add_fd_to_list(fd, FD_TYPE_SOCKET);
 
 #if !defined(SYS_WINNT) && !defined(VMS)
-       DPRINTF(4, ("flags for fd %d: 0x%x\n", fd,
-                   fcntl(fd, F_GETFL, 0)));
+       TRACE(4, ("flags for fd %d: 0x%x\n", fd,
+                 fcntl(fd, F_GETFL, 0)));
 #endif /* SYS_WINNT || VMS */
 
 #if defined (HAVE_IO_COMPLETION_PORT)
@@ -448,16 +448,16 @@ sendpkt(
                 * unbound peer - drop request and wait for better
                 * network conditions
                 */
-               DPRINTF(2, ("%ssendpkt(dst=%s, ttl=%d, len=%d): no interface - IGNORED\n",
-                           ismcast ? "\tMCAST\t***** " : "",
-                           stoa(dest), ttl, len));
+               TRACE(2, ("%ssendpkt(dst=%s, ttl=%d, len=%d): no interface - IGNORED\n",
+                         ismcast ? "\tMCAST\t***** " : "",
+                         stoa(dest), ttl, len));
                return;
        }
 
        do {
-               DPRINTF(2, ("%ssendpkt(%d, dst=%s, src=%s, ttl=%d, len=%d)\n",
-                           ismcast ? "\tMCAST\t***** " : "", src->fd,
-                           stoa(dest), stoa(&src->sin), ttl, len));
+               TRACE(2, ("%ssendpkt(%d, dst=%s, src=%s, ttl=%d, len=%d)\n",
+                         ismcast ? "\tMCAST\t***** " : "", src->fd,
+                         stoa(dest), stoa(&src->sin), ttl, len));
 #ifdef MCAST
                /*
                 * for the moment we use the bcast option to set multicast ttl
@@ -626,11 +626,11 @@ read_network_packet(
                fromlen = sizeof(from);
                buflen = recvfrom(fd, buf, sizeof(buf), 0,
                                  &from.sa, &fromlen);
-               DPRINTF(4, ("%s on (%lu) fd=%d from %s\n",
-                       (itf->ignore_packets)
-                           ? "ignore"
-                           : "drop",
-                       free_recvbuffs(), fd, stoa(&from)));
+               TRACE(4, ("%s on (%lu) fd=%d from %s\n",
+                         (itf->ignore_packets)
+                             ? "ignore"
+                             : "drop",
+                         free_recvbuffs(), fd, stoa(&from)));
                if (itf->ignore_packets)
                        packets_ignored++;
                else
@@ -670,13 +670,13 @@ read_network_packet(
        } else if (buflen < 0) {
                msyslog(LOG_ERR, "recvfrom(%s) fd=%d: %m",
                        stoa(&rb->recv_srcadr), fd);
-               DPRINTF(5, ("read_network_packet: fd=%d dropped (bad recvfrom)\n",
-                           fd));
+               TRACE(5, ("read_network_packet: fd=%d dropped (bad recvfrom)\n",
+                         fd));
                freerecvbuf(rb);
                return (buflen);
        }
 
-       DPRINTF(3, ("read_network_packet: fd=%d length %d from %s\n",
+       TRACE(3, ("read_network_packet: fd=%d length %d from %s\n",
                    fd, buflen, stoa(&rb->recv_srcadr)));
 
        /*
index 71cc8efe82ede9def448b8660c59e8726ba9e917..c61e57148a65883436e802195aa4740ae643465d 100644 (file)
@@ -44,7 +44,7 @@ socktohost(
                        NULL, 0, gni_flags))
                return stoa(sock);      /* use address */
 
-       DPRINTF(1, ("%s reversed to %s\n", stoa(sock), pbuf));
+       TRACE(1, ("%s reversed to %s\n", stoa(sock), pbuf));
 
        /*
         * Resolve the reversed name and make sure the reversed address
@@ -101,7 +101,8 @@ socktohost(
                return pbuf;    /* forward check passed */
 
     forward_fail:
-       DPRINTF(1, ("forward check lookup fail: %s\n", pbuf));
+       TRACE(1, ("%s forward check lookup fail: %s\n", pbuf,
+                 gai_strerror(a_info)));
        LIB_GETBUF(pliar);
        snprintf(pliar, LIB_BUFLENGTH, "%s (%s)", stoa(sock), pbuf);
 
index f09a87dd24cf4d5050e20aa87d339b2af95ac12d..44ef043a5f4fa8a2d554cf8c93fa6f587cbca8c2 100644 (file)
@@ -78,8 +78,8 @@ worker_sleep(
                if (!worker_sighup_received)
                        sleep_remain = sleep(sleep_remain);
                if (worker_sighup_received) {
-                       DPRINTF(1, ("worker SIGHUP with %us left to sleep",
-                                   sleep_remain));
+                       TRACE(1, ("worker SIGHUP with %us left to sleep",
+                                 sleep_remain));
                        worker_sighup_received = 0;
                        return -1;
                }
@@ -233,8 +233,8 @@ receive_blocking_req_internal(
                msyslog(LOG_ERR,
                        "receive_blocking_req_internal: pipe read %m\n");
        } else if (0 == rc) {
-               DPRINTF(4, ("parent closed request pipe, child %d terminating\n",
-                       c->pid));
+               TRACE(4, ("parent closed request pipe, child %d terminating\n",
+                         c->pid));
        } else if (rc != sizeof(hdr)) {
                msyslog(LOG_ERR,
                        "receive_blocking_req_internal: short header read %d of %lu\n",
@@ -288,10 +288,10 @@ send_blocking_resp_internal(
                return 0;
 
        if (rc < 0)
-               DPRINTF(1, ("send_blocking_resp_internal: pipe write %m\n"));
+               TRACE(1, ("send_blocking_resp_internal: pipe write %m\n"));
        else
-               DPRINTF(1, ("send_blocking_resp_internal: short write %d of %ld\n",
-                       rc, octets));
+               TRACE(1, ("send_blocking_resp_internal: short write %d of %ld\n",
+                         rc, octets));
 
        return -1;
 }
@@ -313,15 +313,15 @@ receive_blocking_resp_internal(
        rc = read(c->resp_read_pipe, &hdr, sizeof(hdr));
 
        if (rc < 0) {
-               DPRINTF(1, ("receive_blocking_resp_internal: pipe read %m\n"));
+               TRACE(1, ("receive_blocking_resp_internal: pipe read %m\n"));
        } else if (0 == rc) {
                /* this is the normal child exited indication */
        } else if (rc != sizeof(hdr)) {
-               DPRINTF(1, ("receive_blocking_resp_internal: short header read %d of %lu\n",
-                           rc, (u_long)sizeof(hdr)));
+               TRACE(1, ("receive_blocking_resp_internal: short header read %d of %lu\n",
+                         rc, (u_long)sizeof(hdr)));
        } else if (BLOCKING_RESP_MAGIC != hdr.magic_sig) {
-               DPRINTF(1, ("receive_blocking_resp_internal: header mismatch (0x%x)\n",
-                           hdr.magic_sig));
+               TRACE(1, ("receive_blocking_resp_internal: header mismatch (0x%x)\n",
+                         hdr.magic_sig));
        } else {
                INSIST(sizeof(hdr) < hdr.octets &&
                       hdr.octets < 16 * 1024);
@@ -333,10 +333,10 @@ receive_blocking_resp_internal(
                          octets);
 
                if (rc < 0)
-                       DPRINTF(1, ("receive_blocking_resp_internal: pipe data read %m\n"));
+                       TRACE(1, ("receive_blocking_resp_internal: pipe data read %m\n"));
                else if (rc < octets)
-                       DPRINTF(1, ("receive_blocking_resp_internal: short read %d of %ld\n",
-                                   rc, octets));
+                       TRACE(1, ("receive_blocking_resp_internal: short read %d of %ld\n",
+                                 rc, octets));
                else
                        return resp;
        }
@@ -450,7 +450,7 @@ fork_blocking_child(
 
        if (childpid) {
                /* this is the parent */
-               DPRINTF(1, ("forked worker child (pid %d)\n", childpid));
+               TRACE(1, ("forked worker child (pid %d)\n", childpid));
                c->pid = childpid;
                c->ispipe = is_pipe;
 
index b4050b8d88818d9289690e20baf3702d3ddf536c..622a0ab496a136d5f88f5bb553dc42d61b0687ff 100644 (file)
@@ -379,7 +379,7 @@ start_blocking_thread_internal(
                        &blocking_thread_id);
 
        if (NULL == blocking_child_thread) {
-               DPRINTF(1, ("fatal can not start blocking thread\n"));
+               msyslog(LOG_ERR, "start blocking thread failed: %m\n");
                exit(-1);
        }
        c->thread_id = blocking_thread_id;
@@ -387,7 +387,7 @@ start_blocking_thread_internal(
        /* remember the thread priority is only within the process class */
        if (!SetThreadPriority(blocking_child_thread,
                               THREAD_PRIORITY_BELOW_NORMAL))
-               DPRINTF(1, ("Error lowering blocking thread priority\n"));
+               msyslog(LOG_ERR, "Error lowering blocking thread priority: %m\n");
 
        resumed = ResumeThread(blocking_child_thread);
        DEBUG_INSIST(resumed);
index 51f6b869899fb0414b542a986001671b4c24d32e..881fc6c9fcce9a3a8f31940901da0f03ea032a27 100644 (file)
@@ -123,6 +123,7 @@ EXTRA_DIST =                        \
 check_PROGRAMS = @MAKE_CHECK_Y2K@
 EXTRA_PROGRAMS = check_y2k ntpdsim keyword-gen
 noinst_DATA =  $(srcdir)/ntpd-opts.texi $(srcdir)/ntpd-opts.menu
+noinst_HEADERS = declcond.h
 run_ag=                cd $(srcdir) && env PATH="$(abs_builddir):$(PATH)"      \
                autogen -L ../sntp/include --writable
 std_def_list =                                                 \
index 6b8311502940f738fa692c3908c5951480f47d61..12d1a592bd49356297199c0f5e716d15dc1fe0f5 100644 (file)
 
 #define GoodLeap(Year) (((Year)%4 || (!((Year)%100) && (Year)%400)) ? 0 : 13 )
 
-volatile int debug = 0;                /* debugging requests for parse stuff */
 char const *progname = "check_y2k";
 
 long
diff --git a/ntpd/declcond.h b/ntpd/declcond.h
new file mode 100644 (file)
index 0000000..d712948
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * declcond.h - declarations conditionalized for ntpd
+ *
+ * The NTP reference implementation distribution includes two distinct
+ * declcond.h files, one in ntpd/ used only by ntpd, and another in
+ * include/ used by libntp and utilities.  This relies on the source
+ * file's directory being ahead of include/ in the include search.
+ *
+ * The ntpd variant of declcond.h declares "debug" only #ifdef DEBUG,
+ * as the --disable-debugging version of ntpd should not reference
+ * "debug".  The libntp and utilities variant always declares debug,
+ * as it is used in those codebases even without DEBUG defined.
+ */
+
+#ifdef DEBUG                   /* uncommented in ntpd/declcond.h */
+extern int debug;
+#endif                         /* uncommented in ntpd/declcond.h */
index 03cb32189afe413a3a2a0e5ad7c434691e35706d..cf6aaf687300a0c257f337ab5f7cd649a486a723 100644 (file)
@@ -248,7 +248,6 @@ char *              symb[1024];     /* map token ID to symbolic name */
 
 /* for libntp */
 const char *   progname = "keyword-gen";
-volatile int   debug = 1;
 
 int            main                    (int, char **);
 static void    generate_preamble       (void);
@@ -268,6 +267,8 @@ int main(int argc, char **argv)
                fprintf(stderr, "Usage:\n%s t_header.h\n", argv[0]);
                exit(1);
        }
+       debug = 1;
+
        populate_symb(argv[1]);
 
        generate_preamble();
index c49e055fd62b622f9dacbc8c450e5656832639d4..8fcbb4e2314dbdea4e7ce383890193d6e5dbcf08 100644 (file)
 #include <errno.h>
 #include <string.h>
 
+#include "ntpd.h"
 #include "ntp_config.h"
 #include "ntpsim.h"
 #include "ntp_scanner.h"
 #include "ntp_parser.h"
-#include "ntp_debug.h"
 
 /* ntp_keyword.h declares finite state machine and token text */
 #include "ntp_keyword.h"
index 2c9bb477ee4f29df66e393a0f43735c20c88dcc5..c26cc41f863ba517abb61e3de0a0b9d03777736f 100644 (file)
@@ -150,13 +150,6 @@ int priority_done = 2;             /* 0 - Set priority */
                                /* 2 - Don't set priority */
                                /* 1 and 2 are pretty much the same */
 
-#ifdef DEBUG
-/*
- * Debugging flag
- */
-volatile int debug = 0;                /* No debugging by default */
-#endif
-
 int    listen_to_virtual_ips = 1;
 
 /*
index e72337f92b8c12073b4f97e8ffa157da129a12bf..1bbea7b9f9e0417a62ad8147282aa979d63c7d54 100644 (file)
@@ -145,11 +145,6 @@ typedef void *SYMMT_PCI_HANDLE;
  */
 extern u_long current_time;     /* current time(s) */
 
-/*
- * Imported from ntpd module
- */
-extern volatile int debug;               /* global debug flag */
-
 /*
  * VME unit control structure.
  * Changes made to vmeunit structure. Most members are now available in the 
index 933b5d16a8ba59c29a81f1957ad3494a3ba80561..b8eb39c28813f7621c98a25fb471d8dc49287355 100644 (file)
@@ -109,19 +109,14 @@ static timer_t ntpdate_timerid;
  */
 s_char sys_precision;          /* local clock precision (log2 s) */
 
-/*
- * Debugging flag
- */
-volatile int debug = 0;
-
 /*
  * File descriptor masks etc. for call to select
  */
 
 int ai_fam_templ;
-int nbsock;             /* the number of sockets used */
+int nbsock;                    /* the number of sockets used */
 SOCKET fd[MAX_AF];
-int fd_family[MAX_AF]; /* to remember the socket family */
+int fd_family[MAX_AF];         /* to remember the socket family */
 #ifdef HAVE_POLL_H
 struct pollfd fdmask[MAX_AF];
 #else
index 2485aadb6b05b8c0d23ca5beb2666ebe481c4d98..46c2f8f1d187b91113633d12a5d6ed2f11ca1f1e 100644 (file)
@@ -191,11 +191,6 @@ static timer_t ntpdate_timerid;
 #define NTP_MAXLIST 5  /* maximum select list size */
 #define PEER_SHIFT     8       /* 8 suitable for crystal time base */
 
-/*
- * Debugging flag
- */
-volatile int debug = 0;
-
 /*
  * File descriptor masks etc. for call to select
  */
index 27fe70a7ae67cf3400db80bfd3e2340c0682d1a5..36e850f7962619d82d4c43f32b529f26b296cfbf 100644 (file)
@@ -239,7 +239,6 @@ static      FILE *current_output;
 extern struct xcmd opcmds[];
 
 char *progname;
-volatile int debug;
 
 #ifdef NO_MAIN_ALLOWED
 CALL(ntpdc,"ntpdc",ntpdcmain);
index 79c29fdcf73e9470a3f009a951b5759ffae08ebd..a6f9b4fc24f71c24b68e2643fb140b9fd1ba7e30 100644 (file)
@@ -381,7 +381,6 @@ FILE *current_output;
 extern struct xcmd opcmds[];
 
 char *progname;
-volatile int debug;
 
 #ifdef NO_MAIN_ALLOWED
 #ifndef BUILD_AS_LIB
@@ -733,6 +732,7 @@ getresponse(
        int len;
        int first;
        char *data;
+       int errcode;
 
        /*
         * This is pretty tricky.  We may get between 1 and MAXFRAG packets
@@ -874,15 +874,12 @@ getresponse(
                 * Check the error code.  If non-zero, return it.
                 */
                if (CTL_ISERROR(rpkt.r_m_e_op)) {
-                       int errcode;
-
                        errcode = (ntohs(rpkt.status) >> 8) & 0xff;
-                       if (debug && CTL_ISMORE(rpkt.r_m_e_op)) {
-                               printf("Error code %d received on not-final packet\n",
-                                      errcode);
-                       }
+                       if (CTL_ISMORE(rpkt.r_m_e_op))
+                               TRACE(1, ("Error code %d received on not-final packet\n",
+                                         errcode));
                        if (errcode == CERR_UNSPEC)
-                           return ERR_UNSPEC;
+                               return ERR_UNSPEC;
                        return errcode;
                }
 
@@ -891,9 +888,8 @@ getresponse(
                 * we sent.
                 */
                if (ntohs(rpkt.associd) != associd) {
-                       if (debug)
-                           printf("Association ID %d doesn't match expected %d\n",
-                                  ntohs(rpkt.associd), associd);
+                       TRACE(1, ("Association ID %d doesn't match expected %d\n",
+                                 ntohs(rpkt.associd), associd));
                        /*
                         * Hack for silly fuzzballs which, at the time of writing,
                         * return an assID of sys.peer when queried for system variables.
@@ -914,16 +910,16 @@ getresponse(
                 * boundary and no smaller than claimed by rpkt.count
                 */
                if (n & 0x3) {
-                       DPRINTF(1, ("Response packet not padded, size = %d\n",
-                               n));
+                       TRACE(1, ("Response packet not padded, size = %d\n",
+                                 n));
                        continue;
                }
 
                shouldbesize = (CTL_HEADER_LEN + count + 3) & ~3;
 
                if (n < shouldbesize) {
-                       printf("Response packet claims %u octets payload, above %ld received\n",
-                              count, (long)(n - CTL_HEADER_LEN));
+                       printf("Response packet claims %u octets payload, above %d received\n",
+                              count, n - CTL_HEADER_LEN);
                        return ERR_INCOMPLETE;
                }
 
@@ -967,29 +963,23 @@ getresponse(
                        }
                }
 
-               if (debug >= 2)
-                       printf("Got packet, size = %d\n", n);
+               TRACE(2, ("Got packet, size = %d\n", n));
                if ((int)count > (n - CTL_HEADER_LEN)) {
-                       if (debug)
-                               printf("Received count of %d octets, data in packet is %ld\n",
-                                       count,
-                                       (long)(n - CTL_HEADER_LEN));
+                       TRACE(1, ("Received count of %d octets, data in packet is %d\n",
+                                 count, (n - CTL_HEADER_LEN)));
                        continue;
                }
                if (count == 0 && CTL_ISMORE(rpkt.r_m_e_op)) {
-                       if (debug)
-                               printf("Received count of 0 in non-final fragment\n");
+                       TRACE(1, ("Received count of 0 in non-final fragment\n"));
                        continue;
                }
                if (offset + count > sizeof(pktdata)) {
-                       if (debug)
-                               printf("Offset %d, count %d, too big for buffer\n",
-                                      offset, count);
+                       TRACE(1, ("Offset %d, count %d, too big for buffer\n",
+                                 offset, count));
                        return ERR_TOOMUCH;
                }
                if (seenlastfrag && !CTL_ISMORE(rpkt.r_m_e_op)) {
-                       if (debug)
-                               printf("Received second last fragment packet\n");
+                       TRACE(1, ("Received second last fragment packet\n"));
                        continue;
                }
 
@@ -997,13 +987,11 @@ getresponse(
                 * So far, so good.  Record this fragment, making sure it doesn't
                 * overlap anything.
                 */
-               if (debug >= 2)
-                       printf("Packet okay\n");;
+               TRACE(2, ("Packet okay\n"));
 
                if (numfrags > (MAXFRAGS - 1)) {
-                       if (debug)
-                               printf("Number of fragments exceeds maximum %d\n",
-                                      MAXFRAGS - 1);
+                       TRACE(2, ("Number of fragments exceeds maximum %d\n",
+                                 MAXFRAGS - 1));
                        return ERR_TOOMUCH;
                }
 
@@ -1018,25 +1006,20 @@ getresponse(
                }
 
                if (f < numfrags && offset == offsets[f]) {
-                       if (debug)
-                               printf("duplicate %u octets at %u ignored, prior %u at %u\n",
-                                      count, offset, counts[f],
-                                      offsets[f]);
+                       TRACE(1, ("duplicate %u octets at %u ignored, prior %u at %u\n",
+                                 count, offset, counts[f], offsets[f]));
                        continue;
                }
 
                if (f > 0 && (offsets[f-1] + counts[f-1]) > offset) {
-                       if (debug)
-                               printf("received frag at %u overlaps with %u octet frag at %u\n",
-                                      offset, counts[f-1],
-                                      offsets[f-1]);
+                       TRACE(1, ("received frag at %u overlaps with %u octet frag at %u\n",
+                                 offset, counts[f-1], offsets[f-1]));
                        continue;
                }
 
                if (f < numfrags && (offset + count) > offsets[f]) {
-                       if (debug)
-                               printf("received %u octet frag at %u overlaps with frag at %u\n",
-                                      count, offset, offsets[f]);
+                       TRACE(1, ("received %u octet frag at %u overlaps with frag at %u\n",
+                                 count, offset, offsets[f]));
                        continue;
                }
 
@@ -1074,10 +1057,8 @@ getresponse(
                                        break;
                        if (f == numfrags) {
                                *rsize = offsets[f-1] + counts[f-1];
-                               if (debug)
-                                       fprintf(stderr,
-                                               "%lu packets reassembled into response\n",
-                                               (u_long)numfrags);
+                               TRACE(1, ("%lu packets reassembled into response\n",
+                                         (u_long)numfrags));
                                return 0;
                        }
                }
index 13cc9e1648e93a326117660719b90282fe541b09..fdacaf0e84a50717287b1b3cbcfb4b2dce8522a6 100644 (file)
@@ -766,6 +766,6 @@ GetAdaptersAddresses(
 #endif
 /* +++++++++++++++++++++++ from iphlpapi.h */
 
-#endif /* !_W64 */
 #pragma warning(pop)
+#endif /* !_W64 */
 #endif /* GAA_COMPAT_H */
diff --git a/ports/winnt/libntp/dnslookup.c b/ports/winnt/libntp/dnslookup.c
deleted file mode 100644 (file)
index 6d72edc..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Copyright (C) 2006  Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * This module uses Windows lookup facilities to get the address information
- * wherever it resides. This avoids calling the Internet standard funcction
- * gethostbyname and gives us more control over the results since the
- * Microsoft implementation seems to return the wrong error code for some
- * conditions.
- */
-
-#include <config.h>
-#include <ws2tcpip.h>
-#include <nspapi.h>
-#include <svcguid.h>
-#include <ntp_rfc2553.h>
-#include <malloc.h>
-#include <ntp_stdlib.h>
-#include <syslog.h>
-
-/*
- * Set this Macro to force retries even if it fails
- * the lookup
- */
-#ifdef FORCE_DNSRETRY
-
-#undef EAI_NONAME
-#define EAI_NONAME EAI_AGAIN
-
-#endif
-
-typedef struct hostent hostent_t;
-
-int ReturnCode(int errcode)
-{
-       int retcode;
-
-       switch (errcode)
-       {
-       case 0:
-               return (0);
-       case WSAEINVAL:
-               return (EAI_BADFLAGS);
-       case WSANO_DATA:
-               return (EAI_NONAME);
-       case WSANOTINITIALISED:
-       case WSASERVICE_NOT_FOUND:
-               return (EAI_FAIL);
-       case WSA_NOT_ENOUGH_MEMORY:
-               return (EAI_MEMORY);
-       default:
-               return (EAI_FAIL);
-       }
-}
-
-int
-AddToAddresses(char **Addresses, int *cnt, CSADDR_INFO *csaddr)
-{
-
-       int csize;
-       struct in_addr *sinaddr;
-       char *addr;
-       struct in_addr *addr_list;
-       struct sockaddr_in *sin;
-       sin = (struct sockaddr_in *) csaddr->RemoteAddr.lpSockaddr;
-       if (*Addresses != NULL)
-       {
-               csize = _msize(*Addresses);
-               addr_list = realloc(*Addresses, csize + sizeof(struct in_addr));
-       }
-       else
-       {
-               csize = 0;
-               addr_list = malloc(sizeof(struct in_addr));
-       }
-       addr = (char *) addr_list;
-       sinaddr = &((struct in_addr*) addr)[(*cnt)];
-       memset(sinaddr, 0, sizeof(sinaddr));
-       memcpy(sinaddr, &sin->sin_addr, sizeof(struct in_addr));
-       
-       (*cnt)++;
-       *Addresses = (char *) addr_list;
-       return 0;
-}
-
-int
-DNSlookup_name(
-       const char *name,
-       int ai_family,
-       struct hostent **Addresses
-)
-{
-       char buffer[sizeof(WSAQUERYSET) + 2048];
-       WSAQUERYSET query;
-       struct hostent *addr = NULL;
-       char *bufaddr = NULL;
-       char ** addrlist = &bufaddr;
-       int addrcnt = 0;
-       WSAQUERYSET *results = (WSAQUERYSET *) buffer;
-       GUID    HostnameGUID = SVCID_INET_HOSTADDRBYNAME;
-       HANDLE  handle;
-       DWORD dwLength;
-       int err = 0;
-       int retcode = 0;
-       int errcode = 0;
-       DWORD i;
-
-       /*
-        * First we must create a query set
-        */
-       memset(&query, 0, sizeof(query));
-       query.dwSize = sizeof(query);
-       query.lpszServiceInstanceName = (char *)name;
-       query.dwNameSpace = NS_DNS;
-       query.lpServiceClassId = &HostnameGUID;
-
-       err = WSALookupServiceBegin(&query,
-                                 LUP_RETURN_NAME | LUP_RETURN_BLOB | LUP_RETURN_ADDR,
-                                 &handle);
-
-       if(err == SOCKET_ERROR)
-       {
-               /*
-                * Convert the error code and return
-                */
-               return (ReturnCode(WSAGetLastError()));
-       }
-
-       /*
-        * Initially none
-        * Change if we get something
-        */
-       retcode = EAI_NONAME;
-       dwLength = sizeof(buffer);
-
-       while(err == 0)         /* Drop out when error */
-       {
-               memset(&buffer, 0, dwLength);
-               err = WSALookupServiceNext(
-                                       handle,
-                                       0,
-                                       &dwLength,
-                                       results);
-               errcode = WSAGetLastError();
-               if (results->dwNumberOfCsAddrs > 0)
-               {
-                       if (addr == NULL)
-                       {
-                               addr = (struct hostent *) malloc(sizeof(struct hostent));
-                               memset(addr, 0, sizeof(struct hostent));
-                               addr->h_addrtype = (short) results->lpcsaBuffer->iSocketType;
-                               addr->h_length = sizeof(struct in_addr); /* Only passing back the address */
-                               addrlist = malloc(sizeof(char *));
-                               *addrlist = NULL;
-                       }
-                       for (i = 0; i < results->dwNumberOfCsAddrs; i++)
-                       {
-                               AddToAddresses(addrlist, &addrcnt, &results->lpcsaBuffer[i]);
-                       }
-               }
-
-       }
-       if (addr != NULL)
-       {
-               addr->h_name = (char *) name;
-               addr->h_addr_list = addrlist;
-               retcode = 0;
-               *Addresses = addr;
-       }
-       else
-       {
-#ifdef FORCE_DNSRETRY
-               /*
-                * We do this or the error would never be logged
-                */
-               if (errcode == WSANO_DATA)
-                       msyslog(LOG_ERR, "Address not found for %s", name);
-#endif
-               retcode = ReturnCode(errcode);
-       }
-       WSALookupServiceEnd(handle);
-       return (retcode);
-}
-
diff --git a/ports/winnt/libntp/mexit.c b/ports/winnt/libntp/mexit.c
deleted file mode 100644 (file)
index e6b4469..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * mexit - Used to exit the NTPD daemon
- * 
- */
-
-#include <windows.h>
-#include <stdio.h>
-
-HANDLE hServDoneEvent = NULL;
-
-void
-service_exit(
-       int status
-       )
-{
-       extern int debug;
-
-       if (debug) /* did not become a service, simply exit */
-           ExitThread((DWORD)status);
-       else {
-               /* service mode, need to have the service_main routine
-                * register with the service control manager that the 
-                * service has stopped running, before exiting
-                */
-               if ((status > 0) && (hServDoneEvent != NULL))
-                   SetEvent(hServDoneEvent);
-               ExitThread((DWORD)status);
-       }
-}
-
index c57269ad32f6de9161d14fa73d00459d5f257e38..52ab785294228b0ac3c8598f8bb423c1a206aa2f 100644 (file)
@@ -43,9 +43,8 @@ int setpriority(
        BOOL success;
        DWORD prio_class;
 
-       if (PRIO_PROCESS != which || who || NTP_PRIO != prio) {
-               DPRINTF(1,("windows setpriority() clone needs work.\n"));
-       }
+       if (PRIO_PROCESS != which || who || NTP_PRIO != prio)
+               TRACE(1, ("windows setpriority() clone needs work.\n"));
 
        prio_class = GetPriorityClass(GetCurrentProcess());
        
index c13ea417086f432df9b7ecba1dc40b5fdbb41c98..db9895bed82aec262ecfc4eb362a13b41b529ef2 100644 (file)
@@ -4,15 +4,11 @@
 #include <config.h>
 #include <io.h>
 #include <stdio.h>
-#include "ntp_machine.h"
-#include "ntp_stdlib.h"
+
+#include "ntp.h"
+#include "ntp_tty.h"
 #include "lib_strbuf.h"
-#include "ntp_syslog.h"
 #include "ntp_assert.h"
-#include "ntp_debug.h"
-#include "ntp_fp.h"
-#include "ntp.h"
-#include "ntp_refclock.h"
 #include "win32_io.h"
 
 #define MAX_SERIAL 255 /* COM1: - COM255: */
@@ -55,7 +51,7 @@ HANDLE common_serial_open(
         * equanimously.
         */
 
-       DPRINTF(1, ("common_serial_open given %s\n", dev));
+       TRACE(1, ("common_serial_open given %s\n", dev));
 
        pch = NULL;
        if ('/' == dev[0]) {
@@ -67,23 +63,23 @@ HANDLE common_serial_open(
                        }
                        pch++;
                }
-               DPRINTF(1, ("common_serial_open skipped to ending digits leaving %s\n", pch));
+               TRACE(1, ("common_serial_open skipped to ending digits leaving %s\n", pch));
        } else if ('c' == tolower(dev[0])
                   && 'o' == tolower(dev[1])
                   && 'm' == tolower(dev[2])) {
                pch = dev + 3;
-               DPRINTF(1, ("common_serial_open skipped COM leaving %s\n", pch));
+               TRACE(1, ("common_serial_open skipped COM leaving %s\n", pch));
        }
 
        if (!pch || !isdigit(pch[0])) {
-               DPRINTF(1, ("not a digit: %s\n", pch ? pch : "[NULL]"));
+               TRACE(1, ("not a digit: %s\n", pch ? pch : "[NULL]"));
                return INVALID_HANDLE_VALUE;
        }
 
        if (1 != sscanf(pch, "%d", &unit) 
            || unit > MAX_SERIAL
            || unit < 0) {
-               DPRINTF(1, ("sscanf failure of %s\n", pch));
+               TRACE(1, ("sscanf failure of %s\n", pch));
                return INVALID_HANDLE_VALUE;
        }
 
@@ -101,7 +97,7 @@ HANDLE common_serial_open(
                NTP_ENSURE(0 == hnds[unit].opens);
                LIB_GETBUF(windev);
                snprintf(windev, LIB_BUFLENGTH, "\\\\.\\COM%d", unit);
-               DPRINTF(1, ("windows device %s\n", windev));
+               TRACE(1, ("windows device %s\n", windev));
                *pwindev = windev;
                hnds[unit].h =
                    CreateFile(
index af76201e3c7532f3b17ba22aedd5176a138e99df..fb6b1c169dcaafaab9a44970ab0514aec4e57edf 100644 (file)
@@ -41,7 +41,6 @@ static BOOL computer_shutting_down = FALSE;
 static int glb_argc;
 static char **glb_argv;
 HANDLE hServDoneEvent = NULL;
-extern volatile int debug;
 extern int accept_wildcard_if_for_winnt;
 
 /*
index 78b5eb036a99b192293dd41c93f6af9f828ae3dc..f689558b71cc78b809ef35c62c8c60a47ac34793 100644 (file)
                                RelativePath="..\..\include\config.h"
                                >
                        </File>
+                       <File
+                               RelativePath="..\..\..\..\include\declcond.h"
+                               >
+                       </File>
                        <File
                                RelativePath="..\..\..\..\lib\isc\include\isc\event.h"
                                >
                                >
                        </File>
                        <File
-                               RelativePath="..\..\..\..\lib\isc\win32\include\isc\time.h"
+                               RelativePath="..\..\include\sys\time.h"
                                >
                        </File>
                        <File
-                               RelativePath="..\..\include\sys\time.h"
+                               RelativePath="..\..\..\..\lib\isc\win32\include\isc\time.h"
                                >
                        </File>
                        <File
index 5830076d831956d577111284e126bde94a2556e6..43b6963ea1d59f488674b4e5de1f9b473de74777 100644 (file)
                                RelativePath="..\..\include\config.h"
                                >
                        </File>
+                       <File
+                               RelativePath="..\..\..\..\ntpd\declcond.h"
+                               >
+                       </File>
                        <File
                                RelativePath="..\..\include\hopf_PCI_io.h"
                                >
index 0a26854e13d5c35bc102cb6a8e8925ba83d31c57..3d691adcdeba976b265b90fb5d39fad5094e059e 100644 (file)
@@ -189,7 +189,7 @@ kod_init_kod_db(
        char *str_ptr;
        char error = 0;
 
-       DPRINTF(2, ("Initializing KOD DB...\n"));
+       TRACE(2, ("Initializing KOD DB...\n"));
 
        kod_db_file = estrdup(db_file);
 
@@ -235,11 +235,11 @@ kod_init_kod_db(
        }
 
        if (0 == kod_db_cnt) {
-               DPRINTF(2, ("KoD DB %s empty.\n", db_file));
+               TRACE(2, ("KoD DB %s empty.\n", db_file));
                goto wrapup;
        }
 
-       DPRINTF(2, ("KoD DB %s contains %d entries, reading...\n", db_file, kod_db_cnt));
+       TRACE(2, ("KoD DB %s contains %d entries, reading...\n", db_file, kod_db_cnt));
 
        rewind(db_s);
 
@@ -288,10 +288,10 @@ kod_init_kod_db(
     wrapup:
        fclose(db_s);
        for (a = 0; a < kod_db_cnt; a++)
-               DPRINTF(2, ("KoD entry %d: %s at %llx type %s\n", a,
-                       kod_db[a]->hostname,
-                       (unsigned long long)kod_db[a]->timestamp,
-                       kod_db[a]->type));
+               TRACE(2, ("KoD entry %d: %s at %llx type %s\n", a,
+                         kod_db[a]->hostname,
+                         (unsigned long long)kod_db[a]->timestamp,
+                         kod_db[a]->type));
 
        if (!readonly && write_kod_db())
                atexit(&atexit_write_kod_db);
index 12499c63646b03e296ccf1ad24af86256c41f9d5..f191476b2a1e08b01512b5b793fc98548f7c6019 100644 (file)
@@ -140,21 +140,21 @@ sntp_main (
                exit(EX_SOFTWARE);
 
        init_lib();
-       DPRINTF(2, ("init_lib() done, %s%s\n",
-               (ipv4_works)
-                   ? "ipv4_works "
-                   : "",
-               (ipv6_works)
-                   ? "ipv6_works "
-                   : ""));
 
        optct = ntpOptionProcess(&sntpOptions, argc, argv);
        argc -= optct;
        argv += optct;
 
        debug = DESC(DEBUG_LEVEL).optOccCt;
-       DPRINTF(1, ("%s\n", Version));
-
+       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;
        headspace.tv_usec = max(0, OPT_VALUE_HEADSPACE * 1000);
@@ -183,7 +183,7 @@ sntp_main (
        /* IPv6 available? */
        if (isc_net_probeipv6() != ISC_R_SUCCESS) {
                ai_fam_pref = AF_INET;
-               DPRINTF(1, ("No ipv6 support available, forcing ipv4\n"));
+               TRACE(1, ("No ipv6 support available, forcing ipv4\n"));
        } else {
                /* Check for options -4 and -6 */
                if (HAVE_OPT(IPV4))
@@ -381,7 +381,7 @@ handle_lookup(
        size_t          name_sz;
        size_t          octets;
 
-       DPRINTF(1, ("handle_lookup(%s,%#x)\n", name, flags));
+       TRACE(1, ("handle_lookup(%s,%#x)\n", name, flags));
 
        ZERO(hints);
        hints.ai_family = ai_fam_pref;
@@ -464,10 +464,10 @@ sntp_name_resolved(
                        fprintf(stderr, "%s lookup error %s\n",
                                dctx->name, gai_strerror(rescode));
        } else {
-               DPRINTF(3, ("%s [%s]\n", dctx->name,
-                       (addr->ai_canonname != NULL)
-                           ? addr->ai_canonname
-                           : ""));
+               TRACE(3, ("%s [%s]\n", dctx->name,
+                         (addr->ai_canonname != NULL)
+                             ? addr->ai_canonname
+                             : ""));
 
                for (ai = addr; ai != NULL; ai = ai->ai_next) {
 
@@ -592,8 +592,8 @@ queue_xmt(
                if (xctx->sched > start_cb.tv_sec)
                        delay.tv_sec = xctx->sched - start_cb.tv_sec;
                event_add(ev_xmt_timer, &delay);
-               DPRINTF(2, ("queue_xmt: xmt timer for %u usec\n",
-                       (u_int)delay.tv_usec));
+               TRACE(2, ("queue_xmt: xmt timer for %u usec\n",
+                         (u_int)delay.tv_usec));
        }
 }
 
@@ -621,8 +621,8 @@ xmt_timer_cb(
        gettimeofday_cached(base, &start_cb);
        if (xmt_q->sched <= start_cb.tv_sec) {
                UNLINK_HEAD_SLIST(x, xmt_q, link);
-               DPRINTF(2, ("xmt_timer_cb: at .%6.6u -> %s\n",
-                       (u_int)start_cb.tv_usec, stoa(&x->spkt->addr)));
+               TRACE(2, ("xmt_timer_cb: at .%6.6u -> %s\n",
+                         (u_int)start_cb.tv_usec, stoa(&x->spkt->addr)));
                xmt(x);
                free(x);
                if (NULL == xmt_q)
@@ -630,16 +630,16 @@ xmt_timer_cb(
        }
        if (xmt_q->sched <= start_cb.tv_sec) {
                event_add(ev_xmt_timer, &headspace);
-               DPRINTF(2, ("xmt_timer_cb: at .%6.6u headspace %6.6u\n",
-                       (u_int)start_cb.tv_usec,
-                       (u_int)headspace.tv_usec));
+               TRACE(2, ("xmt_timer_cb: at .%6.6u headspace %6.6u\n",
+                         (u_int)start_cb.tv_usec,
+                         (u_int)headspace.tv_usec));
        } else {
                delay.tv_sec = xmt_q->sched - start_cb.tv_sec;
                delay.tv_usec = 0;
                event_add(ev_xmt_timer, &delay);
-               DPRINTF(2, ("xmt_timer_cb: at .%6.6u next %ld seconds\n",
-                       (u_int)start_cb.tv_usec,
-                       (long)delay.tv_sec));
+               TRACE(2, ("xmt_timer_cb: at .%6.6u next %ld seconds\n",
+                         (u_int)start_cb.tv_usec,
+                         (long)delay.tv_sec));
        }
 }
 
@@ -676,8 +676,8 @@ xmt(
        memcpy(&spkt->x_pkt, &x_pkt, min(sizeof(spkt->x_pkt), pkt_len));
        spkt->stime = tv_xmt.tv_sec - JAN_1970;
 
-       DPRINTF(2, ("xmt: %lx.%6.6u %s %s\n", (u_long)tv_xmt.tv_sec,
-               (u_int)tv_xmt.tv_usec, dctx->name, stoa(dst)));
+       TRACE(2, ("xmt: %lx.%6.6u %s %s\n", (u_long)tv_xmt.tv_sec,
+                 (u_int)tv_xmt.tv_usec, dctx->name, stoa(dst)));
 
        /*
        ** If the send fails:
@@ -710,8 +710,8 @@ timeout_queries(void)
                        if (0 == spkt->stime || spkt->done)
                                continue;
                        age = start_cb.tv_sec - spkt->stime;
-                       DPRINTF(3, ("%s %s age %ld\n", stoa(&spkt->addr),
-                               spkt->dctx->name, age));
+                       TRACE(3, ("%s %s age %ld\n", stoa(&spkt->addr),
+                                 spkt->dctx->name, age));
                        if (age > ucst_timeout)
                                timeout_query(spkt);
                }
@@ -729,8 +729,8 @@ void dec_pending_ntp(
                check_exit_conditions();
        } else {
                INSIST(0 == n_pending_ntp);
-               DPRINTF(1, ("n_pending_ntp reached zero before dec for %s %s\n",
-                       name, stoa(server)));
+               TRACE(1, ("n_pending_ntp reached zero before dec for %s %s\n",
+                         name, stoa(server)));
        }
 }
 
@@ -762,7 +762,7 @@ check_kod(
 
        /* Is there a KoD on file for this address? */
        hostname = addrinfo_to_str(ai);
-       DPRINTF(2, ("check_kod: checking <%s>\n", hostname));
+       TRACE(2, ("check_kod: checking <%s>\n", hostname));
        if (search_entry(hostname, &reason)) {
                printf("prior KoD for %s, skipping.\n",
                        hostname);
@@ -802,14 +802,14 @@ sock_cb(
        int             rc;
 
        INSIST(sock4 == fd || sock6 == fd);
-       DPRINTF(3, ("sock_cb: event on sock%s:%s%s%s%s [UCST]\n",
-               (fd == sock6)
-                   ? "6"
-                   : "4",
-               (what & EV_TIMEOUT) ? " timeout" : "",
-               (what & EV_READ)    ? " read" : "",
-               (what & EV_WRITE)   ? " write" : "",
-               (what & EV_SIGNAL)  ? " signal" : ""));
+       TRACE(3, ("sock_cb: event on sock%s:%s%s%s%s [UCST]\n",
+                 (fd == sock6)
+                     ? "6"
+                     : "4",
+                 (what & EV_TIMEOUT) ? " timeout" : "",
+                 (what & EV_READ)    ? " read" : "",
+                 (what & EV_WRITE)   ? " write" : "",
+                 (what & EV_SIGNAL)  ? " signal" : ""));
 
        if (!(EV_READ & what)) {
                if (EV_TIMEOUT & what)
@@ -842,13 +842,13 @@ sock_cb(
                return;
        }
 
-       DPRINTF(1, ("sock_cb: %s %s\n", spkt->dctx->name,
-               sptoa(&sender)));
+       TRACE(1, ("sock_cb: %s %s\n", spkt->dctx->name,
+                 sptoa(&sender)));
 
        rpktl = process_pkt(&r_pkt, &sender, rpktl, MODE_SERVER,
                            &spkt->x_pkt, "sock_cb");
 
-       DPRINTF(2, ("sock_cb: process_pkt returned %d\n", rpktl));
+       TRACE(2, ("sock_cb: process_pkt returned %d\n", rpktl));
 
        /* If this is a Unicast packet, one down ... */
        if (!spkt->done && (CTX_UCST & spkt->dctx->flags)) {
@@ -860,7 +860,7 @@ sock_cb(
        /* If the packet is good, set the time and we're all done */
        rc = handle_pkt(rpktl, &r_pkt, &spkt->addr, spkt->dctx->name);
        if (0 != rc)
-               DPRINTF(1, ("sock_cb: handle_pkt() returned %d\n", rc));
+               TRACE(1, ("sock_cb: handle_pkt() returned %d\n", rc));
        check_exit_conditions();
 }
 
@@ -879,8 +879,8 @@ check_exit_conditions(void)
                event_base_loopexit(base, NULL);
                shutting_down = TRUE;
        } else {
-               DPRINTF(2, ("%d NTP and %d name queries pending\n",
-                           n_pending_ntp, n_pending_dns));
+               TRACE(2, ("%d NTP and %d name queries pending\n",
+                         n_pending_ntp, n_pending_dns));
        }
 }
 
@@ -1159,8 +1159,8 @@ handle_pkt(
                break;
 
        case 1:
-               DPRINTF(3, ("handle_pkt: %d bytes from %s %s\n",
-                              rpktl, stoa(host), hostname));
+               TRACE(3, ("handle_pkt: %d bytes from %s %s\n",
+                         rpktl, stoa(host), hostname));
 
                gettimeofday_cached(base, &tv_dst);
 
@@ -1236,7 +1236,7 @@ offset_calculation(
        NTOHL_FP(&rpkt->xmt, &p_xmt);
 
        *precision = LOGTOD(rpkt->precision);
-       DPRINTF(3, ("offset_calculation: precision: %f\n", *precision));
+       TRACE(3, ("offset_calculation: precision: %f\n", *precision));
 
        *root_dispersion = FPTOD(p_rdsp);
 
@@ -1270,9 +1270,9 @@ offset_calculation(
        *offset = (t21 + t34) / 2.;
        delta = t21 - t34;
 
-       DPRINTF(3, ("sntp offset_calculation:\trec - org t21: %.6f\n"
-               "\txmt - dst t34: %.6f\tdelta: %.6f\toffset: %.6f\n",
-               t21, t34, delta, *offset));
+       TRACE(3, ("sntp offset_calculation:\trec - org t21: %.6f\n"
+                 "\txmt - dst t34: %.6f\tdelta: %.6f\toffset: %.6f\n",
+                 t21, t34, delta, *offset));
 }
 
 
index f3f966705764873d03e36f21e0dcf96a654afae5..7fea4df0031133b1d3eb2e808d48a5cb4c22fbcc 100644 (file)
@@ -34,7 +34,7 @@ sendpkt (
                        /* oh well */
                }
        } else {
-               DPRINTF(3, ("Packet sent.\n"));
+               TRACE(3, ("Packet sent.\n"));
        }
 }
 
@@ -164,8 +164,8 @@ unusable:
                }
                /* Yay! Things worked out! */
                is_authentic = TRUE;
-               DPRINTF(1, ("sntp %s: packet from %s authenticated using key id %d.\n",
-                       func_name, stoa(sender), key_id));
+               TRACE(1, ("sntp %s: packet from %s authenticated using key id %d.\n",
+                         func_name, stoa(sender), key_id));
                break;
 
        default:
@@ -209,11 +209,11 @@ unusable:
        if (STRATUM_PKT_UNSPEC == rpkt->stratum) {
                char *ref_char;
 
-               DPRINTF(1, ("%s: Stratum unspecified, going to check for KOD (stratum: %d)\n", 
-                       func_name, rpkt->stratum));
+               TRACE(1, ("%s: Stratum unspecified, going to check for KOD (stratum: %d)\n", 
+                         func_name, rpkt->stratum));
                ref_char = (char *) &rpkt->refid;
-               DPRINTF(1, ("%s: Packet refid: %c%c%c%c\n", func_name,
-                       ref_char[0], ref_char[1], ref_char[2], ref_char[3]));
+               TRACE(1, ("%s: Packet refid: %c%c%c%c\n", func_name,
+                         ref_char[0], ref_char[1], ref_char[2], ref_char[3]));
                /* If it's a KOD packet we'll just use the KOD information */
                if (ref_char[0] != 'X') {
                        if (strncmp(ref_char, "DENY", 4) == 0)
index bdc8e4e7fd29d8e21ceb78cafb063e64722d6e83..3e6255728796ca5ffc471cb9dec5b7a04dd10bc2 100644 (file)
@@ -2,12 +2,10 @@
 
 #include "main.h"
 
-volatile int debug;
-
 int 
 main (
-       int argc,
-       char **argv
+       int     argc,
+       char ** argv
        ) 
 {
        return sntp_main(argc, argv);
index 93f84c83330c45944214117f8ab3cda9f5bff5d6..8a26ad751b278557197e906ed2894d9905f8e3f6 100644 (file)
@@ -21,7 +21,6 @@ sntp_SOURCES_USED =                   \
 
 base_SOURCES =                         \
        $(srcdir)/../tests_main.cpp     \
-       sntptest.cpp                    \
        $(NULL)
 
 tests_SOURCES =                        \
diff --git a/sntp/tests/sntptest.cpp b/sntp/tests/sntptest.cpp
deleted file mode 100644 (file)
index 8cc8985..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "sntptest.h"
-
-/*
- * This file contains various constants that libntp needs to be set
- *  and that is normally defined in ntpd/ntpq/...
- */
-
-volatile int debug = 0;
index 7d3afdf3d5211d212ee20eabd17af560f3cde633..c3363b008bdbe2a0f97845bd9c3f4160ec93f684 100644 (file)
@@ -5,7 +5,6 @@
  */
 
 u_long current_time = 4; // needed by authkeys. Used only in to calculate lifetime.
-volatile int debug = 0;
 const char *progname = "libntptest";
 
 time_t libntptest::nowtime = 0;
index 20c63ad7d01a7241290f7a1d40a0a2941d5bc61a..62a84ade3d59f7f9ffc92d7b11d822c5251c04bf 100644 (file)
@@ -21,7 +21,6 @@
 #define JAN_1970 2208988800UL          /* Unix base epoch */
 #define CLOCK_GETTIME                  /* Solaris hires clock */
 
-int debug;
 char progname[10];
 double sys_residual;
 double average;
index b0ed88c7a1056d090b2a0d29bdb39f04b076da5f..0b78728b67a270ca006b77f15e52539b7739d581 100644 (file)
@@ -156,7 +156,6 @@ u_long      asn2ntp         (ASN1_TIME *);
  */
 extern char *optarg;           /* command line argument */
 char   *progname;
-volatile int   debug = 0;      /* debug, not de bug */
 u_int  lifetime = YEAR;        /* certificate lifetime (days) */
 int    nkeys;                  /* MV keys */
 time_t epoch;                  /* Unix epoch (seconds) since 1970 */
index 7202dfb5855e954bf4468acd13edabf55832d8f2..4ca823492240a14dc4f7f581903f3503c8e53998 100644 (file)
@@ -67,7 +67,6 @@ static volatile int pll_control; /* (0) daemon, (1) kernel loop */
 static volatile int status;    /* most recent status bits */
 static volatile int flash;     /* most recent ntp_adjtime() bits */
 char* progname;
-volatile int debug;            /* for libntp */
 static char optargs[] = "MNT:cde:f:hm:o:rs:t:";
 
 int
index 7bfde4d288644fbdffd5c412c30b70d63819781c..05b6191c5d2f48fc1109952d6e2f9fbe635062a7 100644 (file)
@@ -213,7 +213,6 @@ main(
 #define        STREQ(a, b)     (*(a) == *(b) && strcmp((a), (b)) == 0)
 
 char *progname;
-volatile int debug;
 
 int dokmem = 1;
 int writetickadj = 0;