[Git][NTPsec/ntpsec][master] Remove the failed libntpq experiment.
Eric S. Raymond
gitlab at mg.gitlab.com
Fri Sep 23 09:05:51 UTC 2016
Eric S. Raymond pushed to branch master at NTPsec / ntpsec
Commits:
fd68e6f5 by Eric S. Raymond at 2016-09-23T04:58:59-04:00
Remove the failed libntpq experiment.
This was a libraryized version of the ntpq code with which other mode 6
clients could be written in C, but web searches turn up not a trace of
evidence that this ever happened. This is a poor application for C;
better to use Python and the Python packet library.
- - - - -
7 changed files:
- devel/TODO
- devel/ifdex-ignores
- − ntpq/libntpq.c
- ntpq/libntpq.h
- − ntpq/libntpq_subs.c
- ntpq/ntpq.c
- ntpq/wscript
Changes:
=====================================
devel/TODO
=====================================
--- a/devel/TODO
+++ b/devel/TODO
@@ -120,10 +120,6 @@ Neither is ideal, easy pickings for someone to code on.
* We might be able to eliminate a lot of the Linux runtime
droproot code by using file capabilities.
-* There is a mess around the symbols NO_MAIN_ALLOWED, BUILD_AS_LIB, and
- LIBNTP_C that needs to be refactored. ntpd should *always* be built as
- a library linked to a main module, these guard symbols should go away.
-
* Use the snprintb in util/ntptime for flag words like flash
codes and use it systematically to make reports more readable.
=====================================
devel/ifdex-ignores
=====================================
--- a/devel/ifdex-ignores
+++ b/devel/ifdex-ignores
@@ -17,10 +17,7 @@ ENABLE_KILL_ON_TRAP # Die on seccomp trap
MSSNTP_PATH # Set a default path for the MSSNTP feature.
NTP_VAR # Path to NTP statistics directory
-# These are cruft having to do with the way libntpq is presently built.
-# They should go away and be replaced by better module factoring.
-BUILD_AS_LIB # Set -DNO_MAIN_ALLOWED -DBUILD_AS_LIB to build libntq.a
-LIBNTPQ_C # Involved in library build.
+# Formerly used on some embedded systems. Kepr around in case of re-port
NO_MAIN_ALLOWED # Used to be set by VxWorks.
# System capabilities that waf should detect but does not.
=====================================
ntpq/libntpq.c deleted
=====================================
--- a/ntpq/libntpq.c
+++ /dev/null
@@ -1,774 +0,0 @@
-/*****************************************************************************
- *
- * libntpq.c
- *
- * This is the wrapper library for ntpq, the NTP query utility.
- * This library reuses the sourcecode from ntpq and exports a number
- * of useful functions in a library that can be linked against applications
- * that need to query the status of a running ntpd. The whole
- * communcation is based on mode 6 packets.
- *
- ****************************************************************************/
-#define LIBNTPQ_C
-#define NO_MAIN_ALLOWED 1
-/* #define BUILD_AS_LIB Already provided by the Makefile */
-
-#include "ntpq.c"
-#include "libntpq.h"
-
-/* Function Prototypes */
-
-
-const char *Version = "libntpq 0.3beta";
-
-/* global variables used for holding snapshots of data */
-char peervars[NTPQ_BUFLEN];
-int peervarlen = 0;
-associd_t peervar_assoc = 0;
-char clockvars[NTPQ_BUFLEN];
-int clockvarlen = 0;
-int clockvar_assoc = 0;
-char sysvars[NTPQ_BUFLEN];
-int sysvarlen = 0;
-char *ntpq_resultbuffer[NTPQ_BUFLEN];
-unsigned short ntpq_associations[MAXASSOC];
-struct ntpq_varlist ntpq_varlist[MAXLIST];
-
-/*****************************************************************************
- *
- * ntpq_stripquotes
- *
- * Parses a given character buffer srcbuf and removes all quoted
- * characters. The resulting string is copied to the specified
- * resultbuf character buffer. E.g. \" will be translated into "
- *
- ****************************************************************************
- * Parameters:
- * resultbuf char* The resulting string without quoted
- * characters
- * srcbuf char* The buffer holding the original string
- * datalen int The number of bytes stored in srcbuf
- * maxlen int Max. number of bytes for resultbuf
- *
- * Returns:
- * int number of chars that have been copied to
- * resultbuf
- ****************************************************************************/
-
-int ntpq_stripquotes ( char *resultbuf, char *srcbuf, int datalen, int maxlen )
-{
- char* tmpbuf = srcbuf;
-
- UNUSED_ARG(datalen);
- UNUSED_ARG(maxlen);
-
- while ( *tmpbuf != 0 )
- {
- if ( *tmpbuf == '\"' )
- {
- tmpbuf++;
- continue;
- }
-
- if ( *tmpbuf == '\\' )
- {
- tmpbuf++;
- switch ( *tmpbuf )
- {
- /* ignore if end of string */
- case 0:
- continue;
- /* skip and do not copy */
- case '\"': /* quotes */
- case 'n': /*newline*/
- case 'r': /*carriage return*/
- case 'g': /*bell*/
- case 't': /*tab*/
- tmpbuf++;
- continue;
- }
- }
-
- *resultbuf++ = *tmpbuf++;
-
- }
-
- *resultbuf = 0;
- return strlen(resultbuf);
-}
-
-
-/*****************************************************************************
- *
- * ntpq_getvar
- *
- * This function parses a given buffer for a variable/value pair and
- * copies the value of the requested variable into the specified
- * varvalue buffer.
- *
- * It returns the number of bytes copied or zero for an empty result
- * (=no matching variable found or empty value)
- *
- ****************************************************************************
- * Parameters:
- * resultbuf char* The resulting string without quoted
- * characters
- * datalen size_t The number of bytes stored in
- * resultbuf
- * varname char* Name of the required variable
- * varvalue char* Where the value of the variable should
- * be stored
- * maxlen size_t Max. number of bytes for varvalue
- *
- * Returns:
- * size_t number of chars that have been copied to
- * varvalue
- ****************************************************************************/
-
-size_t
-ntpq_getvar(
- const char * resultbuf,
- size_t datalen,
- const char * varname,
- char * varvalue,
- size_t maxlen)
-{
- char * name;
- char * value;
- int idatalen;
-
- value = NULL;
- idatalen = (int)datalen;
-
- while (nextvar(&idatalen, &resultbuf, &name, &value)) {
- if (strcmp(varname, name) == 0) {
- ntpq_stripquotes(varvalue, value, strlen(value), maxlen);
-
- return strlen(varvalue);
- }
- }
-
- return 0;
-}
-
-
-/*****************************************************************************
- *
- * ntpq_queryhost
- *
- * Sends a mode 6 query packet to the current open host (see
- * ntpq_openhost) and stores the requested variable set in the specified
- * character buffer.
- * It returns the number of bytes read or zero for an empty result
- * (=no answer or empty value)
- *
- ****************************************************************************
- * Parameters:
- * VARSET u_short Which variable set should be
- * read (PEERVARS or CLOCKVARS)
- * association int The association ID that should be read
- * 0 represents the ntpd instance itself
- * resultbuf char* The resulting string without quoted
- * characters
- * maxlen int Max. number of bytes for varvalue
- *
- * Returns:
- * int number of bytes that have been copied to
- * resultbuf
- * - OR -
- * 0 (zero) if no reply has been received or
- * another failure occured
- ****************************************************************************/
-
-int ntpq_queryhost(unsigned short VARSET, unsigned short association, char *resultbuf, int maxlen)
-{
- const char *datap;
- int res;
- int dsize;
- u_short rstatus;
-
- if ( numhosts > 0 )
- res = doquery(VARSET,association,0,0, (char *)0, &rstatus, &dsize, &datap);
- else
- return 0;
-
- if ( ( res != 0) || ( dsize == 0 ) ) /* no data */
- return 0;
-
- if ( dsize > maxlen)
- dsize = maxlen;
-
-
- /* fill result resultbuf */
- memcpy(resultbuf, datap, dsize);
-
- return dsize;
-}
-
-
-
-/*****************************************************************************
- *
- * ntpq_openhost
- *
- * Sets up a connection to the ntpd instance of a specified host. Note:
- * There is no real "connection" established because NTP solely works
- * based on UDP.
- *
- ****************************************************************************
- * Parameters:
- * hostname char* Hostname/IP of the host running ntpd
- * fam int Address Family (AF_INET, AF_INET6, or 0)
- *
- * Returns:
- * int 1 if the host connection could be set up, i.e.
- * name resolution was succesful and/or IP address
- * has been validated
- * - OR -
- * 0 (zero) if a failure occured
- ****************************************************************************/
-
-int
-ntpq_openhost(
- char *hostname,
- int fam
- )
-{
- if ( openhost(hostname, fam) )
- {
- numhosts = 1;
- } else {
- numhosts = 0;
- }
-
- return numhosts;
-
-}
-
-
-/*****************************************************************************
- *
- * ntpq_closehost
- *
- * Cleans up a connection by closing the used socket. Should be called
- * when no further queries are required for the currently used host.
- *
- ****************************************************************************
- * Parameters:
- * - none -
- *
- * Returns:
- * int 0 (zero) if no host has been opened before
- * - OR -
- * the resultcode from the close function call
- ****************************************************************************/
-
-int ntpq_closehost(void)
-{
- if ( numhosts )
- return close(sockfd);
-
- return 0;
-}
-
-
-/*****************************************************************************
- *
- * ntpq_read_associations
- *
- * This function queries the ntp host for its associations and returns the
- * number of associations found.
- *
- * It takes an u_short array as its first parameter, this array holds the
- * IDs of the associations,
- * the function will not write more entries than specified with the
- * max_entries parameter.
- *
- * However, if more than max_entries associations were found, the return
- * value of this function will reflect the real number, even if not all
- * associations have been stored in the array.
- *
- ****************************************************************************
- * Parameters:
- * resultbuf u_short*Array that should hold the list of
- * association IDs
- * maxentries int maximum number of association IDs that can
- * be stored in resultbuf
- *
- * Returns:
- * int number of association IDs stored in resultbuf
- * - OR -
- * 0 (zero) if a failure occured or no association has
- * been returned.
- ****************************************************************************/
-
-int ntpq_read_associations ( u_short resultbuf[], int max_entries )
-{
- int i = 0;
-
- if (ntpq_dogetassoc()) {
-
- if((int)numassoc < max_entries)
- max_entries = numassoc;
-
- for (i=0;i<max_entries;i++)
- resultbuf[i] = assoc_cache[i].assid;
-
- return numassoc;
- }
-
- return 0;
-}
-
-
-
-
-/*****************************************************************************
- *
- * ntpq_get_assocs
- *
- * This function reads the associations of a previously selected (with
- * ntpq_openhost) NTP host into its own (global) array and returns the
- * number of associations found.
- *
- * The obtained association IDs can be read by using the ntpq_get_assoc_id
- * function.
- *
- ****************************************************************************
- * Parameters:
- * - none -
- *
- * Returns:
- * int number of association IDs stored in resultbuf
- * - OR -
- * 0 (zero) if a failure occured or no association has
- * been returned.
- ****************************************************************************/
-
- int ntpq_get_assocs ( void )
-{
- return ntpq_read_associations( ntpq_associations, MAXASSOC );
-}
-
-
-/*****************************************************************************
- *
- * ntpq_get_assoc_number
- *
- * This function returns for a given Association ID the association number
- * in the internal association array, which is filled by the ntpq_get_assocs
- * function.
- *
- ****************************************************************************
- * Parameters:
- * associd int requested associaton ID
- *
- * Returns:
- * int the number of the association array element that is
- * representing the given association ID
- * - OR -
- * -1 if a failure occured or no matching association
- * ID has been found
- ****************************************************************************/
-
-int ntpq_get_assoc_number ( associd_t associd )
-{
- u_int i;
-
- for (i=0;i<numassoc;i++) {
- if (assoc_cache[i].assid == associd)
- return i;
- }
-
- return -1;
-
-}
-
-
-/*****************************************************************************
- *
- * ntpq_read_assoc_peervars
- *
- * This function reads the peervars variable-set of a specified association
- * from a NTP host and writes it to the result buffer specified, honoring
- * the maxsize limit.
- *
- * It returns the number of bytes written or 0 when the variable-set is
- * empty or failed to read.
- *
- ****************************************************************************
- * Parameters:
- * associd int requested associaton ID
- * resultbuf char* character buffer where the variable set
- * should be stored
- * maxsize int the maximum number of bytes that can be
- * written to resultbuf
- *
- * Returns:
- * int number of chars that have been copied to
- * resultbuf
- * - OR -
- * 0 (zero) if an error occured
- ****************************************************************************/
-
-int
-ntpq_read_assoc_peervars(
- associd_t associd,
- char * resultbuf,
- int maxsize
- )
-{
- const char * datap;
- int res;
- int dsize;
- u_short rstatus;
-
- res = doquery(CTL_OP_READVAR, associd, 0, 0, NULL, &rstatus,
- &dsize, &datap);
- if (res != 0)
- return 0;
- if (dsize <= 0) {
- if (numhosts > 1)
- fprintf(stderr, "server=%s ", currenthost);
- fprintf(stderr,
- "***No information returned for association %d\n",
- associd);
-
- return 0;
- }
- if (dsize > maxsize)
- dsize = maxsize;
- memcpy(resultbuf, datap, dsize);
-
- return dsize;
-}
-
-
-
-
-/*****************************************************************************
- *
- * ntpq_read_sysvars
- *
- * This function reads the sysvars variable-set from a NTP host and writes it
- * to the result buffer specified, honoring the maxsize limit.
- *
- * It returns the number of bytes written or 0 when the variable-set is empty
- * or could not be read.
- *
- ****************************************************************************
- * Parameters:
- * resultbuf char* character buffer where the variable set
- * should be stored
- * maxsize int the maximum number of bytes that can be
- * written to resultbuf
- *
- * Returns:
- * int number of chars that have been copied to
- * resultbuf
- * - OR -
- * 0 (zero) if an error occured
- ****************************************************************************/
-size_t
-ntpq_read_sysvars(
- char * resultbuf,
- size_t maxsize
- )
-{
- const char * datap;
- int res;
- int i_dsize;
- size_t dsize;
- u_short rstatus;
-
- res = doquery(CTL_OP_READVAR, 0, 0, 0, NULL, &rstatus,
- &i_dsize, &datap);
-
- if (res != 0)
- return 0;
-
- if (i_dsize == 0) {
- if (numhosts > 1)
- fprintf(stderr, "server=%s ", currenthost);
- fprintf(stderr, "***No sysvar information returned\n");
-
- return 0;
- } else {
- dsize = max(0, i_dsize);
- dsize = min(dsize, maxsize);
- memcpy(resultbuf, datap, dsize);
- }
-
- return dsize;
-}
-
-
-/*****************************************************************************
- * ntpq_get_assoc_allvars
- *
- * With this function all association variables for the specified association
- * ID can be requested from a NTP host. They are stored internally and can be
- * read by using the ntpq_get_peervar or ntpq_get_clockvar functions.
- *
- * Basically this is only a combination of the ntpq_get_assoc_peervars and
- * ntpq_get_assoc_clockvars functions.
- *
- * It returns 1 if both variable-sets (peervars and clockvars) were
- * received successfully. If one variable-set or both of them weren't
- * received,
- *
- ****************************************************************************
- * Parameters:
- * associd int requested associaton ID
- *
- * Returns:
- * int nonzero if at least one variable set could be read
- * - OR -
- * 0 (zero) if an error occured and both variable sets
- * could not be read
- ****************************************************************************/
- int ntpq_get_assoc_allvars( associd_t associd )
-{
- return ntpq_get_assoc_peervars ( associd ) &
- ntpq_get_assoc_clockvars( associd );
-}
-
-
-
-
-/*****************************************************************************
- *
- * ntpq_get_sysvars
- *
- * The system variables of a NTP host can be requested by using this function
- * and afterwards using ntpq_get_sysvar to read the single variable values.
- *
- ****************************************************************************
- * Parameters:
- * - none -
- *
- * Returns:
- * bool true if the variable set could be read
- * - OR -
- * false (zero) if an error occured and the sysvars
- * could not be read
- ****************************************************************************/
-bool
-ntpq_get_sysvars(void)
-{
- sysvarlen = ntpq_read_sysvars(sysvars, sizeof(sysvars));
- if (sysvarlen <= 0)
- return false;
- else
- return true;
-}
-
-
-/*****************************************************************************
- *
- * ntp_get_peervar
- *
- * This function uses the variable-set which was read by using
- * ntp_get_peervars and searches for a variable specified with varname. If
- * such a variable exists, it writes its value into
- * varvalue (maxlen specifies the size of this target buffer).
- *
- ****************************************************************************
- * Parameters:
- * varname char* requested variable name
- * varvalue char* the buffer where the value should go into
- * maxlen int maximum number of bytes that can be copied to
- * varvalue
- *
- * Returns:
- * int number of bytes copied to varvalue
- * - OR -
- * 0 (zero) if an error occured or the variable could
- * not be found
- ****************************************************************************/
-int ntpq_get_peervar( const char *varname, char *varvalue, int maxlen)
-{
- return ( ntpq_getvar(peervars,peervarlen,varname,varvalue,maxlen) );
-}
-
-
-
-/*****************************************************************************
- *
- * ntpq_get_assoc_peervars
- *
- * This function requests the peer variables of the specified association
- * from a NTP host. In order to access the variable values, the function
- * ntpq_get_peervar must be used.
- *
- ****************************************************************************
- * Parameters:
- * associd int requested associaton ID
- *
- * Returns:
- * bool true if the peervars have been read
- * - OR -
- * false if an error occured and the variable set
- * could not be read
- ****************************************************************************/
-bool
-ntpq_get_assoc_peervars(
- associd_t associd
- )
-{
- peervarlen = ntpq_read_assoc_peervars(associd, peervars,
- sizeof(peervars));
- if (peervarlen <= 0) {
- peervar_assoc = 0;
-
- return false;
- }
- peervar_assoc = associd;
-
- return true;
-}
-
-
-/*****************************************************************************
- *
- * ntp_read_assoc_clockvars
- *
- * This function reads the clockvars variable-set of a specified association
- * from a NTP host and writes it to the result buffer specified, honoring
- * the maxsize limit.
- *
- * It returns the number of bytes written or 0 when the variable-set is
- * empty or failed to read.
- *
- ****************************************************************************
- * Parameters:
- * associd int requested associaton ID
- * resultbuf char* character buffer where the variable set
- * should be stored
- * maxsize int the maximum number of bytes that can be
- * written to resultbuf
- *
- * Returns:
- * int number of chars that have been copied to
- * resultbuf
- * - OR -
- * 0 (zero) if an error occured
- ****************************************************************************/
-
-int
-ntpq_read_assoc_clockvars(
- associd_t associd,
- char * resultbuf,
- int maxsize
- )
-{
- const char *datap;
- int res;
- int dsize;
- u_short rstatus;
-
- res = ntpq_doquerylist(ntpq_varlist, CTL_OP_READCLOCK, associd,
- 0, &rstatus, &dsize, &datap);
- if (res != 0)
- return 0;
-
- if (dsize == 0) {
- if (numhosts > 1) /* no information returned from server */
- return 0;
- } else {
- if (dsize > maxsize)
- dsize = maxsize;
- memcpy(resultbuf, datap, dsize);
- }
-
- return dsize;
-}
-
-
-
-/*****************************************************************************
- *
- * ntpq_get_assoc_clocktype
- *
- * This function returns a clocktype value for a given association number
- * (not ID!):
- *
- * NTP_CLOCKTYPE_UNKNOWN Unknown clock type
- * NTP_CLOCKTYPE_BROADCAST Broadcast server
- * NTP_CLOCKTYPE_LOCAL Local clock
- * NTP_CLOCKTYPE_UNICAST Unicast server
- * NTP_CLOCKTYPE_MULTICAST Multicast server
- *
- ****************************************************************************/
-int
-ntpq_get_assoc_clocktype(
- int assoc_index
- )
-{
- associd_t associd;
- int i;
- int rc;
- sockaddr_u dum_store;
- char dstadr[NI_MAXHOST];
- char resultbuf[NTPQ_BUFLEN];
-
- if (assoc_index < 0 || assoc_index >= (int)numassoc)
- return -1;
-
- associd = assoc_cache[assoc_index].assid;
- if (associd == peervar_assoc) {
- rc = ntpq_get_peervar("dstadr", dstadr, sizeof(dstadr));
- } else {
- i = ntpq_read_assoc_peervars(associd, resultbuf,
- sizeof(resultbuf));
- if (i <= 0)
- return -1;
- rc = ntpq_getvar(resultbuf, i, "dstadr", dstadr,
- sizeof(dstadr));
- }
-
- if (0 != rc && decodenetnum(dstadr, &dum_store))
- return ntpq_decodeaddrtype(&dum_store);
-
- return -1;
-}
-
-
-
-/*****************************************************************************
- *
- * ntpq_get_assoc_clockvars
- *
- * With this function the clock variables of the specified association are
- * requested from a NTP host. This makes only sense for associations with
- * the type 'l' (Local Clock) and you should check this with
- * ntpq_get_assoc_clocktype for each association, before you use this function
- * on it.
- *
- ****************************************************************************
- * Parameters:
- * associd int requested associaton ID
- *
- * Returns:
- * bool true if the clockvars have been read
- * - OR -
- * false if an error occured and the variable set
- * could not be read
- ****************************************************************************/
-bool ntpq_get_assoc_clockvars( associd_t associd )
-{
- if (NTP_CLOCKTYPE_LOCAL != ntpq_get_assoc_clocktype(
- ntpq_get_assoc_number(associd)))
- return false;
- clockvarlen = ntpq_read_assoc_clockvars( associd, clockvars,
- sizeof(clockvars) );
- if ( clockvarlen <= 0 ) {
- clockvar_assoc = 0;
- return false;
- } else {
- clockvar_assoc = associd;
- return true;
- }
-}
-
-
=====================================
ntpq/libntpq.h
=====================================
--- a/ntpq/libntpq.h
+++ b/ntpq/libntpq.h
@@ -56,7 +56,6 @@ struct ntpq_varlist {
};
/* global variables used for holding snapshots of data */
-#ifndef LIBNTPQ_C
extern char peervars[];
extern int peervarlen;
extern int peervar_assoc;
@@ -67,9 +66,6 @@ extern char sysvars[];
extern int sysvarlen;
extern char *ntpq_resultbuffer[];
extern struct ntpq_varlist ntpq_varlist[MAXLIST];
-#endif
-
-
/*
* Prototypes of exported libary functions
=====================================
ntpq/libntpq_subs.c deleted
=====================================
--- a/ntpq/libntpq_subs.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*****************************************************************************
- *
- * libntpq_subs.c
- *
- * This is the second part of the wrapper library for ntpq, the NTP query utility.
- * This library reuses the sourcecode from ntpq and exports a number
- * of useful functions in a library that can be linked against applications
- * that need to query the status of a running ntpd. The whole
- * communcation is based on mode 6 packets.
- *
- * This source file exports the (private) functions from ntpq-subs.c
- *
- ****************************************************************************/
-
-
-#include "ntpq-subs.c"
-#include "libntpq.h"
-
-
-int ntpq_dogetassoc(void)
-{
-
- if (dogetassoc(NULL))
- return numassoc;
- else
- return 0;
-}
-
-/* the following functions are required internally by a number of libntpq functions
- * and since they are defined as static in ntpq-subs.c, they need to be exported here
- */
-
-char ntpq_decodeaddrtype(sockaddr_u *sock)
-{
- return decodeaddrtype(sock);
-}
-
-int
-ntpq_doquerylist(
- struct ntpq_varlist *vlist,
- int op,
- associd_t associd,
- int auth,
- u_short *rstatus,
- int *dsize,
- const char **datap
- )
-{
- return doquerylist((struct varlist *)vlist, op, associd, auth,
- rstatus, dsize, datap);
-}
-
=====================================
ntpq/ntpq.c
=====================================
--- a/ntpq/ntpq.c
+++ b/ntpq/ntpq.c
@@ -148,13 +148,11 @@ static int sendpkt (void *, size_t);
static int getresponse (int, int, u_short *, int *, const char **, int);
static int sendrequest (int, associd_t, int, int, const char *);
static char * tstflags (u_long);
-#ifndef BUILD_AS_LIB
static void getcmds (void);
static void abortcmd (int);
static void docmd (const char *);
static void tokenize (const char *, char **, int *);
static bool getarg (const char *, int, arg_v *);
-#endif /* BUILD_AS_LIB */
static int findcmd (const char *, struct xcmd *,
struct xcmd *, struct xcmd **);
static bool decodearr (char *, int *, l_fp *);
@@ -379,7 +377,6 @@ extern struct xcmd opcmds[];
char *progname;
#ifdef NO_MAIN_ALLOWED
-#ifndef BUILD_AS_LIB
CALL(ntpq,"ntpq",ntpqmain);
void clear_globals(void)
@@ -393,7 +390,6 @@ void clear_globals(void)
numcmds = 0;
numhosts = 0;
}
-#endif /* !BUILD_AS_LIB */
#endif /* NO_MAIN_ALLOWED */
#define ALL_OPTIONS "46c:dhD:inOpVw"
@@ -435,7 +431,6 @@ main(
}
#endif
-#ifndef BUILD_AS_LIB
static void ntpq_usage(void)
{
#define P(x) fputs(x, stderr)
@@ -649,7 +644,6 @@ ntpqmain(
}
return 0;
}
-#endif /* !BUILD_AS_LIB */
/*
* openhost - open a socket to a host
@@ -1460,7 +1454,6 @@ doqueryex(
}
-#ifndef BUILD_AS_LIB
/*
* getcmds - read commands from the standard input and execute them
*/
@@ -1482,10 +1475,7 @@ getcmds(void)
ntp_readline_uninit();
}
-#endif /* !BUILD_AS_LIB */
-
-#if !defined(BUILD_AS_LIB)
/*
* abortcmd - catch interrupts and abort the current command
*/
@@ -1502,10 +1492,7 @@ abortcmd(
(void) fflush(stderr);
if (jump) longjmp(interrupt_buf, 1);
}
-#endif /* !BUILD_AS_LIB */
-
-#ifndef BUILD_AS_LIB
/*
* docmd - decode the command line and execute a command
*/
@@ -1765,8 +1752,6 @@ getarg(
return true;
}
-#endif /* !BUILD_AS_LIB */
-
/*
* findcmd - find a command in a command description table
=====================================
ntpq/wscript
=====================================
--- a/ntpq/wscript
+++ b/ntpq/wscript
@@ -2,17 +2,6 @@ def build(ctx):
srcnode = ctx.srcnode.abspath()
bldnode = ctx.bldnode.abspath()
- libntpq_source = [
- "libntpq.c", #XXX why
- "libntpq_subs.c", #XXX why
- ]
-
- ctx(
- target = "libntpq",
- features = "c bld_include src_include libisc_include",
- source = libntpq_source,
- )
-
ntpq_source = [
"ntpq.c",
"ntpq-subs.c",
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/fd68e6f562589ecf066f0913030f1f792d4ea9c8
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160923/fe0c8227/attachment.html>
More information about the vc
mailing list