From: Danny Mayer Date: Thu, 4 Nov 2004 05:03:35 +0000 (-0500) Subject: Prefix constants with NTP_ to avoid collisions with VS.NET X-Git-Tag: NTP_4_2_0B_RC1~205^2^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=96f19a4bad97b216eb2bcff28bc6a67301a5a4e3;p=thirdparty%2Fntp.git Prefix constants with NTP_ to avoid collisions with VS.NET bk: 4189b827B3ajOV4-a-KUDDncISraqA --- diff --git a/ntpdc/ntpdc.c b/ntpdc/ntpdc.c index c0b3ba4a69..8dcb88639a 100644 --- a/ntpdc/ntpdc.c +++ b/ntpdc/ntpdc.c @@ -19,6 +19,7 @@ #include "isc/result.h" #ifdef SYS_WINNT +#include # include #else # define closesocket close @@ -105,10 +106,10 @@ static struct xcmd builtins[] = { { "help", help, { OPT|NTP_STR, NO, NO, NO }, { "command", "", "", "" }, "tell the use and syntax of commands" }, - { "timeout", timeout, { OPT|UINT, NO, NO, NO }, + { "timeout", timeout, { OPT|NTP_UINT, NO, NO, NO }, { "msec", "", "", "" }, "set the primary receive time out" }, - { "delay", my_delay, { OPT|INT, NO, NO, NO }, + { "delay", my_delay, { OPT|NTP_INT, NO, NO, NO }, { "msec", "", "", "" }, "set the delay added to encryption time stamps" }, { "host", host, { OPT|NTP_STR, OPT|NTP_STR, NO, NO }, @@ -129,7 +130,7 @@ static struct xcmd builtins[] = { { "exit", quit, { NO, NO, NO, NO }, { "", "", "", "" }, "exit ntpdc" }, - { "keyid", keyid, { OPT|UINT, NO, NO, NO }, + { "keyid", keyid, { OPT|NTP_UINT, NO, NO, NO }, { "key#", "", "", "" }, "set/show keyid to use for authenticated requests" }, { "keytype", keytype, { OPT|NTP_STR, NO, NO, NO }, @@ -1317,7 +1318,7 @@ getarg( case NTP_STR: argp->string = str; break; - case ADD: + case NTP_ADD: if (!strcmp("-6", str)) { ai_fam_templ = AF_INET6; return -1; @@ -1329,8 +1330,8 @@ getarg( return 0; } break; - case INT: - case UINT: + case NTP_INT: + case NTP_UINT: isneg = 0; np = str; if (*np == '-') { @@ -1351,7 +1352,7 @@ getarg( } while (*(++np) != '\0'); if (isneg) { - if ((code & ~OPT) == UINT) { + if ((code & ~OPT) == NTP_UINT) { (void) fprintf(stderr, "***Value %s should be unsigned\n", str); return 0; @@ -1553,7 +1554,7 @@ printusage( opt46 = 0; (void) fprintf(fp, "usage: %s", xcp->keyword); for (i = 0; i < MAXARGS && xcp->arg[i] != NO; i++) { - if (opt46 == 0 && (xcp->arg[i] & ~OPT) == ADD) { + if (opt46 == 0 && (xcp->arg[i] & ~OPT) == NTP_ADD) { (void) fprintf(fp, " [ -4|-6 ]"); opt46 = 1; } diff --git a/ntpdc/ntpdc.h b/ntpdc/ntpdc.h index 589529fb1c..d56d2b617b 100644 --- a/ntpdc/ntpdc.h +++ b/ntpdc/ntpdc.h @@ -15,14 +15,14 @@ /* * Flags for forming descriptors. */ -#define OPT 0x80 /* this argument is optional, or'd with type */ +#define OPT 0x80 /* this argument is optional, or'd with type */ -#define NO 0x0 -#define NTP_STR 0x1 /* string argument */ -#define UINT 0x2 /* unsigned integer */ -#define INT 0x3 /* signed integer */ -#define ADD 0x4 /* IP network address */ -#define IP_VERSION 0x5 /* IP version */ +#define NO 0x0 +#define NTP_STR 0x1 /* string argument */ +#define NTP_UINT 0x2 /* unsigned integer */ +#define NTP_INT 0x3 /* signed integer */ +#define NTP_ADD 0x4 /* IP network address */ +#define IP_VERSION 0x5 /* IP version */ /* * Arguments are returned in a union diff --git a/ntpdc/ntpdc_ops.c b/ntpdc/ntpdc_ops.c index 1d4120b59a..7abb977acc 100644 --- a/ntpdc/ntpdc_ops.c +++ b/ntpdc/ntpdc_ops.c @@ -93,10 +93,10 @@ struct xcmd opcmds[] = { { "dmpeers", dmpeers, { OPT|IP_VERSION, NO, NO, NO }, { "-4|-6", "", "", "" }, "display peer summary info the way Dave Mills likes it (IP Version)" }, - { "showpeer", showpeer, { ADD, OPT|ADD, OPT|ADD, OPT|ADD}, + { "showpeer", showpeer, { NTP_ADD, OPT|NTP_ADD, OPT|NTP_ADD, OPT|NTP_ADD}, { "peer_address", "peer2_addr", "peer3_addr", "peer4_addr" }, "display detailed information for one or more peers" }, - { "pstats", peerstats, { ADD, OPT|ADD, OPT|ADD, OPT|ADD }, + { "pstats", peerstats, { NTP_ADD, OPT|NTP_ADD, OPT|NTP_ADD, OPT|NTP_ADD }, { "peer_address", "peer2_addr", "peer3_addr", "peer4_addr" }, "display statistical information for one or more peers" }, { "loopinfo", loopinfo, { OPT|NTP_STR, NO, NO, NO }, @@ -117,19 +117,19 @@ struct xcmd opcmds[] = { { "timerstats", timerstats, { NO, NO, NO, NO }, { "", "", "", "" }, "display event timer subsystem statistics" }, - { "addpeer", addpeer, { ADD, OPT|UINT, OPT|UINT, OPT|NTP_STR }, + { "addpeer", addpeer, { NTP_ADD, OPT|NTP_UINT, OPT|NTP_UINT, OPT|NTP_STR }, { "addr", "keyid", "version", "minpoll|prefer" }, "configure a new peer association" }, - { "addserver", addserver, { ADD, OPT|UINT, OPT|UINT, OPT|NTP_STR }, + { "addserver", addserver, { NTP_ADD, OPT|NTP_UINT, OPT|NTP_UINT, OPT|NTP_STR }, { "addr", "keyid", "version", "minpoll|prefer" }, "configure a new server" }, - { "addrefclock",addrefclock, { ADD, OPT|UINT, OPT|NTP_STR, OPT|NTP_STR }, + { "addrefclock",addrefclock, { NTP_ADD, OPT|NTP_UINT, OPT|NTP_STR, OPT|NTP_STR }, { "addr", "mode", "minpoll|prefer", "minpoll|prefer" }, "configure a new server" }, - { "broadcast", broadcast, { ADD, OPT|UINT, OPT|UINT, OPT|NTP_STR }, + { "broadcast", broadcast, { NTP_ADD, OPT|NTP_UINT, OPT|NTP_UINT, OPT|NTP_STR }, { "addr", "keyid", "version", "minpoll" }, "configure broadcasting time service" }, - { "unconfig", unconfig, { ADD, OPT|ADD, OPT|ADD, OPT|ADD }, + { "unconfig", unconfig, { NTP_ADD, OPT|NTP_ADD, OPT|NTP_ADD, OPT|NTP_ADD }, { "peer_address", "peer2_addr", "peer3_addr", "peer4_addr" }, "unconfigure existing peer assocations" }, { "enable", set, { NTP_STR, OPT|NTP_STR, OPT|NTP_STR, OPT|NTP_STR }, @@ -141,35 +141,35 @@ struct xcmd opcmds[] = { { "reslist", reslist, {OPT|IP_VERSION, NO, NO, NO }, { "-4|-6", "", "", "" }, "display the server's restrict list" }, - { "restrict", new_restrict, { ADD, ADD, NTP_STR, OPT|NTP_STR }, + { "restrict", new_restrict, { NTP_ADD, NTP_ADD, NTP_STR, OPT|NTP_STR }, { "address", "mask", "ntpport|ignore|noserve|notrust|noquery|nomodify|nopeer|version|kod", "..." }, "create restrict entry/add flags to entry" }, - { "unrestrict", unrestrict, { ADD, ADD, NTP_STR, OPT|NTP_STR }, + { "unrestrict", unrestrict, { NTP_ADD, NTP_ADD, NTP_STR, OPT|NTP_STR }, { "address", "mask", "ntpport|ignore|noserve|notrust|noquery|nomodify|nopeer|version|kod", "..." }, "remove flags from a restrict entry" }, - { "delrestrict", delrestrict, { ADD, ADD, OPT|NTP_STR, NO }, + { "delrestrict", delrestrict, { NTP_ADD, NTP_ADD, OPT|NTP_STR, NO }, { "address", "mask", "ntpport", "" }, "delete a restrict entry" }, - { "monlist", monlist, { OPT|INT, NO, NO, NO }, + { "monlist", monlist, { OPT|NTP_INT, NO, NO, NO }, { "version", "", "", "" }, "display data the server's monitor routines have collected" }, { "reset", reset, { NTP_STR, OPT|NTP_STR, OPT|NTP_STR, OPT|NTP_STR }, { "io|sys|mem|timer|auth|allpeers", "...", "...", "..." }, "reset various subsystem statistics counters" }, - { "preset", preset, { ADD, OPT|ADD, OPT|ADD, OPT|ADD }, + { "preset", preset, { NTP_ADD, OPT|NTP_ADD, OPT|NTP_ADD, OPT|NTP_ADD }, { "peer_address", "peer2_addr", "peer3_addr", "peer4_addr" }, "reset stat counters associated with particular peer(s)" }, { "readkeys", readkeys, { NO, NO, NO, NO }, { "", "", "", "" }, "request a reread of the keys file and re-init of system keys" }, - { "trustedkey", trustkey, { UINT, OPT|UINT, OPT|UINT, OPT|UINT }, + { "trustedkey", trustkey, { NTP_UINT, OPT|NTP_UINT, OPT|NTP_UINT, OPT|NTP_UINT }, { "keyid", "keyid", "keyid", "keyid" }, "add one or more key ID's to the trusted list" }, - { "untrustedkey", untrustkey, { UINT, OPT|UINT, OPT|UINT, OPT|UINT }, + { "untrustedkey", untrustkey, { NTP_UINT, OPT|NTP_UINT, OPT|NTP_UINT, OPT|NTP_UINT }, { "keyid", "keyid", "keyid", "keyid" }, "remove one or more key ID's from the trusted list" }, { "authinfo", authinfo, { NO, NO, NO, NO }, @@ -178,28 +178,28 @@ struct xcmd opcmds[] = { { "traps", traps, { NO, NO, NO, NO }, { "", "", "", "" }, "display the traps set in the server" }, - { "addtrap", addtrap, { ADD, OPT|UINT, OPT|ADD, NO }, + { "addtrap", addtrap, { NTP_ADD, OPT|NTP_UINT, OPT|NTP_ADD, NO }, { "address", "port", "interface", "" }, "configure a trap in the server" }, - { "clrtrap", clrtrap, { ADD, OPT|UINT, OPT|ADD, NO }, + { "clrtrap", clrtrap, { NTP_ADD, OPT|NTP_UINT, OPT|NTP_ADD, NO }, { "address", "port", "interface", "" }, "remove a trap (configured or otherwise) from the server" }, - { "requestkey", requestkey, { UINT, NO, NO, NO }, + { "requestkey", requestkey, { NTP_UINT, NO, NO, NO }, { "keyid", "", "", "" }, "change the keyid the server uses to authenticate requests" }, - { "controlkey", controlkey, { UINT, NO, NO, NO }, + { "controlkey", controlkey, { NTP_UINT, NO, NO, NO }, { "keyid", "", "", "" }, "change the keyid the server uses to authenticate control messages" }, { "ctlstats", ctlstats, { NO, NO, NO, NO }, { "", "", "", "" }, "display packet count statistics from the control module" }, - { "clockstat", clockstat, { ADD, OPT|ADD, OPT|ADD, OPT|ADD }, + { "clockstat", clockstat, { NTP_ADD, OPT|NTP_ADD, OPT|NTP_ADD, OPT|NTP_ADD }, { "address", "address", "address", "address" }, "display clock status information" }, - { "fudge", fudge, { ADD, NTP_STR, NTP_STR, NO }, + { "fudge", fudge, { NTP_ADD, NTP_STR, NTP_STR, NO }, { "address", "time1|time2|val1|val2|flags", "value", "" }, "set/change one of a clock's fudge factors" }, - { "clkbug", clkbug, { ADD, OPT|ADD, OPT|ADD, OPT|ADD }, + { "clkbug", clkbug, { NTP_ADD, OPT|NTP_ADD, OPT|NTP_ADD, OPT|NTP_ADD }, { "address", "address", "address", "address" }, "display clock debugging information" }, { "kerninfo", kerninfo, { NO, NO, NO, NO }, diff --git a/ntpq/ntpq.c b/ntpq/ntpq.c index a19f8c111d..ba39866dfe 100644 --- a/ntpq/ntpq.c +++ b/ntpq/ntpq.c @@ -23,6 +23,7 @@ #include "isc/result.h" #ifdef SYS_WINNT +#include # include #else #define closesocket close @@ -285,31 +286,31 @@ static int assoccmp P((struct association *, struct association *)); * Built-in commands we understand */ struct xcmd builtins[] = { - { "?", help, { OPT|STR, NO, NO, NO }, + { "?", help, { OPT|NTP_STR, NO, NO, NO }, { "command", "", "", "" }, "tell the use and syntax of commands" }, - { "help", help, { OPT|STR, NO, NO, NO }, + { "help", help, { OPT|NTP_STR, NO, NO, NO }, { "command", "", "", "" }, "tell the use and syntax of commands" }, - { "timeout", timeout, { OPT|UINT, NO, NO, NO }, + { "timeout", timeout, { OPT|NTP_UINT, NO, NO, NO }, { "msec", "", "", "" }, "set the primary receive time out" }, - { "delay", auth_delay, { OPT|INT, NO, NO, NO }, + { "delay", auth_delay, { OPT|NTP_INT, NO, NO, NO }, { "msec", "", "", "" }, "set the delay added to encryption time stamps" }, - { "host", host, { OPT|STR, OPT|STR, NO, NO }, + { "host", host, { OPT|NTP_STR, OPT|NTP_STR, NO, NO }, { "-4|-6", "hostname", "", "" }, "specify the host whose NTP server we talk to" }, - { "poll", ntp_poll, { OPT|UINT, OPT|STR, NO, NO }, + { "poll", ntp_poll, { OPT|NTP_UINT, OPT|NTP_STR, NO, NO }, { "n", "verbose", "", "" }, "poll an NTP server in client mode `n' times" }, { "passwd", passwd, { NO, NO, NO, NO }, { "", "", "", "" }, "specify a password to use for authenticated requests"}, - { "hostnames", hostnames, { OPT|STR, NO, NO, NO }, + { "hostnames", hostnames, { OPT|NTP_STR, NO, NO, NO }, { "yes|no", "", "", "" }, "specify whether hostnames or net numbers are printed"}, - { "debug", setdebug, { OPT|STR, NO, NO, NO }, + { "debug", setdebug, { OPT|NTP_STR, NO, NO, NO }, { "no|more|less", "", "", "" }, "set/change debugging level" }, { "quit", quit, { NO, NO, NO, NO }, @@ -318,7 +319,7 @@ struct xcmd builtins[] = { { "exit", quit, { NO, NO, NO, NO }, { "", "", "", "" }, "exit ntpq" }, - { "keyid", keyid, { OPT|UINT, NO, NO, NO }, + { "keyid", keyid, { OPT|NTP_UINT, NO, NO, NO }, { "key#", "", "", "" }, "set keyid to use for authenticated requests" }, { "version", version, { NO, NO, NO, NO }, @@ -330,13 +331,13 @@ struct xcmd builtins[] = { { "cooked", cooked, { NO, NO, NO, NO }, { "", "", "", "" }, "do cooked mode variable output" }, - { "authenticate", authenticate, { OPT|STR, NO, NO, NO }, + { "authenticate", authenticate, { OPT|NTP_STR, NO, NO, NO }, { "yes|no", "", "", "" }, "always authenticate requests to this server" }, - { "ntpversion", ntpversion, { OPT|UINT, NO, NO, NO }, + { "ntpversion", ntpversion, { OPT|NTP_UINT, NO, NO, NO }, { "version number", "", "", "" }, "set the NTP version number to use for requests" }, - { "keytype", keytype, { OPT|STR, NO, NO, NO }, + { "keytype", keytype, { OPT|NTP_STR, NO, NO, NO }, { "key type (md5|des)", "", "", "" }, "set key type to use for authenticated requests (des|md5)" }, { 0, 0, { NO, NO, NO, NO }, @@ -1585,16 +1586,16 @@ getarg( static const char *digits = "0123456789"; switch (code & ~OPT) { - case STR: + case NTP_STR: argp->string = str; break; - case ADD: + case NTP_ADD: if (!getnetnum(str, &(argp->netnum), (char *)0, 0)) { return 0; } break; - case INT: - case UINT: + case NTP_INT: + case NTP_UINT: isneg = 0; np = str; if (*np == '&') { @@ -1637,7 +1638,7 @@ getarg( } while (*(++np) != '\0'); if (isneg) { - if ((code & ~OPT) == UINT) { + if ((code & ~OPT) == NTP_UINT) { (void) fprintf(stderr, "***Value %s should be unsigned\n", str); return 0; diff --git a/ntpq/ntpq.h b/ntpq/ntpq.h index 1bb102847f..fbe17662af 100644 --- a/ntpq/ntpq.h +++ b/ntpq/ntpq.h @@ -15,14 +15,17 @@ /* * Flags for forming descriptors. */ -#define OPT 0x80 /* this argument is optional, or'd with type */ +/* + * Flags for forming descriptors. + */ +#define OPT 0x80 /* this argument is optional, or'd with type */ -#define NO 0x0 -#define STR 0x1 /* string argument */ -#define UINT 0x2 /* unsigned integer */ -#define INT 0x3 /* signed integer */ -#define ADD 0x4 /* IP network address */ -#define IP_VERSION 0x5 /* IP address family */ +#define NO 0x0 +#define NTP_STR 0x1 /* string argument */ +#define NTP_UINT 0x2 /* unsigned integer */ +#define NTP_INT 0x3 /* signed integer */ +#define NTP_ADD 0x4 /* IP network address */ +#define IP_VERSION 0x5 /* IP version */ /* * Arguments are returned in a union diff --git a/ntpq/ntpq_ops.c b/ntpq/ntpq_ops.c index a63a81b436..9845509d7e 100644 --- a/ntpq/ntpq_ops.c +++ b/ntpq/ntpq_ops.c @@ -82,10 +82,10 @@ struct xcmd opcmds[] = { { "lpassociations", lpassociations, { NO, NO, NO, NO }, { "", "", "", "" }, "print last obtained list of associations, including client information" }, - { "addvars", addvars, { STR, NO, NO, NO }, + { "addvars", addvars, { NTP_STR, NO, NO, NO }, { "name[=value][,...]", "", "", "" }, "add variables to the variable list or change their values" }, - { "rmvars", rmvars, { STR, NO, NO, NO }, + { "rmvars", rmvars, { NTP_STR, NO, NO, NO }, { "name[,...]", "", "", "" }, "remove variables from the variable list" }, { "clearvars", clearvars, { NO, NO, NO, NO }, @@ -94,49 +94,49 @@ struct xcmd opcmds[] = { { "showvars", showvars, { NO, NO, NO, NO }, { "", "", "", "" }, "print variables on the variable list" }, - { "readlist", readlist, { OPT|UINT, NO, NO, NO }, + { "readlist", readlist, { OPT|NTP_UINT, NO, NO, NO }, { "assocID", "", "", "" }, "read the system or peer variables included in the variable list" }, - { "rl", readlist, { OPT|UINT, NO, NO, NO }, + { "rl", readlist, { OPT|NTP_UINT, NO, NO, NO }, { "assocID", "", "", "" }, "read the system or peer variables included in the variable list" }, - { "writelist", writelist, { OPT|UINT, NO, NO, NO }, + { "writelist", writelist, { OPT|NTP_UINT, NO, NO, NO }, { "assocID", "", "", "" }, "write the system or peer variables included in the variable list" }, - { "readvar", readvar, { OPT|UINT, OPT|STR, NO, NO }, + { "readvar", readvar, { OPT|NTP_UINT, OPT|NTP_STR, NO, NO }, { "assocID", "name=value[,...]", "", "" }, "read system or peer variables" }, - { "rv", readvar, { OPT|UINT, OPT|STR, NO, NO }, + { "rv", readvar, { OPT|NTP_UINT, OPT|NTP_STR, NO, NO }, { "assocID", "name=value[,...]", "", "" }, "read system or peer variables" }, - { "writevar", writevar, { UINT, STR, NO, NO }, + { "writevar", writevar, { NTP_UINT, NTP_STR, NO, NO }, { "assocID", "name=value,[...]", "", "" }, "write system or peer variables" }, - { "mreadlist", mreadlist, { UINT, UINT, NO, NO }, + { "mreadlist", mreadlist, { NTP_UINT, NTP_UINT, NO, NO }, { "assocID", "assocID", "", "" }, "read the peer variables in the variable list for multiple peers" }, - { "mrl", mreadlist, { UINT, UINT, NO, NO }, + { "mrl", mreadlist, { NTP_UINT, NTP_UINT, NO, NO }, { "assocID", "assocID", "", "" }, "read the peer variables in the variable list for multiple peers" }, - { "mreadvar", mreadvar, { UINT, UINT, OPT|STR, NO }, + { "mreadvar", mreadvar, { NTP_UINT, NTP_UINT, OPT|NTP_STR, NO }, { "assocID", "assocID", "name=value[,...]", "" }, "read peer variables from multiple peers" }, - { "mrv", mreadvar, { UINT, UINT, OPT|STR, NO }, + { "mrv", mreadvar, { NTP_UINT, NTP_UINT, OPT|NTP_STR, NO }, { "assocID", "assocID", "name=value[,...]", "" }, "read peer variables from multiple peers" }, - { "clocklist", clocklist, { OPT|UINT, NO, NO, NO }, + { "clocklist", clocklist, { OPT|NTP_UINT, NO, NO, NO }, { "assocID", "", "", "" }, "read the clock variables included in the variable list" }, - { "cl", clocklist, { OPT|UINT, NO, NO, NO }, + { "cl", clocklist, { OPT|NTP_UINT, NO, NO, NO }, { "assocID", "", "", "" }, "read the clock variables included in the variable list" }, - { "clockvar", clockvar, { OPT|UINT, OPT|STR, NO, NO }, + { "clockvar", clockvar, { OPT|NTP_UINT, OPT|NTP_STR, NO, NO }, { "assocID", "name=value[,...]", "", "" }, "read clock variables" }, - { "cv", clockvar, { OPT|UINT, OPT|STR, NO, NO }, + { "cv", clockvar, { OPT|NTP_UINT, OPT|NTP_STR, NO, NO }, { "assocID", "name=value[,...]", "", "" }, "read clock variables" }, - { "pstatus", pstatus, { UINT, NO, NO, NO }, + { "pstatus", pstatus, { NTP_UINT, NO, NO, NO }, { "assocID", "", "", "" }, "print status information returned for a peer" }, { "peers", peers, { OPT|IP_VERSION, NO, NO, NO },