Wed Feb 1 20:48:02 2012 UTC ()
back to WARNS=4 (constify and signedness corrections)


(kardel)
diff -r1.10 -r1.11 src/external/bsd/ntp/Makefile.inc
diff -r1.5 -r1.6 src/external/bsd/ntp/dist/ntpd/ntp_control.c
diff -r1.7 -r1.8 src/external/bsd/ntp/dist/ntpd/ntp_io.c
diff -r1.3 -r1.4 src/external/bsd/ntp/dist/ntpd/ntp_refclock.c
diff -r1.3 -r1.4 src/external/bsd/ntp/dist/ntpd/refclock_jjy.c
diff -r1.1.1.2 -r1.2 src/external/bsd/ntp/dist/ntpd/ntp_restrict.c
diff -r1.4 -r1.5 src/external/bsd/ntp/dist/ntpq/ntpq.c
diff -r1.3 -r1.4 src/external/bsd/ntp/dist/sntp/crypto.c
diff -r1.3 -r1.4 src/external/bsd/ntp/dist/sntp/main.c
diff -r1.3 -r1.4 src/external/bsd/ntp/dist/sntp/networking.h
diff -r1.4 -r1.5 src/external/bsd/ntp/dist/sntp/log.c
diff -r1.5 -r1.6 src/external/bsd/ntp/dist/sntp/networking.c
diff -r1.1.1.2 -r1.2 src/external/bsd/ntp/dist/sntp/libopts/numeric.c
diff -r1.3 -r1.4 src/external/bsd/ntp/dist/sntp/libopts/autoopts/options.h
diff -r1.3 -r1.4 src/external/bsd/ntp/dist/util/ntp-keygen-opts.c

cvs diff -r1.10 -r1.11 src/external/bsd/ntp/Makefile.inc (expand / switch to unified diff)

--- src/external/bsd/ntp/Makefile.inc 2012/02/01 07:46:20 1.10
+++ src/external/bsd/ntp/Makefile.inc 2012/02/01 20:48:01 1.11
@@ -1,27 +1,27 @@ @@ -1,27 +1,27 @@
1# $NetBSD: Makefile.inc,v 1.10 2012/02/01 07:46:20 kardel Exp $ 1# $NetBSD: Makefile.inc,v 1.11 2012/02/01 20:48:01 kardel Exp $
2 2
3.if !defined(NTP_MAKEFILE_INC) 3.if !defined(NTP_MAKEFILE_INC)
4NTP_MAKEFILE_INC=yes 4NTP_MAKEFILE_INC=yes
5 5
6USE_FORT?= yes # network client/server 6USE_FORT?= yes # network client/server
7 7
8CWARNFLAGS+= -Wno-missing-noreturn 8CWARNFLAGS+= -Wno-missing-noreturn
9CWARNFLAGS.clang+= -Wno-unneeded-internal-declaration \ 9CWARNFLAGS.clang+= -Wno-unneeded-internal-declaration \
10 -Wno-format-security \ 10 -Wno-format-security \
11 -Wno-parentheses -Wno-constant-logical-operand 11 -Wno-parentheses -Wno-constant-logical-operand
12 12
13#WARNS?= 4 13WARNS?= 4
14WARNS?= 0 14
15 15
16.include <bsd.own.mk> 16.include <bsd.own.mk>
17 17
18IDIST= ${NETBSDSRCDIR}/external/bsd/ntp/dist 18IDIST= ${NETBSDSRCDIR}/external/bsd/ntp/dist
19NTP_SRCDIR= ${NETBSDSRCDIR}/external/bsd/ntp 19NTP_SRCDIR= ${NETBSDSRCDIR}/external/bsd/ntp
20NTP_HTMLDIR= /usr/share/doc/html/ntp 20NTP_HTMLDIR= /usr/share/doc/html/ntp
21 21
22SYSCONFDIR=/etc 22SYSCONFDIR=/etc
23LOCALSTATEDIR=/var 23LOCALSTATEDIR=/var
24 24
25CPPFLAGS+=-DHAVE_CONFIG_H 25CPPFLAGS+=-DHAVE_CONFIG_H
26CPPFLAGS+=-I${NTP_SRCDIR}/include \ 26CPPFLAGS+=-I${NTP_SRCDIR}/include \
27 -I${IDIST}/include \ 27 -I${IDIST}/include \

cvs diff -r1.5 -r1.6 src/external/bsd/ntp/dist/ntpd/ntp_control.c (expand / switch to unified diff)

--- src/external/bsd/ntp/dist/ntpd/ntp_control.c 2012/02/01 07:46:22 1.5
+++ src/external/bsd/ntp/dist/ntpd/ntp_control.c 2012/02/01 20:48:01 1.6
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ntp_control.c,v 1.5 2012/02/01 07:46:22 kardel Exp $ */ 1/* $NetBSD: ntp_control.c,v 1.6 2012/02/01 20:48:01 kardel Exp $ */
2 2
3/* 3/*
4 * ntp_control.c - respond to control messages and send async traps 4 * ntp_control.c - respond to control messages and send async traps
5 */ 5 */
6 6
7#ifdef HAVE_CONFIG_H 7#ifdef HAVE_CONFIG_H
8# include <config.h> 8# include <config.h>
9#endif 9#endif
10 10
11#include "ntpd.h" 11#include "ntpd.h"
12#include "ntp_io.h" 12#include "ntp_io.h"
13#include "ntp_refclock.h" 13#include "ntp_refclock.h"
14#include "ntp_control.h" 14#include "ntp_control.h"
@@ -690,31 +690,31 @@ process_control( @@ -690,31 +690,31 @@ process_control(
690 690
691 /* 691 /*
692 * Save the addresses for error responses 692 * Save the addresses for error responses
693 */ 693 */
694 numctlreq++; 694 numctlreq++;
695 rmt_addr = &rbufp->recv_srcadr; 695 rmt_addr = &rbufp->recv_srcadr;
696 lcl_inter = rbufp->dstadr; 696 lcl_inter = rbufp->dstadr;
697 pkt = (struct ntp_control *)&rbufp->recv_pkt; 697 pkt = (struct ntp_control *)&rbufp->recv_pkt;
698 698
699 /* 699 /*
700 * If the length is less than required for the header, or 700 * If the length is less than required for the header, or
701 * it is a response or a fragment, ignore this. 701 * it is a response or a fragment, ignore this.
702 */ 702 */
703 if (rbufp->recv_length < CTL_HEADER_LEN 703 if (rbufp->recv_length < (int)CTL_HEADER_LEN
704 || pkt->r_m_e_op & (CTL_RESPONSE|CTL_MORE|CTL_ERROR) 704 || pkt->r_m_e_op & (CTL_RESPONSE|CTL_MORE|CTL_ERROR)
705 || pkt->offset != 0) { 705 || pkt->offset != 0) {
706 DPRINTF(1, ("invalid format in control packet\n")); 706 DPRINTF(1, ("invalid format in control packet\n"));
707 if (rbufp->recv_length < CTL_HEADER_LEN) 707 if (rbufp->recv_length < (int)CTL_HEADER_LEN)
708 numctltooshort++; 708 numctltooshort++;
709 if (pkt->r_m_e_op & CTL_RESPONSE) 709 if (pkt->r_m_e_op & CTL_RESPONSE)
710 numctlinputresp++; 710 numctlinputresp++;
711 if (pkt->r_m_e_op & CTL_MORE) 711 if (pkt->r_m_e_op & CTL_MORE)
712 numctlinputfrag++; 712 numctlinputfrag++;
713 if (pkt->r_m_e_op & CTL_ERROR) 713 if (pkt->r_m_e_op & CTL_ERROR)
714 numctlinputerr++; 714 numctlinputerr++;
715 if (pkt->offset != 0) 715 if (pkt->offset != 0)
716 numctlbadoffset++; 716 numctlbadoffset++;
717 return; 717 return;
718 } 718 }
719 res_version = PKT_VERSION(pkt->li_vn_mode); 719 res_version = PKT_VERSION(pkt->li_vn_mode);
720 if (res_version > NTP_VERSION || res_version < NTP_OLDVERSION) { 720 if (res_version > NTP_VERSION || res_version < NTP_OLDVERSION) {
@@ -1072,52 +1072,52 @@ ctl_putdbl( @@ -1072,52 +1072,52 @@ ctl_putdbl(
1072 const char *tag, 1072 const char *tag,
1073 double ts 1073 double ts
1074 ) 1074 )
1075{ 1075{
1076 register char *cp; 1076 register char *cp;
1077 register const char *cq; 1077 register const char *cq;
1078 char buffer[200]; 1078 char buffer[200];
1079 1079
1080 cp = buffer; 1080 cp = buffer;
1081 cq = tag; 1081 cq = tag;
1082 while (*cq != '\0') 1082 while (*cq != '\0')
1083 *cp++ = *cq++; 1083 *cp++ = *cq++;
1084 *cp++ = '='; 1084 *cp++ = '=';
1085 NTP_INSIST((cp - buffer) < sizeof(buffer)); 1085 NTP_INSIST((cp - buffer) < (int)sizeof(buffer));
1086 snprintf(cp, sizeof(buffer) - (cp - buffer), "%.3f", ts); 1086 snprintf(cp, sizeof(buffer) - (cp - buffer), "%.3f", ts);
1087 cp += strlen(cp); 1087 cp += strlen(cp);
1088 ctl_putdata(buffer, (unsigned)(cp - buffer), 0); 1088 ctl_putdata(buffer, (unsigned)(cp - buffer), 0);
1089} 1089}
1090 1090
1091/* 1091/*
1092 * ctl_putuint - write a tagged unsigned integer into the response 1092 * ctl_putuint - write a tagged unsigned integer into the response
1093 */ 1093 */
1094static void 1094static void
1095ctl_putuint( 1095ctl_putuint(
1096 const char *tag, 1096 const char *tag,
1097 u_long uval 1097 u_long uval
1098 ) 1098 )
1099{ 1099{
1100 register char *cp; 1100 register char *cp;
1101 register const char *cq; 1101 register const char *cq;
1102 char buffer[200]; 1102 char buffer[200];
1103 1103
1104 cp = buffer; 1104 cp = buffer;
1105 cq = tag; 1105 cq = tag;
1106 while (*cq != '\0') 1106 while (*cq != '\0')
1107 *cp++ = *cq++; 1107 *cp++ = *cq++;
1108 1108
1109 *cp++ = '='; 1109 *cp++ = '=';
1110 NTP_INSIST((cp - buffer) < sizeof(buffer)); 1110 NTP_INSIST((cp - buffer) < (int)sizeof(buffer));
1111 snprintf(cp, sizeof(buffer) - (cp - buffer), "%lu", uval); 1111 snprintf(cp, sizeof(buffer) - (cp - buffer), "%lu", uval);
1112 cp += strlen(cp); 1112 cp += strlen(cp);
1113 ctl_putdata(buffer, (unsigned)( cp - buffer ), 0); 1113 ctl_putdata(buffer, (unsigned)( cp - buffer ), 0);
1114} 1114}
1115 1115
1116/* 1116/*
1117 * ctl_putfs - write a decoded filestamp into the response 1117 * ctl_putfs - write a decoded filestamp into the response
1118 */ 1118 */
1119static void 1119static void
1120ctl_putfs( 1120ctl_putfs(
1121 const char *tag, 1121 const char *tag,
1122 tstamp_t uval 1122 tstamp_t uval
1123 ) 1123 )
@@ -1128,27 +1128,27 @@ ctl_putfs( @@ -1128,27 +1128,27 @@ ctl_putfs(
1128 struct tm *tm = NULL; 1128 struct tm *tm = NULL;
1129 time_t fstamp; 1129 time_t fstamp;
1130 1130
1131 cp = buffer; 1131 cp = buffer;
1132 cq = tag; 1132 cq = tag;
1133 while (*cq != '\0') 1133 while (*cq != '\0')
1134 *cp++ = *cq++; 1134 *cp++ = *cq++;
1135 1135
1136 *cp++ = '='; 1136 *cp++ = '=';
1137 fstamp = uval - JAN_1970; 1137 fstamp = uval - JAN_1970;
1138 tm = gmtime(&fstamp); 1138 tm = gmtime(&fstamp);
1139 if (NULL == tm) 1139 if (NULL == tm)
1140 return; 1140 return;
1141 NTP_INSIST((cp - buffer) < sizeof(buffer)); 1141 NTP_INSIST((cp - buffer) < (int)sizeof(buffer));
1142 snprintf(cp, sizeof(buffer) - (cp - buffer), 1142 snprintf(cp, sizeof(buffer) - (cp - buffer),
1143 "%04d%02d%02d%02d%02d", tm->tm_year + 1900, 1143 "%04d%02d%02d%02d%02d", tm->tm_year + 1900,
1144 tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min); 1144 tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min);
1145 cp += strlen(cp); 1145 cp += strlen(cp);
1146 ctl_putdata(buffer, (unsigned)( cp - buffer ), 0); 1146 ctl_putdata(buffer, (unsigned)( cp - buffer ), 0);
1147} 1147}
1148 1148
1149 1149
1150/* 1150/*
1151 * ctl_puthex - write a tagged unsigned integer, in hex, into the 1151 * ctl_puthex - write a tagged unsigned integer, in hex, into the
1152 * response 1152 * response
1153 */ 1153 */
1154static void 1154static void
@@ -1157,79 +1157,79 @@ ctl_puthex( @@ -1157,79 +1157,79 @@ ctl_puthex(
1157 u_long uval 1157 u_long uval
1158 ) 1158 )
1159{ 1159{
1160 register char *cp; 1160 register char *cp;
1161 register const char *cq; 1161 register const char *cq;
1162 char buffer[200]; 1162 char buffer[200];
1163 1163
1164 cp = buffer; 1164 cp = buffer;
1165 cq = tag; 1165 cq = tag;
1166 while (*cq != '\0') 1166 while (*cq != '\0')
1167 *cp++ = *cq++; 1167 *cp++ = *cq++;
1168 1168
1169 *cp++ = '='; 1169 *cp++ = '=';
1170 NTP_INSIST((cp - buffer) < sizeof(buffer)); 1170 NTP_INSIST((cp - buffer) < (int)sizeof(buffer));
1171 snprintf(cp, sizeof(buffer) - (cp - buffer), "0x%lx", uval); 1171 snprintf(cp, sizeof(buffer) - (cp - buffer), "0x%lx", uval);
1172 cp += strlen(cp); 1172 cp += strlen(cp);
1173 ctl_putdata(buffer,(unsigned)( cp - buffer ), 0); 1173 ctl_putdata(buffer,(unsigned)( cp - buffer ), 0);
1174} 1174}
1175 1175
1176 1176
1177/* 1177/*
1178 * ctl_putint - write a tagged signed integer into the response 1178 * ctl_putint - write a tagged signed integer into the response
1179 */ 1179 */
1180static void 1180static void
1181ctl_putint( 1181ctl_putint(
1182 const char *tag, 1182 const char *tag,
1183 long ival 1183 long ival
1184 ) 1184 )
1185{ 1185{
1186 register char *cp; 1186 register char *cp;
1187 register const char *cq; 1187 register const char *cq;
1188 char buffer[200]; 1188 char buffer[200];
1189 1189
1190 cp = buffer; 1190 cp = buffer;
1191 cq = tag; 1191 cq = tag;
1192 while (*cq != '\0') 1192 while (*cq != '\0')
1193 *cp++ = *cq++; 1193 *cp++ = *cq++;
1194 1194
1195 *cp++ = '='; 1195 *cp++ = '=';
1196 NTP_INSIST((cp - buffer) < sizeof(buffer)); 1196 NTP_INSIST((cp - buffer) < (int)sizeof(buffer));
1197 snprintf(cp, sizeof(buffer) - (cp - buffer), "%ld", ival); 1197 snprintf(cp, sizeof(buffer) - (cp - buffer), "%ld", ival);
1198 cp += strlen(cp); 1198 cp += strlen(cp);
1199 ctl_putdata(buffer, (unsigned)( cp - buffer ), 0); 1199 ctl_putdata(buffer, (unsigned)( cp - buffer ), 0);
1200} 1200}
1201 1201
1202 1202
1203/* 1203/*
1204 * ctl_putts - write a tagged timestamp, in hex, into the response 1204 * ctl_putts - write a tagged timestamp, in hex, into the response
1205 */ 1205 */
1206static void 1206static void
1207ctl_putts( 1207ctl_putts(
1208 const char *tag, 1208 const char *tag,
1209 l_fp *ts 1209 l_fp *ts
1210 ) 1210 )
1211{ 1211{
1212 register char *cp; 1212 register char *cp;
1213 register const char *cq; 1213 register const char *cq;
1214 char buffer[200]; 1214 char buffer[200];
1215 1215
1216 cp = buffer; 1216 cp = buffer;
1217 cq = tag; 1217 cq = tag;
1218 while (*cq != '\0') 1218 while (*cq != '\0')
1219 *cp++ = *cq++; 1219 *cp++ = *cq++;
1220 1220
1221 *cp++ = '='; 1221 *cp++ = '=';
1222 NTP_INSIST((cp - buffer) < sizeof(buffer)); 1222 NTP_INSIST((cp - buffer) < (int)sizeof(buffer));
1223 snprintf(cp, sizeof(buffer) - (cp - buffer), "0x%08lx.%08lx", 1223 snprintf(cp, sizeof(buffer) - (cp - buffer), "0x%08lx.%08lx",
1224 ts->l_ui & 0xffffffffUL, ts->l_uf & 0xffffffffUL); 1224 ts->l_ui & 0xffffffffUL, ts->l_uf & 0xffffffffUL);
1225 cp += strlen(cp); 1225 cp += strlen(cp);
1226 ctl_putdata(buffer, (unsigned)( cp - buffer ), 0); 1226 ctl_putdata(buffer, (unsigned)( cp - buffer ), 0);
1227} 1227}
1228 1228
1229 1229
1230/* 1230/*
1231 * ctl_putadr - write an IP address into the response 1231 * ctl_putadr - write an IP address into the response
1232 */ 1232 */
1233static void 1233static void
1234ctl_putadr( 1234ctl_putadr(
1235 const char *tag, 1235 const char *tag,
@@ -1241,27 +1241,27 @@ ctl_putadr( @@ -1241,27 +1241,27 @@ ctl_putadr(
1241 register const char *cq; 1241 register const char *cq;
1242 char buffer[200]; 1242 char buffer[200];
1243 1243
1244 cp = buffer; 1244 cp = buffer;
1245 cq = tag; 1245 cq = tag;
1246 while (*cq != '\0') 1246 while (*cq != '\0')
1247 *cp++ = *cq++; 1247 *cp++ = *cq++;
1248 1248
1249 *cp++ = '='; 1249 *cp++ = '=';
1250 if (NULL == addr) 1250 if (NULL == addr)
1251 cq = numtoa(addr32); 1251 cq = numtoa(addr32);
1252 else 1252 else
1253 cq = stoa(addr); 1253 cq = stoa(addr);
1254 NTP_INSIST((cp - buffer) < sizeof(buffer)); 1254 NTP_INSIST((cp - buffer) < (int)sizeof(buffer));
1255 snprintf(cp, sizeof(buffer) - (cp - buffer), "%s", cq); 1255 snprintf(cp, sizeof(buffer) - (cp - buffer), "%s", cq);
1256 cp += strlen(cp); 1256 cp += strlen(cp);
1257 ctl_putdata(buffer, (unsigned)(cp - buffer), 0); 1257 ctl_putdata(buffer, (unsigned)(cp - buffer), 0);
1258} 1258}
1259 1259
1260 1260
1261/* 1261/*
1262 * ctl_putrefid - send a u_int32 refid as printable text 1262 * ctl_putrefid - send a u_int32 refid as printable text
1263 */ 1263 */
1264static void 1264static void
1265ctl_putrefid( 1265ctl_putrefid(
1266 const char * tag, 1266 const char * tag,
1267 u_int32 refid 1267 u_int32 refid
@@ -1278,27 +1278,27 @@ ctl_putrefid( @@ -1278,27 +1278,27 @@ ctl_putrefid(
1278 oplim = output + sizeof(output); 1278 oplim = output + sizeof(output);
1279 while (optr < oplim && '\0' != *tag) 1279 while (optr < oplim && '\0' != *tag)
1280 *optr++ = *tag++; 1280 *optr++ = *tag++;
1281 if (optr < oplim) { 1281 if (optr < oplim) {
1282 *optr++ = '='; 1282 *optr++ = '=';
1283 past_eq = optr; 1283 past_eq = optr;
1284 } 1284 }
1285 if (!(optr < oplim)) 1285 if (!(optr < oplim))
1286 return; 1286 return;
1287 iptr = (char *)&refid; 1287 iptr = (char *)&refid;
1288 iplim = iptr + sizeof(refid); 1288 iplim = iptr + sizeof(refid);
1289 for ( ; optr < oplim && iptr < iplim && '\0' != *iptr;  1289 for ( ; optr < oplim && iptr < iplim && '\0' != *iptr;
1290 iptr++, optr++) 1290 iptr++, optr++)
1291 if (isprint(*iptr)) 1291 if (isprint((int)*iptr))
1292 *optr = *iptr; 1292 *optr = *iptr;
1293 else 1293 else
1294 *optr = '.'; 1294 *optr = '.';
1295 if (!(optr <= oplim)) 1295 if (!(optr <= oplim))
1296 optr = past_eq; 1296 optr = past_eq;
1297 ctl_putdata(output, (u_int)(optr - output), FALSE); 1297 ctl_putdata(output, (u_int)(optr - output), FALSE);
1298} 1298}
1299 1299
1300 1300
1301/* 1301/*
1302 * ctl_putarray - write a tagged eight element double array into the response 1302 * ctl_putarray - write a tagged eight element double array into the response
1303 */ 1303 */
1304static void 1304static void
@@ -1311,27 +1311,27 @@ ctl_putarray( @@ -1311,27 +1311,27 @@ ctl_putarray(
1311 register char *cp; 1311 register char *cp;
1312 register const char *cq; 1312 register const char *cq;
1313 char buffer[200]; 1313 char buffer[200];
1314 int i; 1314 int i;
1315 cp = buffer; 1315 cp = buffer;
1316 cq = tag; 1316 cq = tag;
1317 while (*cq != '\0') 1317 while (*cq != '\0')
1318 *cp++ = *cq++; 1318 *cp++ = *cq++;
1319 i = start; 1319 i = start;
1320 do { 1320 do {
1321 if (i == 0) 1321 if (i == 0)
1322 i = NTP_SHIFT; 1322 i = NTP_SHIFT;
1323 i--; 1323 i--;
1324 NTP_INSIST((cp - buffer) < sizeof(buffer)); 1324 NTP_INSIST((cp - buffer) < (int)sizeof(buffer));
1325 snprintf(cp, sizeof(buffer) - (cp - buffer), 1325 snprintf(cp, sizeof(buffer) - (cp - buffer),
1326 " %.2f", arr[i] * 1e3); 1326 " %.2f", arr[i] * 1e3);
1327 cp += strlen(cp); 1327 cp += strlen(cp);
1328 } while(i != start); 1328 } while(i != start);
1329 ctl_putdata(buffer, (unsigned)(cp - buffer), 0); 1329 ctl_putdata(buffer, (unsigned)(cp - buffer), 0);
1330} 1330}
1331 1331
1332 1332
1333/* 1333/*
1334 * ctl_putsys - output a system variable 1334 * ctl_putsys - output a system variable
1335 */ 1335 */
1336static void 1336static void
1337ctl_putsys( 1337ctl_putsys(

cvs diff -r1.7 -r1.8 src/external/bsd/ntp/dist/ntpd/ntp_io.c (expand / switch to unified diff)

--- src/external/bsd/ntp/dist/ntpd/ntp_io.c 2012/02/01 07:46:22 1.7
+++ src/external/bsd/ntp/dist/ntpd/ntp_io.c 2012/02/01 20:48:01 1.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ntp_io.c,v 1.7 2012/02/01 07:46:22 kardel Exp $ */ 1/* $NetBSD: ntp_io.c,v 1.8 2012/02/01 20:48:01 kardel Exp $ */
2 2
3/* 3/*
4 * ntp_io.c - input/output routines for ntpd. The socket-opening code 4 * ntp_io.c - input/output routines for ntpd. The socket-opening code
5 * was shamelessly stolen from ntpd. 5 * was shamelessly stolen from ntpd.
6 */ 6 */
7 7
8#ifdef HAVE_CONFIG_H 8#ifdef HAVE_CONFIG_H
9# include <config.h> 9# include <config.h>
10#endif 10#endif
11 11
12#include <stdio.h> 12#include <stdio.h>
13#include <signal.h> 13#include <signal.h>
14#ifdef HAVE_SYS_PARAM_H 14#ifdef HAVE_SYS_PARAM_H
@@ -199,27 +199,27 @@ static isc_boolean_t is_anycast (sockad @@ -199,27 +199,27 @@ static isc_boolean_t is_anycast (sockad
199 const char *); 199 const char *);
200 200
201/* 201/*
202 * Not all platforms support multicast 202 * Not all platforms support multicast
203 */ 203 */
204#ifdef MCAST 204#ifdef MCAST
205static isc_boolean_t socket_multicast_enable (endpt *, sockaddr_u *); 205static isc_boolean_t socket_multicast_enable (endpt *, sockaddr_u *);
206static isc_boolean_t socket_multicast_disable(endpt *, sockaddr_u *); 206static isc_boolean_t socket_multicast_disable(endpt *, sockaddr_u *);
207#endif 207#endif
208 208
209#ifdef DEBUG 209#ifdef DEBUG
210static void interface_dump (const endpt *); 210static void interface_dump (const endpt *);
211static void sockaddr_dump (const sockaddr_u *); 211static void sockaddr_dump (const sockaddr_u *);
212static void print_interface (const endpt *, char *, char *); 212static void print_interface (const endpt *, const char *, const char *);
213#define DPRINT_INTERFACE(level, args) do { if (debug >= (level)) { print_interface args; } } while (0) 213#define DPRINT_INTERFACE(level, args) do { if (debug >= (level)) { print_interface args; } } while (0)
214#else 214#else
215#define DPRINT_INTERFACE(level, args) do {} while (0) 215#define DPRINT_INTERFACE(level, args) do {} while (0)
216#endif 216#endif
217 217
218typedef struct vsock vsock_t; 218typedef struct vsock vsock_t;
219enum desc_type { FD_TYPE_SOCKET, FD_TYPE_FILE }; 219enum desc_type { FD_TYPE_SOCKET, FD_TYPE_FILE };
220 220
221struct vsock { 221struct vsock {
222 vsock_t * link; 222 vsock_t * link;
223 SOCKET fd; 223 SOCKET fd;
224 enum desc_type type; 224 enum desc_type type;
225}; 225};
@@ -613,27 +613,27 @@ sockaddr_dump(const sockaddr_u *psau) @@ -613,27 +613,27 @@ sockaddr_dump(const sockaddr_u *psau)
613 613
614 for(i = 0; i < maxsize; i++) { 614 for(i = 0; i < maxsize; i++) {
615 printf("%02x", *cp++); 615 printf("%02x", *cp++);
616 if (!((i + 1) % 4)) 616 if (!((i + 1) % 4))
617 printf(" "); 617 printf(" ");
618 } 618 }
619 printf("\n"); 619 printf("\n");
620} 620}
621 621
622/* 622/*
623 * print_interface - helper to output debug information 623 * print_interface - helper to output debug information
624 */ 624 */
625static void 625static void
626print_interface(const endpt *iface, char *pfx, char *sfx) 626print_interface(const endpt *iface, const char *pfx, const char *sfx)
627{ 627{
628 printf("%sinterface #%d: fd=%d, bfd=%d, name=%s, flags=0x%x, ifindex=%u, sin=%s", 628 printf("%sinterface #%d: fd=%d, bfd=%d, name=%s, flags=0x%x, ifindex=%u, sin=%s",
629 pfx, 629 pfx,
630 iface->ifnum, 630 iface->ifnum,
631 iface->fd, 631 iface->fd,
632 iface->bfd, 632 iface->bfd,
633 iface->name, 633 iface->name,
634 iface->flags, 634 iface->flags,
635 iface->ifindex, 635 iface->ifindex,
636 stoa(&iface->sin)); 636 stoa(&iface->sin));
637 if (AF_INET == iface->family) { 637 if (AF_INET == iface->family) {
638 if (iface->flags & INT_BROADCAST) 638 if (iface->flags & INT_BROADCAST)
639 printf(", bcast=%s", stoa(&iface->bcast)); 639 printf(", bcast=%s", stoa(&iface->bcast));
@@ -3855,27 +3855,27 @@ calc_addr_distance( @@ -3855,27 +3855,27 @@ calc_addr_distance(
3855 if (IS_IPV4(a1)) { 3855 if (IS_IPV4(a1)) {
3856 a1val = SRCADR(a1); 3856 a1val = SRCADR(a1);
3857 a2val = SRCADR(a2); 3857 a2val = SRCADR(a2);
3858 v4dist = (a1val > a2val) 3858 v4dist = (a1val > a2val)
3859 ? a1val - a2val 3859 ? a1val - a2val
3860 : a2val - a1val; 3860 : a2val - a1val;
3861 SET_ADDR4(dist, v4dist); 3861 SET_ADDR4(dist, v4dist);
3862 3862
3863 return; 3863 return;
3864 } 3864 }
3865 3865
3866 found_greater = FALSE; 3866 found_greater = FALSE;
3867 a1_greater = FALSE; /* suppress pot. uninit. warning */ 3867 a1_greater = FALSE; /* suppress pot. uninit. warning */
3868 for (i = 0; i < sizeof(NSRCADR6(a1)); i++) { 3868 for (i = 0; i < (int)sizeof(NSRCADR6(a1)); i++) {
3869 if (!found_greater && 3869 if (!found_greater &&
3870 NSRCADR6(a1)[i] != NSRCADR6(a2)[i]) { 3870 NSRCADR6(a1)[i] != NSRCADR6(a2)[i]) {
3871 found_greater = TRUE; 3871 found_greater = TRUE;
3872 a1_greater = (NSRCADR6(a1)[i] > NSRCADR6(a2)[i]); 3872 a1_greater = (NSRCADR6(a1)[i] > NSRCADR6(a2)[i]);
3873 } 3873 }
3874 if (!found_greater) { 3874 if (!found_greater) {
3875 NSRCADR6(dist)[i] = 0; 3875 NSRCADR6(dist)[i] = 0;
3876 } else { 3876 } else {
3877 if (a1_greater) 3877 if (a1_greater)
3878 NSRCADR6(dist)[i] = NSRCADR6(a1)[i] - 3878 NSRCADR6(dist)[i] = NSRCADR6(a1)[i] -
3879 NSRCADR6(a2)[i]; 3879 NSRCADR6(a2)[i];
3880 else 3880 else
3881 NSRCADR6(dist)[i] = NSRCADR6(a2)[i] - 3881 NSRCADR6(dist)[i] = NSRCADR6(a2)[i] -
@@ -3898,27 +3898,27 @@ cmp_addr_distance( @@ -3898,27 +3898,27 @@ cmp_addr_distance(
3898 int i; 3898 int i;
3899 3899
3900 NTP_REQUIRE(AF(d1) == AF(d2)); 3900 NTP_REQUIRE(AF(d1) == AF(d2));
3901 3901
3902 if (IS_IPV4(d1)) { 3902 if (IS_IPV4(d1)) {
3903 if (SRCADR(d1) < SRCADR(d2)) 3903 if (SRCADR(d1) < SRCADR(d2))
3904 return -1; 3904 return -1;
3905 else if (SRCADR(d1) == SRCADR(d2)) 3905 else if (SRCADR(d1) == SRCADR(d2))
3906 return 0; 3906 return 0;
3907 else 3907 else
3908 return 1; 3908 return 1;
3909 } 3909 }
3910 3910
3911 for (i = 0; i < sizeof(NSRCADR6(d1)); i++) { 3911 for (i = 0; i < (int)sizeof(NSRCADR6(d1)); i++) {
3912 if (NSRCADR6(d1)[i] < NSRCADR6(d2)[i]) 3912 if (NSRCADR6(d1)[i] < NSRCADR6(d2)[i])
3913 return -1; 3913 return -1;
3914 else if (NSRCADR6(d1)[i] > NSRCADR6(d2)[i]) 3914 else if (NSRCADR6(d1)[i] > NSRCADR6(d2)[i])
3915 return 1; 3915 return 1;
3916 } 3916 }
3917 3917
3918 return 0; 3918 return 0;
3919} 3919}
3920 3920
3921 3921
3922 3922
3923/* 3923/*
3924 * fetch an interface structure the matches the 3924 * fetch an interface structure the matches the

cvs diff -r1.3 -r1.4 src/external/bsd/ntp/dist/ntpd/ntp_refclock.c (expand / switch to unified diff)

--- src/external/bsd/ntp/dist/ntpd/ntp_refclock.c 2012/02/01 07:46:22 1.3
+++ src/external/bsd/ntp/dist/ntpd/ntp_refclock.c 2012/02/01 20:48:01 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ntp_refclock.c,v 1.3 2012/02/01 07:46:22 kardel Exp $ */ 1/* $NetBSD: ntp_refclock.c,v 1.4 2012/02/01 20:48:01 kardel Exp $ */
2 2
3/* 3/*
4 * ntp_refclock - processing support for reference clocks 4 * ntp_refclock - processing support for reference clocks
5 */ 5 */
6#ifdef HAVE_CONFIG_H 6#ifdef HAVE_CONFIG_H
7# include <config.h> 7# include <config.h>
8#endif 8#endif
9 9
10#include "ntpd.h" 10#include "ntpd.h"
11#include "ntp_io.h" 11#include "ntp_io.h"
12#include "ntp_unixtime.h" 12#include "ntp_unixtime.h"
13#include "ntp_tty.h" 13#include "ntp_tty.h"
14#include "ntp_refclock.h" 14#include "ntp_refclock.h"
@@ -504,27 +504,27 @@ refclock_sample( @@ -504,27 +504,27 @@ refclock_sample(
504 pp->offset = 0; 504 pp->offset = 0;
505 pp->jitter = 0; 505 pp->jitter = 0;
506 for (k = i; k < j; k++) { 506 for (k = i; k < j; k++) {
507 pp->offset += off[k]; 507 pp->offset += off[k];
508 if (k > i) 508 if (k > i)
509 pp->jitter += SQUARE(off[k] - off[k - 1]); 509 pp->jitter += SQUARE(off[k] - off[k - 1]);
510 } 510 }
511 pp->offset /= m; 511 pp->offset /= m;
512 pp->jitter = max(SQRT(pp->jitter / m), LOGTOD(sys_precision)); 512 pp->jitter = max(SQRT(pp->jitter / m), LOGTOD(sys_precision));
513#ifdef DEBUG 513#ifdef DEBUG
514 if (debug) 514 if (debug)
515 printf( 515 printf(
516 "refclock_sample: n %d offset %.6f disp %.6f jitter %.6f\n", 516 "refclock_sample: n %d offset %.6f disp %.6f jitter %.6f\n",
517 n, pp->offset, pp->disp, pp->jitter); 517 (int)n, pp->offset, pp->disp, pp->jitter);
518#endif 518#endif
519 return (int)n; 519 return (int)n;
520} 520}
521 521
522 522
523/* 523/*
524 * refclock_receive - simulate the receive and packet procedures 524 * refclock_receive - simulate the receive and packet procedures
525 * 525 *
526 * This routine simulates the NTP receive and packet procedures for a 526 * This routine simulates the NTP receive and packet procedures for a
527 * reference clock. This provides a mechanism in which the ordinary NTP 527 * reference clock. This provides a mechanism in which the ordinary NTP
528 * filter, selection and combining algorithms can be used to suppress 528 * filter, selection and combining algorithms can be used to suppress
529 * misbehaving radios and to mitigate between them when more than one is 529 * misbehaving radios and to mitigate between them when more than one is
530 * available for backup. 530 * available for backup.

cvs diff -r1.3 -r1.4 src/external/bsd/ntp/dist/ntpd/refclock_jjy.c (expand / switch to unified diff)

--- src/external/bsd/ntp/dist/ntpd/refclock_jjy.c 2012/02/01 07:46:22 1.3
+++ src/external/bsd/ntp/dist/ntpd/refclock_jjy.c 2012/02/01 20:48:01 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: refclock_jjy.c,v 1.3 2012/02/01 07:46:22 kardel Exp $ */ 1/* $NetBSD: refclock_jjy.c,v 1.4 2012/02/01 20:48:01 kardel Exp $ */
2 2
3/* 3/*
4 * refclock_jjy - clock driver for JJY receivers 4 * refclock_jjy - clock driver for JJY receivers
5 */ 5 */
6 6
7/**********************************************************************/ 7/**********************************************************************/
8/* */ 8/* */
9/* Copyright (C) 2001-2004, Takao Abe. All rights reserved. */ 9/* Copyright (C) 2001-2004, Takao Abe. All rights reserved. */
10/* */ 10/* */
11/* Permission to use, copy, modify, and distribute this software */ 11/* Permission to use, copy, modify, and distribute this software */
12/* and its documentation for any purpose is hereby granted */ 12/* and its documentation for any purpose is hereby granted */
13/* without fee, provided that the following conditions are met: */ 13/* without fee, provided that the following conditions are met: */
14/* */ 14/* */
@@ -262,29 +262,29 @@ struct refclock refclock_jjy = { @@ -262,29 +262,29 @@ struct refclock refclock_jjy = {
262#define TS_JJY01_REPLY_STUS_NO "unadjusted\r\n" 262#define TS_JJY01_REPLY_STUS_NO "unadjusted\r\n"
263#define TS_JJY01_REPLY_DCST_VALID "valid\r\n" 263#define TS_JJY01_REPLY_DCST_VALID "valid\r\n"
264#define TS_JJY01_REPLY_DCST_INVALID "invalid\r\n" 264#define TS_JJY01_REPLY_DCST_INVALID "invalid\r\n"
265 265
266#define TS_JJY01_REPLY_LENGTH_DATE 14 /* Length without <CR><LF> */ 266#define TS_JJY01_REPLY_LENGTH_DATE 14 /* Length without <CR><LF> */
267#define TS_JJY01_REPLY_LENGTH_STIM 8 /* Length without <CR><LF> */ 267#define TS_JJY01_REPLY_LENGTH_STIM 8 /* Length without <CR><LF> */
268#define TS_JJY01_REPLY_LENGTH_STUS_YES 8 /* Length without <CR><LF> */ 268#define TS_JJY01_REPLY_LENGTH_STUS_YES 8 /* Length without <CR><LF> */
269#define TS_JJY01_REPLY_LENGTH_STUS_NO 10 /* Length without <CR><LF> */ 269#define TS_JJY01_REPLY_LENGTH_STUS_NO 10 /* Length without <CR><LF> */
270#define TS_JJY01_REPLY_LENGTH_DCST_VALID 5 /* Length without <CR><LF> */ 270#define TS_JJY01_REPLY_LENGTH_DCST_VALID 5 /* Length without <CR><LF> */
271#define TS_JJY01_REPLY_LENGTH_DCST_INVALID 7 /* Length without <CR><LF> */ 271#define TS_JJY01_REPLY_LENGTH_DCST_INVALID 7 /* Length without <CR><LF> */
272 272
273static struct 273static struct
274{ 274{
275 char commandNumber ; 275 const char commandNumber ;
276 char *commandLog ; 276 const char *commandLog ;
277 char *command ; 277 const char *command ;
278 int commandLength ; 278 int commandLength ;
279} tristate_jjy01_command_sequence[] = 279} tristate_jjy01_command_sequence[] =
280{ 280{
281 /* dcst<CR><LF> -> VALID<CR><LF> or INVALID<CR><LF> */ 281 /* dcst<CR><LF> -> VALID<CR><LF> or INVALID<CR><LF> */
282 { TS_JJY01_COMMAND_NUMBER_DCST, "dcst", "dcst\r\n", 6 }, 282 { TS_JJY01_COMMAND_NUMBER_DCST, "dcst", "dcst\r\n", 6 },
283 /* stus<CR><LF> -> ADJUSTED<CR><LF> or UNADJUSTED<CR><LF> */ 283 /* stus<CR><LF> -> ADJUSTED<CR><LF> or UNADJUSTED<CR><LF> */
284 { TS_JJY01_COMMAND_NUMBER_STUS, "stus", "stus\r\n", 6 }, 284 { TS_JJY01_COMMAND_NUMBER_STUS, "stus", "stus\r\n", 6 },
285 /* date<CR><LF> -> YYYY/MM/DD WWW<CR><LF> */ 285 /* date<CR><LF> -> YYYY/MM/DD WWW<CR><LF> */
286 { TS_JJY01_COMMAND_NUMBER_DATE, "date", "date\r\n", 6 }, 286 { TS_JJY01_COMMAND_NUMBER_DATE, "date", "date\r\n", 6 },
287 /* stim<CR><LF> -> HH:MM:SS<CR><LF> */ 287 /* stim<CR><LF> -> HH:MM:SS<CR><LF> */
288 { TS_JJY01_COMMAND_NUMBER_STIM, "stim", "stim\r\n", 6 }, 288 { TS_JJY01_COMMAND_NUMBER_STIM, "stim", "stim\r\n", 6 },
289 { 0 , NULL , NULL , 0 } 289 { 0 , NULL , NULL , 0 }
290} ; 290} ;
@@ -643,41 +643,41 @@ jjy_receive ( struct recvbuf *rbufp ) @@ -643,41 +643,41 @@ jjy_receive ( struct recvbuf *rbufp )
643 } 643 }
644 644
645 pp->lastref = pp->lastrec; 645 pp->lastref = pp->lastrec;
646 refclock_receive(peer); 646 refclock_receive(peer);
647 647
648} 648}
649 649
650/**************************************************************************************************/ 650/**************************************************************************************************/
651 651
652static int 652static int
653jjy_receive_tristate_jjy01 ( struct recvbuf *rbufp ) 653jjy_receive_tristate_jjy01 ( struct recvbuf *rbufp )
654{ 654{
655 655
656 static char *sFunctionName = "jjy_receive_tristate_jjy01" ; 656 static const char *sFunctionName = "jjy_receive_tristate_jjy01" ;
657 657
658 struct jjyunit *up ; 658 struct jjyunit *up ;
659 struct refclockproc *pp ; 659 struct refclockproc *pp ;
660 struct peer *peer; 660 struct peer *peer;
661 661
662 char *pBuf ; 662 char *pBuf ;
663 int iLen ; 663 int iLen ;
664 int rc ; 664 int rc ;
665 665
666 int bOverMidnight = 0 ; 666 int bOverMidnight = 0 ;
667 667
668 char sLogText [ MAX_LOGTEXT ], sReplyText [ MAX_LOGTEXT ] ; 668 char sLogText [ MAX_LOGTEXT ], sReplyText [ MAX_LOGTEXT ] ;
669 669
670 char *pCmd ; 670 const char *pCmd ;
671 int iCmdLen ; 671 int iCmdLen ;
672 672
673 /* 673 /*
674 * Initialize pointers and read the timecode and timestamp 674 * Initialize pointers and read the timecode and timestamp
675 */ 675 */
676 peer = (struct peer *) rbufp->recv_srcclock ; 676 peer = (struct peer *) rbufp->recv_srcclock ;
677 pp = peer->procptr ; 677 pp = peer->procptr ;
678 up = (struct jjyunit *) pp->unitptr ; 678 up = (struct jjyunit *) pp->unitptr ;
679 679
680 if ( up->linediscipline == LDISC_RAW ) { 680 if ( up->linediscipline == LDISC_RAW ) {
681 pBuf = up->rawbuf ; 681 pBuf = up->rawbuf ;
682 iLen = up->charcount ; 682 iLen = up->charcount ;
683 } else { 683 } else {
@@ -831,27 +831,27 @@ jjy_receive_tristate_jjy01 ( struct recv @@ -831,27 +831,27 @@ jjy_receive_tristate_jjy01 ( struct recv
831 if ( write ( pp->io.fd, pCmd, iCmdLen ) != iCmdLen ) { 831 if ( write ( pp->io.fd, pCmd, iCmdLen ) != iCmdLen ) {
832 refclock_report ( peer, CEVNT_FAULT ) ; 832 refclock_report ( peer, CEVNT_FAULT ) ;
833 } 833 }
834 834
835 return 0 ; 835 return 0 ;
836 836
837} 837}
838 838
839/**************************************************************************************************/ 839/**************************************************************************************************/
840 840
841static int 841static int
842jjy_receive_cdex_jst2000 ( struct recvbuf *rbufp ) 842jjy_receive_cdex_jst2000 ( struct recvbuf *rbufp )
843{ 843{
844 static char *sFunctionName = "jjy_receive_cdex_jst2000" ; 844 static const char *sFunctionName = "jjy_receive_cdex_jst2000" ;
845 845
846 struct jjyunit *up ; 846 struct jjyunit *up ;
847 struct refclockproc *pp ; 847 struct refclockproc *pp ;
848 struct peer *peer; 848 struct peer *peer;
849 849
850 char *pBuf ; 850 char *pBuf ;
851 int iLen ; 851 int iLen ;
852 int rc ; 852 int rc ;
853 853
854 /* 854 /*
855 * Initialize pointers and read the timecode and timestamp 855 * Initialize pointers and read the timecode and timestamp
856 */ 856 */
857 peer = (struct peer *) rbufp->recv_srcclock ; 857 peer = (struct peer *) rbufp->recv_srcclock ;
@@ -909,27 +909,27 @@ jjy_receive_cdex_jst2000 ( struct recvbu @@ -909,27 +909,27 @@ jjy_receive_cdex_jst2000 ( struct recvbu
909 break ; 909 break ;
910 910
911 } 911 }
912 912
913 return 1 ; 913 return 1 ;
914 914
915} 915}
916 916
917/**************************************************************************************************/ 917/**************************************************************************************************/
918 918
919static int 919static int
920jjy_receive_echokeisokuki_lt2000 ( struct recvbuf *rbufp ) 920jjy_receive_echokeisokuki_lt2000 ( struct recvbuf *rbufp )
921{ 921{
922 static char *sFunctionName = "jjy_receive_echokeisokuki_lt2000" ; 922 static const char *sFunctionName = "jjy_receive_echokeisokuki_lt2000" ;
923 923
924 struct jjyunit *up ; 924 struct jjyunit *up ;
925 struct refclockproc *pp ; 925 struct refclockproc *pp ;
926 struct peer *peer; 926 struct peer *peer;
927 927
928 char *pBuf ; 928 char *pBuf ;
929 int iLen ; 929 int iLen ;
930 int rc ; 930 int rc ;
931 int i, ibcc, ibcc1, ibcc2 ; 931 int i, ibcc, ibcc1, ibcc2 ;
932 932
933 /* 933 /*
934 * Initialize pointers and read the timecode and timestamp 934 * Initialize pointers and read the timecode and timestamp
935 */ 935 */
@@ -1067,27 +1067,27 @@ jjy_receive_echokeisokuki_lt2000 ( struc @@ -1067,27 +1067,27 @@ jjy_receive_echokeisokuki_lt2000 ( struc
1067 1067
1068 } 1068 }
1069 1069
1070 return 1 ; 1070 return 1 ;
1071 1071
1072} 1072}
1073 1073
1074/**************************************************************************************************/ 1074/**************************************************************************************************/
1075 1075
1076static int 1076static int
1077jjy_receive_citizentic_jjy200 ( struct recvbuf *rbufp ) 1077jjy_receive_citizentic_jjy200 ( struct recvbuf *rbufp )
1078{ 1078{
1079 1079
1080 static char *sFunctionName = "jjy_receive_citizentic_jjy200" ; 1080 static const char *sFunctionName = "jjy_receive_citizentic_jjy200" ;
1081 1081
1082 struct jjyunit *up ; 1082 struct jjyunit *up ;
1083 struct refclockproc *pp ; 1083 struct refclockproc *pp ;
1084 struct peer *peer; 1084 struct peer *peer;
1085 1085
1086 char *pBuf ; 1086 char *pBuf ;
1087 int iLen ; 1087 int iLen ;
1088 int rc ; 1088 int rc ;
1089 char cApostrophe, sStatus[3] ; 1089 char cApostrophe, sStatus[3] ;
1090 int iWeekday ; 1090 int iWeekday ;
1091 1091
1092 /* 1092 /*
1093 * Initialize pointers and read the timecode and timestamp 1093 * Initialize pointers and read the timecode and timestamp
@@ -1219,32 +1219,32 @@ jjy_poll ( int unit, struct peer *peer ) @@ -1219,32 +1219,32 @@ jjy_poll ( int unit, struct peer *peer )
1219 default : 1219 default :
1220 break ; 1220 break ;
1221 1221
1222 } 1222 }
1223 1223
1224} 1224}
1225 1225
1226/**************************************************************************************************/ 1226/**************************************************************************************************/
1227 1227
1228static void 1228static void
1229jjy_poll_tristate_jjy01 ( int unit, struct peer *peer ) 1229jjy_poll_tristate_jjy01 ( int unit, struct peer *peer )
1230{ 1230{
1231 1231
1232 static char *sFunctionName = "jjy_poll_tristate_jjy01" ; 1232 static const char *sFunctionName = "jjy_poll_tristate_jjy01" ;
1233 1233
1234 struct jjyunit *up; 1234 struct jjyunit *up;
1235 struct refclockproc *pp; 1235 struct refclockproc *pp;
1236 1236
1237 char *pCmd ; 1237 const char *pCmd ;
1238 int iCmdLen ; 1238 int iCmdLen ;
1239 1239
1240 pp = peer->procptr; 1240 pp = peer->procptr;
1241 up = (struct jjyunit *) pp->unitptr ; 1241 up = (struct jjyunit *) pp->unitptr ;
1242 1242
1243 if ( ( pp->sloppyclockflag & CLK_FLAG1 ) == 0 ) { 1243 if ( ( pp->sloppyclockflag & CLK_FLAG1 ) == 0 ) {
1244 up->linecount = 2 ; 1244 up->linecount = 2 ;
1245 } 1245 }
1246 1246
1247#ifdef DEBUG 1247#ifdef DEBUG
1248 if ( debug ) { 1248 if ( debug ) {
1249 printf ( "%s (refclock_jjy.c) : flag1=%X CLK_FLAG1=%X up->linecount=%d\n", 1249 printf ( "%s (refclock_jjy.c) : flag1=%X CLK_FLAG1=%X up->linecount=%d\n",
1250 sFunctionName, pp->sloppyclockflag, CLK_FLAG1, 1250 sFunctionName, pp->sloppyclockflag, CLK_FLAG1,
@@ -1340,41 +1340,41 @@ static void @@ -1340,41 +1340,41 @@ static void
1340jjy_poll_citizentic_jjy200 ( int unit, struct peer *peer ) 1340jjy_poll_citizentic_jjy200 ( int unit, struct peer *peer )
1341{ 1341{
1342 1342
1343 /* Do nothing ( up->bPollFlag is set by the jjy_poll ) */ 1343 /* Do nothing ( up->bPollFlag is set by the jjy_poll ) */
1344 1344
1345} 1345}
1346 1346
1347/**************************************************************************************************/ 1347/**************************************************************************************************/
1348 1348
1349static void 1349static void
1350printableString ( char *sOutput, int iOutputLen, char *sInput, int iInputLen ) 1350printableString ( char *sOutput, int iOutputLen, char *sInput, int iInputLen )
1351{ 1351{
1352 1352
1353 char *printableControlChar[] = { 1353 const char *printableControlChar[] = {
1354 "<NUL>", "<SOH>", "<STX>", "<ETX>", 1354 "<NUL>", "<SOH>", "<STX>", "<ETX>",
1355 "<EOT>", "<ENQ>", "<ACK>", "<BEL>", 1355 "<EOT>", "<ENQ>", "<ACK>", "<BEL>",
1356 "<BS>" , "<HT>" , "<LF>" , "<VT>" , 1356 "<BS>" , "<HT>" , "<LF>" , "<VT>" ,
1357 "<FF>" , "<CR>" , "<SO>" , "<SI>" , 1357 "<FF>" , "<CR>" , "<SO>" , "<SI>" ,
1358 "<DLE>", "<DC1>", "<DC2>", "<DC3>", 1358 "<DLE>", "<DC1>", "<DC2>", "<DC3>",
1359 "<DC4>", "<NAK>", "<SYN>", "<ETB>", 1359 "<DC4>", "<NAK>", "<SYN>", "<ETB>",
1360 "<CAN>", "<EM>" , "<SUB>", "<ESC>", 1360 "<CAN>", "<EM>" , "<SUB>", "<ESC>",
1361 "<FS>" , "<GS>" , "<RS>" , "<US>" , 1361 "<FS>" , "<GS>" , "<RS>" , "<US>" ,
1362 " " } ; 1362 " " } ;
1363 1363
1364 int i, j, n ; 1364 int i, j, n ;
1365 1365
1366 for ( i = j = 0 ; i < iInputLen && j < iOutputLen ; i ++ ) { 1366 for ( i = j = 0 ; i < iInputLen && j < iOutputLen ; i ++ ) {
1367 if ( isprint( sInput[i] ) ) { 1367 if ( isprint( (int)sInput[i] ) ) {
1368 n = 1 ; 1368 n = 1 ;
1369 if ( j + 1 >= iOutputLen ) 1369 if ( j + 1 >= iOutputLen )
1370 break ; 1370 break ;
1371 sOutput[j] = sInput[i] ; 1371 sOutput[j] = sInput[i] ;
1372 } else if ( ( sInput[i] & 0xFF ) <  1372 } else if ( ( sInput[i] & 0xFF ) <
1373 COUNTOF(printableControlChar) ) { 1373 COUNTOF(printableControlChar) ) {
1374 n = strlen( printableControlChar[sInput[i] & 0xFF] ) ; 1374 n = strlen( printableControlChar[sInput[i] & 0xFF] ) ;
1375 if ( j + n + 1 >= iOutputLen ) 1375 if ( j + n + 1 >= iOutputLen )
1376 break ; 1376 break ;
1377 strncpy( sOutput + j, 1377 strncpy( sOutput + j,
1378 printableControlChar[sInput[i] & 0xFF], 1378 printableControlChar[sInput[i] & 0xFF],
1379 (size_t)iOutputLen - j ) ; 1379 (size_t)iOutputLen - j ) ;
1380 } else { 1380 } else {

cvs diff -r1.1.1.2 -r1.2 src/external/bsd/ntp/dist/ntpd/ntp_restrict.c (expand / switch to unified diff)

--- src/external/bsd/ntp/dist/ntpd/ntp_restrict.c 2012/01/31 21:26:46 1.1.1.2
+++ src/external/bsd/ntp/dist/ntpd/ntp_restrict.c 2012/02/01 20:48:01 1.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ntp_restrict.c,v 1.1.1.2 2012/01/31 21:26:46 kardel Exp $ */ 1/* $NetBSD: ntp_restrict.c,v 1.2 2012/02/01 20:48:01 kardel Exp $ */
2 2
3/* 3/*
4 * ntp_restrict.c - determine host restrictions 4 * ntp_restrict.c - determine host restrictions
5 */ 5 */
6#ifdef HAVE_CONFIG_H 6#ifdef HAVE_CONFIG_H
7#include <config.h> 7#include <config.h>
8#endif 8#endif
9 9
10#include <stdio.h> 10#include <stdio.h>
11#include <sys/types.h> 11#include <sys/types.h>
12 12
13#include "ntpd.h" 13#include "ntpd.h"
14#include "ntp_if.h" 14#include "ntp_if.h"
@@ -38,27 +38,27 @@ @@ -38,27 +38,27 @@
38 * your own interfaces. It was also thought it would sometimes be useful 38 * your own interfaces. It was also thought it would sometimes be useful
39 * to keep a misbehaving host or two from abusing your primary clock. It 39 * to keep a misbehaving host or two from abusing your primary clock. It
40 * has been expanded, however, to suit the needs of those with more 40 * has been expanded, however, to suit the needs of those with more
41 * restrictive access policies. 41 * restrictive access policies.
42 */ 42 */
43/* 43/*
44 * We will use two lists, one for IPv4 addresses and one for IPv6 44 * We will use two lists, one for IPv4 addresses and one for IPv6
45 * addresses. This is not protocol-independant but for now I can't 45 * addresses. This is not protocol-independant but for now I can't
46 * find a way to respect this. We'll check this later... JFB 07/2001 46 * find a way to respect this. We'll check this later... JFB 07/2001
47 */ 47 */
48#define MASK_IPV6_ADDR(dst, src, msk) \ 48#define MASK_IPV6_ADDR(dst, src, msk) \
49 do { \ 49 do { \
50 int idx; \ 50 int idx; \
51 for (idx = 0; idx < COUNTOF((dst)->s6_addr); idx++) { \ 51 for (idx = 0; idx < (int)COUNTOF((dst)->s6_addr); idx++) { \
52 (dst)->s6_addr[idx] = (src)->s6_addr[idx] \ 52 (dst)->s6_addr[idx] = (src)->s6_addr[idx] \
53 & (msk)->s6_addr[idx]; \ 53 & (msk)->s6_addr[idx]; \
54 } \ 54 } \
55 } while (0) 55 } while (0)
56 56
57/* 57/*
58 * We allocate INC_RESLIST{4|6} entries to the free list whenever empty. 58 * We allocate INC_RESLIST{4|6} entries to the free list whenever empty.
59 * Auto-tune these to be just less than 1KB (leaving at least 16 bytes 59 * Auto-tune these to be just less than 1KB (leaving at least 16 bytes
60 * for allocator overhead). 60 * for allocator overhead).
61 */ 61 */
62#define INC_RESLIST4 ((1024 - 16) / V4_SIZEOF_RESTRICT_U) 62#define INC_RESLIST4 ((1024 - 16) / V4_SIZEOF_RESTRICT_U)
63#define INC_RESLIST6 ((1024 - 16) / V6_SIZEOF_RESTRICT_U) 63#define INC_RESLIST6 ((1024 - 16) / V6_SIZEOF_RESTRICT_U)
64 64
@@ -284,27 +284,27 @@ match_restrict6_addr( @@ -284,27 +284,27 @@ match_restrict6_addr(
284 u_short port 284 u_short port
285 ) 285 )
286{ 286{
287 restrict_u * res; 287 restrict_u * res;
288 restrict_u * next; 288 restrict_u * next;
289 struct in6_addr masked; 289 struct in6_addr masked;
290 290
291 for (res = restrictlist6; res != NULL; res = next) { 291 for (res = restrictlist6; res != NULL; res = next) {
292 next = res->link; 292 next = res->link;
293 NTP_INSIST(next != res); 293 NTP_INSIST(next != res);
294 MASK_IPV6_ADDR(&masked, addr, &res->u.v6.mask); 294 MASK_IPV6_ADDR(&masked, addr, &res->u.v6.mask);
295 if (ADDR6_EQ(&masked, &res->u.v6.addr) 295 if (ADDR6_EQ(&masked, &res->u.v6.addr)
296 && (!(RESM_NTPONLY & res->mflags) 296 && (!(RESM_NTPONLY & res->mflags)
297 || NTP_PORT == port)) 297 || NTP_PORT == (int)port))
298 break; 298 break;
299 } 299 }
300 return res; 300 return res;
301} 301}
302 302
303 303
304/* 304/*
305 * match_restrict_entry - find an exact match on a restrict list. 305 * match_restrict_entry - find an exact match on a restrict list.
306 * 306 *
307 * Exact match is addr, mask, and mflags all equal. 307 * Exact match is addr, mask, and mflags all equal.
308 * In order to use more common code for IPv4 and IPv6, this routine 308 * In order to use more common code for IPv4 and IPv6, this routine
309 * requires the caller to populate a restrict_u with mflags and either 309 * requires the caller to populate a restrict_u with mflags and either
310 * the v4 or v6 address and mask as appropriate. Other fields in the 310 * the v4 or v6 address and mask as appropriate. Other fields in the

cvs diff -r1.4 -r1.5 src/external/bsd/ntp/dist/ntpq/ntpq.c (expand / switch to unified diff)

--- src/external/bsd/ntp/dist/ntpq/ntpq.c 2012/02/01 07:46:23 1.4
+++ src/external/bsd/ntp/dist/ntpq/ntpq.c 2012/02/01 20:48:01 1.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ntpq.c,v 1.4 2012/02/01 07:46:23 kardel Exp $ */ 1/* $NetBSD: ntpq.c,v 1.5 2012/02/01 20:48:01 kardel Exp $ */
2 2
3/* 3/*
4 * ntpq - query an NTP server using mode 6 commands 4 * ntpq - query an NTP server using mode 6 commands
5 */ 5 */
6 6
7#include <stdio.h> 7#include <stdio.h>
8 8
9#include <ctype.h> 9#include <ctype.h>
10#include <signal.h> 10#include <signal.h>
11#include <setjmp.h> 11#include <setjmp.h>
12#include <sys/types.h> 12#include <sys/types.h>
13#include <sys/time.h> 13#include <sys/time.h>
14 14
@@ -374,27 +374,27 @@ struct xcmd builtins[] = { @@ -374,27 +374,27 @@ struct xcmd builtins[] = {
374#define MAXVARLEN 256 /* maximum length of a variable name */ 374#define MAXVARLEN 256 /* maximum length of a variable name */
375#define MAXVALLEN 400 /* maximum length of a variable value */ 375#define MAXVALLEN 400 /* maximum length of a variable value */
376#define MAXOUTLINE 72 /* maximum length of an output line */ 376#define MAXOUTLINE 72 /* maximum length of an output line */
377#define SCREENWIDTH 76 /* nominal screen width in columns */ 377#define SCREENWIDTH 76 /* nominal screen width in columns */
378 378
379/* 379/*
380 * Some variables used and manipulated locally 380 * Some variables used and manipulated locally
381 */ 381 */
382struct sock_timeval tvout = { DEFTIMEOUT, 0 }; /* time out for reads */ 382struct sock_timeval tvout = { DEFTIMEOUT, 0 }; /* time out for reads */
383struct sock_timeval tvsout = { DEFSTIMEOUT, 0 };/* secondary time out */ 383struct sock_timeval tvsout = { DEFSTIMEOUT, 0 };/* secondary time out */
384l_fp delay_time; /* delay time */ 384l_fp delay_time; /* delay time */
385char currenthost[LENHOSTNAME]; /* current host name */ 385char currenthost[LENHOSTNAME]; /* current host name */
386int currenthostisnum; /* is prior text from IP? */ 386int currenthostisnum; /* is prior text from IP? */
387struct sockaddr_in hostaddr = { 0 }; /* host address */ 387struct sockaddr_in hostaddr; /* host address */
388int showhostnames = 1; /* show host names by default */ 388int showhostnames = 1; /* show host names by default */
389 389
390int ai_fam_templ; /* address family */ 390int ai_fam_templ; /* address family */
391int ai_fam_default; /* default address family */ 391int ai_fam_default; /* default address family */
392SOCKET sockfd; /* fd socket is opened on */ 392SOCKET sockfd; /* fd socket is opened on */
393int havehost = 0; /* set to 1 when host open */ 393int havehost = 0; /* set to 1 when host open */
394int s_port = 0; 394int s_port = 0;
395struct servent *server_entry = NULL; /* server entry for ntp */ 395struct servent *server_entry = NULL; /* server entry for ntp */
396 396
397 397
398/* 398/*
399 * Sequence number used for requests. It is incremented before 399 * Sequence number used for requests. It is incremented before
400 * it is used. 400 * it is used.
@@ -886,27 +886,27 @@ getresponse( @@ -886,27 +886,27 @@ getresponse(
886 "%s: timed out, nothing received\n", 886 "%s: timed out, nothing received\n",
887 currenthost); 887 currenthost);
888 return ERR_TIMEOUT; 888 return ERR_TIMEOUT;
889 } 889 }
890 if (timeo) 890 if (timeo)
891 fprintf(stderr, 891 fprintf(stderr,
892 "%s: timed out with incomplete data\n", 892 "%s: timed out with incomplete data\n",
893 currenthost); 893 currenthost);
894 if (debug) { 894 if (debug) {
895 fprintf(stderr, 895 fprintf(stderr,
896 "ERR_INCOMPLETE: Received fragments:\n"); 896 "ERR_INCOMPLETE: Received fragments:\n");
897 for (f = 0; f < numfrags; f++) 897 for (f = 0; f < numfrags; f++)
898 fprintf(stderr, 898 fprintf(stderr,
899 "%2u: %5d %5d\t%3d octets\n", 899 "%2zu: %5d %5d\t%3d octets\n",
900 f, offsets[f], 900 f, offsets[f],
901 offsets[f] + 901 offsets[f] +
902 counts[f], 902 counts[f],
903 counts[f]); 903 counts[f]);
904 fprintf(stderr, 904 fprintf(stderr,
905 "last fragment %sreceived\n", 905 "last fragment %sreceived\n",
906 (seenlastfrag) 906 (seenlastfrag)
907 ? "" 907 ? ""
908 : "not "); 908 : "not ");
909 } 909 }
910 return ERR_INCOMPLETE; 910 return ERR_INCOMPLETE;
911 } 911 }
912 912
@@ -925,27 +925,27 @@ getresponse( @@ -925,27 +925,27 @@ getresponse(
925 while (len-- > 0) { 925 while (len-- > 0) {
926 if (first-- == 0) { 926 if (first-- == 0) {
927 printf("\n"); 927 printf("\n");
928 first = 7; 928 first = 7;
929 } 929 }
930 printf(" %02x", *data++ & 0xff); 930 printf(" %02x", *data++ & 0xff);
931 } 931 }
932 printf("\n"); 932 printf("\n");
933 } 933 }
934 934
935 /* 935 /*
936 * Check for format errors. Bug proofing. 936 * Check for format errors. Bug proofing.
937 */ 937 */
938 if (n < CTL_HEADER_LEN) { 938 if (n < (int)CTL_HEADER_LEN) {
939 if (debug) 939 if (debug)
940 printf("Short (%d byte) packet received\n", n); 940 printf("Short (%d byte) packet received\n", n);
941 continue; 941 continue;
942 } 942 }
943 if (PKT_VERSION(rpkt.li_vn_mode) > NTP_VERSION 943 if (PKT_VERSION(rpkt.li_vn_mode) > NTP_VERSION
944 || PKT_VERSION(rpkt.li_vn_mode) < NTP_OLDVERSION) { 944 || PKT_VERSION(rpkt.li_vn_mode) < NTP_OLDVERSION) {
945 if (debug) 945 if (debug)
946 printf("Packet received with version %d\n", 946 printf("Packet received with version %d\n",
947 PKT_VERSION(rpkt.li_vn_mode)); 947 PKT_VERSION(rpkt.li_vn_mode));
948 continue; 948 continue;
949 } 949 }
950 if (PKT_MODE(rpkt.li_vn_mode) != MODE_CONTROL) { 950 if (PKT_MODE(rpkt.li_vn_mode) != MODE_CONTROL) {
951 if (debug) 951 if (debug)
@@ -1021,27 +1021,27 @@ getresponse( @@ -1021,27 +1021,27 @@ getresponse(
1021 * boundary and no smaller than claimed by rpkt.count 1021 * boundary and no smaller than claimed by rpkt.count
1022 */ 1022 */
1023 if (n & 0x3) { 1023 if (n & 0x3) {
1024 if (debug) 1024 if (debug)
1025 printf("Response packet not padded, " 1025 printf("Response packet not padded, "
1026 "size = %d\n", n); 1026 "size = %d\n", n);
1027 continue; 1027 continue;
1028 } 1028 }
1029 1029
1030 shouldbesize = (CTL_HEADER_LEN + count + 3) & ~3; 1030 shouldbesize = (CTL_HEADER_LEN + count + 3) & ~3;
1031 1031
1032 if (n < shouldbesize) { 1032 if (n < shouldbesize) {
1033 printf("Response packet claims %u octets " 1033 printf("Response packet claims %u octets "
1034 "payload, above %d received\n", 1034 "payload, above %ld received\n",
1035 count, 1035 count,
1036 n - CTL_HEADER_LEN 1036 n - CTL_HEADER_LEN
1037 ); 1037 );
1038 return ERR_INCOMPLETE; 1038 return ERR_INCOMPLETE;
1039 } 1039 }
1040 1040
1041 if (debug >= 3 && shouldbesize > n) { 1041 if (debug >= 3 && shouldbesize > n) {
1042 u_int32 key; 1042 u_int32 key;
1043 u_int32 *lpkt; 1043 u_int32 *lpkt;
1044 int maclen; 1044 int maclen;
1045 1045
1046 /* 1046 /*
1047 * Usually we ignore authentication, but for debugging purposes 1047 * Usually we ignore authentication, but for debugging purposes
@@ -1073,27 +1073,27 @@ getresponse( @@ -1073,27 +1073,27 @@ getresponse(
1073 printf("Auth okay!\n"); 1073 printf("Auth okay!\n");
1074 } else { 1074 } else {
1075 printf("Auth failed!\n"); 1075 printf("Auth failed!\n");
1076 } 1076 }
1077 } 1077 }
1078 } 1078 }
1079 } 1079 }
1080 1080
1081 if (debug >= 2) 1081 if (debug >= 2)
1082 printf("Got packet, size = %d\n", n); 1082 printf("Got packet, size = %d\n", n);
1083 if ((int)count > (n - CTL_HEADER_LEN)) { 1083 if ((int)count > (n - CTL_HEADER_LEN)) {
1084 if (debug) 1084 if (debug)
1085 printf("Received count of %d octets, " 1085 printf("Received count of %d octets, "
1086 "data in packet is %d\n", 1086 "data in packet is %lu\n",
1087 count, n-CTL_HEADER_LEN); 1087 count, n-CTL_HEADER_LEN);
1088 continue; 1088 continue;
1089 } 1089 }
1090 if (count == 0 && CTL_ISMORE(rpkt.r_m_e_op)) { 1090 if (count == 0 && CTL_ISMORE(rpkt.r_m_e_op)) {
1091 if (debug) 1091 if (debug)
1092 printf("Received count of 0 in non-final fragment\n"); 1092 printf("Received count of 0 in non-final fragment\n");
1093 continue; 1093 continue;
1094 } 1094 }
1095 if (offset + count > sizeof(pktdata)) { 1095 if (offset + count > sizeof(pktdata)) {
1096 if (debug) 1096 if (debug)
1097 printf("Offset %d, count %d, too big for buffer\n", 1097 printf("Offset %d, count %d, too big for buffer\n",
1098 offset, count); 1098 offset, count);
1099 return ERR_TOOMUCH; 1099 return ERR_TOOMUCH;
@@ -1177,27 +1177,27 @@ getresponse( @@ -1177,27 +1177,27 @@ getresponse(
1177 /* 1177 /*
1178 * If we've seen the last fragment, look for holes in the sequence. 1178 * If we've seen the last fragment, look for holes in the sequence.
1179 * If there aren't any, we're done. 1179 * If there aren't any, we're done.
1180 */ 1180 */
1181 if (seenlastfrag && offsets[0] == 0) { 1181 if (seenlastfrag && offsets[0] == 0) {
1182 for (f = 1; f < numfrags; f++) 1182 for (f = 1; f < numfrags; f++)
1183 if (offsets[f-1] + counts[f-1] != 1183 if (offsets[f-1] + counts[f-1] !=
1184 offsets[f]) 1184 offsets[f])
1185 break; 1185 break;
1186 if (f == numfrags) { 1186 if (f == numfrags) {
1187 *rsize = offsets[f-1] + counts[f-1]; 1187 *rsize = offsets[f-1] + counts[f-1];
1188 if (debug) 1188 if (debug)
1189 fprintf(stderr, 1189 fprintf(stderr,
1190 "%u packets reassembled into response\n", 1190 "%zu packets reassembled into response\n",
1191 numfrags); 1191 numfrags);
1192 return 0; 1192 return 0;
1193 } 1193 }
1194 } 1194 }
1195 } /* giant for (;;) collecting response packets */ 1195 } /* giant for (;;) collecting response packets */
1196} /* getresponse() */ 1196} /* getresponse() */
1197 1197
1198 1198
1199/* 1199/*
1200 * sendrequest - format and send a request packet 1200 * sendrequest - format and send a request packet
1201 */ 1201 */
1202static int 1202static int
1203sendrequest( 1203sendrequest(
@@ -2220,27 +2220,27 @@ help( @@ -2220,27 +2220,27 @@ help(
2220 col = 0; 2220 col = 0;
2221 for (word = 0; word < words; word++) { 2221 for (word = 0; word < words; word++) {
2222 length = strlen(list[word]); 2222 length = strlen(list[word]);
2223 col = max(col, length); 2223 col = max(col, length);
2224 } 2224 }
2225 2225
2226 cols = SCREENWIDTH / ++col; 2226 cols = SCREENWIDTH / ++col;
2227 rows = (words + cols - 1) / cols; 2227 rows = (words + cols - 1) / cols;
2228 2228
2229 fprintf(fp, "ntpq commands:\n"); 2229 fprintf(fp, "ntpq commands:\n");
2230 2230
2231 for (row = 0; row < rows; row++) { 2231 for (row = 0; row < rows; row++) {
2232 for (word = row; word < words; word += rows) 2232 for (word = row; word < words; word += rows)
2233 fprintf(fp, "%-*.*s", col, col-1, 2233 fprintf(fp, "%-*.*s", (int)col, (int)col-1,
2234 list[word]); 2234 list[word]);
2235 fprintf(fp, "\n"); 2235 fprintf(fp, "\n");
2236 } 2236 }
2237 } else { 2237 } else {
2238 cmd = pcmd->argval[0].string; 2238 cmd = pcmd->argval[0].string;
2239 words = findcmd(cmd, builtins, opcmds, &xcp); 2239 words = findcmd(cmd, builtins, opcmds, &xcp);
2240 if (words == 0) { 2240 if (words == 0) {
2241 fprintf(stderr, 2241 fprintf(stderr,
2242 "Command `%s' is unknown\n", cmd); 2242 "Command `%s' is unknown\n", cmd);
2243 return; 2243 return;
2244 } else if (words >= 2) { 2244 } else if (words >= 2) {
2245 fprintf(stderr, 2245 fprintf(stderr,
2246 "Command `%s' is ambiguous\n", cmd); 2246 "Command `%s' is ambiguous\n", cmd);
@@ -3248,27 +3248,27 @@ tstflags( @@ -3248,27 +3248,27 @@ tstflags(
3248 3248
3249 snprintf(cp, cb, "%02lx", val); 3249 snprintf(cp, cb, "%02lx", val);
3250 cp += strlen(cp); 3250 cp += strlen(cp);
3251 cb -= strlen(cp); 3251 cb -= strlen(cp);
3252 if (!val) { 3252 if (!val) {
3253 strncat(cp, " ok", cb); 3253 strncat(cp, " ok", cb);
3254 cp += strlen(cp); 3254 cp += strlen(cp);
3255 cb -= strlen(cp); 3255 cb -= strlen(cp);
3256 } else { 3256 } else {
3257 if (cb) { 3257 if (cb) {
3258 *cp++ = ' '; 3258 *cp++ = ' ';
3259 cb--; 3259 cb--;
3260 } 3260 }
3261 for (i = 0; i < COUNTOF(tstflagnames); i++) { 3261 for (i = 0; i < (int)COUNTOF(tstflagnames); i++) {
3262 if (val & 0x1) { 3262 if (val & 0x1) {
3263 snprintf(cp, cb, "%s%s", sep, 3263 snprintf(cp, cb, "%s%s", sep,
3264 tstflagnames[i]); 3264 tstflagnames[i]);
3265 sep = ", "; 3265 sep = ", ";
3266 cp += strlen(cp); 3266 cp += strlen(cp);
3267 cb -= strlen(cp); 3267 cb -= strlen(cp);
3268 } 3268 }
3269 val >>= 1; 3269 val >>= 1;
3270 } 3270 }
3271 } 3271 }
3272 if (cb) 3272 if (cb)
3273 *cp = '\0'; 3273 *cp = '\0';
3274 3274

cvs diff -r1.3 -r1.4 src/external/bsd/ntp/dist/sntp/crypto.c (expand / switch to unified diff)

--- src/external/bsd/ntp/dist/sntp/crypto.c 2012/02/01 07:46:23 1.3
+++ src/external/bsd/ntp/dist/sntp/crypto.c 2012/02/01 20:48:01 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: crypto.c,v 1.3 2012/02/01 07:46:23 kardel Exp $ */ 1/* $NetBSD: crypto.c,v 1.4 2012/02/01 20:48:01 kardel Exp $ */
2 2
3#include <config.h> 3#include <config.h>
4#include "crypto.h" 4#include "crypto.h"
5#include <ctype.h> 5#include <ctype.h>
6 6
7struct key *key_ptr; 7struct key *key_ptr;
8size_t key_cnt = 0; 8size_t key_cnt = 0;
9 9
10int 10int
11make_mac( 11make_mac(
12 char *pkt_data, 12 char *pkt_data,
13 int pkt_size, 13 int pkt_size,
14 int mac_size, 14 int mac_size,
@@ -43,27 +43,27 @@ make_mac( @@ -43,27 +43,27 @@ make_mac(
43 */ 43 */
44int 44int
45auth_md5( 45auth_md5(
46 char *pkt_data, 46 char *pkt_data,
47 int pkt_size, 47 int pkt_size,
48 int mac_size, 48 int mac_size,
49 struct key *cmp_key 49 struct key *cmp_key
50 ) 50 )
51{ 51{
52 int hash_len; 52 int hash_len;
53 int authentic; 53 int authentic;
54 char digest[20]; 54 char digest[20];
55 55
56 if (mac_size > sizeof(digest)) 56 if (mac_size > (int)sizeof(digest))
57 return 0; 57 return 0;
58 hash_len = make_mac(pkt_data, pkt_size, sizeof(digest), cmp_key, 58 hash_len = make_mac(pkt_data, pkt_size, sizeof(digest), cmp_key,
59 digest); 59 digest);
60 if (!hash_len) 60 if (!hash_len)
61 authentic = FALSE; 61 authentic = FALSE;
62 else 62 else
63 authentic = !memcmp(digest, pkt_data + pkt_size + 4, 63 authentic = !memcmp(digest, pkt_data + pkt_size + 4,
64 hash_len); 64 hash_len);
65 return authentic; 65 return authentic;
66} 66}
67 67
68static int 68static int
69hex_val( 69hex_val(

cvs diff -r1.3 -r1.4 src/external/bsd/ntp/dist/sntp/main.c (expand / switch to unified diff)

--- src/external/bsd/ntp/dist/sntp/main.c 2012/02/01 07:46:23 1.3
+++ src/external/bsd/ntp/dist/sntp/main.c 2012/02/01 20:48:01 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: main.c,v 1.3 2012/02/01 07:46:23 kardel Exp $ */ 1/* $NetBSD: main.c,v 1.4 2012/02/01 20:48:01 kardel Exp $ */
2 2
3#include <config.h> 3#include <config.h>
4 4
5#include "main.h" 5#include "main.h"
6#include "kod_management.h" 6#include "kod_management.h"
7#include "networking.h" 7#include "networking.h"
8#include "utilities.h" 8#include "utilities.h"
9#include "log.h" 9#include "log.h"
10 10
11int ai_fam_pref = AF_UNSPEC; 11int ai_fam_pref = AF_UNSPEC;
12 12
13struct key *keys = NULL; 13struct key *keys = NULL;
14 14
@@ -244,27 +244,27 @@ handle_pkt ( @@ -244,27 +244,27 @@ handle_pkt (
244 if (ENABLED_OPT(NORMALVERBOSE)) { 244 if (ENABLED_OPT(NORMALVERBOSE)) {
245 getnameinfo(host->ai_addr, host->ai_addrlen, addr_buf,  245 getnameinfo(host->ai_addr, host->ai_addrlen, addr_buf,
246 sizeof(addr_buf), NULL, 0, NI_NUMERICHOST); 246 sizeof(addr_buf), NULL, 0, NI_NUMERICHOST);
247 printf("sntp handle_pkt: Received %i bytes from %s\n", rpktl, addr_buf); 247 printf("sntp handle_pkt: Received %i bytes from %s\n", rpktl, addr_buf);
248 } 248 }
249 249
250 GETTIMEOFDAY(&tv_dst, (struct timezone *)NULL); 250 GETTIMEOFDAY(&tv_dst, (struct timezone *)NULL);
251 251
252 p_SNTP_PRETEND_TIME = getenv("SNTP_PRETEND_TIME"); 252 p_SNTP_PRETEND_TIME = getenv("SNTP_PRETEND_TIME");
253 if (p_SNTP_PRETEND_TIME) { 253 if (p_SNTP_PRETEND_TIME) {
254#if SIZEOF_TIME_T == 4 254#if SIZEOF_TIME_T == 4
255 sscanf(p_SNTP_PRETEND_TIME, "%ld", &pretend_time); 255 sscanf(p_SNTP_PRETEND_TIME, "%ld", &pretend_time);
256#elif SIZEOF_TIME_T == 8 256#elif SIZEOF_TIME_T == 8
257 sscanf(p_SNTP_PRETEND_TIME, "%lld", &pretend_time); 257 sscanf(p_SNTP_PRETEND_TIME, "%zd", &pretend_time);
258#else 258#else
259# include "GRONK: unexpected value for SIZEOF_TIME_T" 259# include "GRONK: unexpected value for SIZEOF_TIME_T"
260#endif 260#endif
261 tv_dst.tv_sec = pretend_time; 261 tv_dst.tv_sec = pretend_time;
262 } 262 }
263 263
264 offset_calculation(rpkt, rpktl, &tv_dst, &offset, 264 offset_calculation(rpkt, rpktl, &tv_dst, &offset,
265 &precision, &root_dispersion); 265 &precision, &root_dispersion);
266 266
267 for (digits = 0; (precision *= 10.) < 1.; ++digits) 267 for (digits = 0; (precision *= 10.) < 1.; ++digits)
268 /* empty */ ; 268 /* empty */ ;
269 if (digits > 6) 269 if (digits > 6)
270 digits = 6; 270 digits = 6;

cvs diff -r1.3 -r1.4 src/external/bsd/ntp/dist/sntp/networking.h (expand / switch to unified diff)

--- src/external/bsd/ntp/dist/sntp/networking.h 2012/02/01 07:46:23 1.3
+++ src/external/bsd/ntp/dist/sntp/networking.h 2012/02/01 20:48:01 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: networking.h,v 1.3 2012/02/01 07:46:23 kardel Exp $ */ 1/* $NetBSD: networking.h,v 1.4 2012/02/01 20:48:01 kardel Exp $ */
2 2
3#ifndef NETWORKING_H 3#ifndef NETWORKING_H
4#define NETWORKING_H 4#define NETWORKING_H
5 5
6#include <arpa/inet.h> 6#include <arpa/inet.h>
7#include <netinet/in.h> 7#include <netinet/in.h>
8 8
9#include <strings.h>  9#include <strings.h>
10#include <errno.h> 10#include <errno.h>
11#include <config.h> 11#include <config.h>
12#include <netdb.h> 12#include <netdb.h>
13#include <unistd.h> 13#include <unistd.h>
14#include <sys/types.h> 14#include <sys/types.h>
@@ -50,27 +50,27 @@ int resolve_hosts (const char **hosts, i @@ -50,27 +50,27 @@ int resolve_hosts (const char **hosts, i
50 50
51void create_socket (SOCKET *rsock, sockaddr_u *dest); 51void create_socket (SOCKET *rsock, sockaddr_u *dest);
52 52
53void sendpkt (SOCKET rsock, sockaddr_u *dest, struct pkt *pkt, int len); 53void sendpkt (SOCKET rsock, sockaddr_u *dest, struct pkt *pkt, int len);
54 54
55int recvdata (SOCKET rsock, sockaddr_u *sender, char *rdata, int rdata_len); 55int recvdata (SOCKET rsock, sockaddr_u *sender, char *rdata, int rdata_len);
56 56
57int recvpkt (SOCKET rsock, struct pkt *rpkt, unsigned int rsize, struct pkt *spkt); 57int recvpkt (SOCKET rsock, struct pkt *rpkt, unsigned int rsize, struct pkt *spkt);
58 58
59int recv_bcst_data (SOCKET rsock, char *rdata, int rdata_len, sockaddr_u *sas, sockaddr_u *ras); 59int recv_bcst_data (SOCKET rsock, char *rdata, int rdata_len, sockaddr_u *sas, sockaddr_u *ras);
60 60
61int recv_bcst_pkt (SOCKET rsock, struct pkt *rpkt, unsigned int rsize, sockaddr_u *sas); 61int recv_bcst_pkt (SOCKET rsock, struct pkt *rpkt, unsigned int rsize, sockaddr_u *sas);
62 62
63int process_pkt (struct pkt *rpkt, sockaddr_u *sas, int pkt_len, int mode, struct pkt *spkt, char * func_name); 63int process_pkt (struct pkt *rpkt, sockaddr_u *sas, int pkt_len, int mode, struct pkt *spkt, const char * func_name);
64 64
65/* Shortened peer structure. Not absolutely necessary yet */ 65/* Shortened peer structure. Not absolutely necessary yet */
66struct speer { 66struct speer {
67 struct speer *next; 67 struct speer *next;
68 sockaddr_u srcadr; 68 sockaddr_u srcadr;
69 u_char version; 69 u_char version;
70 u_char hmode; 70 u_char hmode;
71 u_char hpoll; 71 u_char hpoll;
72 u_char minpoll; 72 u_char minpoll;
73 u_char maxpoll; 73 u_char maxpoll;
74 u_int flags; 74 u_int flags;
75 u_char num_events; 75 u_char num_events;
76 u_char ttl; 76 u_char ttl;

cvs diff -r1.4 -r1.5 src/external/bsd/ntp/dist/sntp/log.c (expand / switch to unified diff)

--- src/external/bsd/ntp/dist/sntp/log.c 2012/02/01 07:46:23 1.4
+++ src/external/bsd/ntp/dist/sntp/log.c 2012/02/01 20:48:01 1.5
@@ -1,20 +1,20 @@ @@ -1,20 +1,20 @@
1/* $NetBSD: log.c,v 1.4 2012/02/01 07:46:23 kardel Exp $ */ 1/* $NetBSD: log.c,v 1.5 2012/02/01 20:48:01 kardel Exp $ */
2 2
3#include <config.h> 3#include <config.h>
4 4
5#include "log.h" 5#include "log.h"
6 6
7char *progname = "sntp"; /* for msyslog use too */ 7const char *progname = "sntp"; /* for msyslog use too */
8 8
9static void cleanup_log(void); 9static void cleanup_log(void);
10 10
11void 11void
12init_logging(void) 12init_logging(void)
13{ 13{
14 openlog(progname, LOG_PID | LOG_CONS, OPENLOG_FAC); 14 openlog(progname, LOG_PID | LOG_CONS, OPENLOG_FAC);
15 msyslog_term = TRUE; 15 msyslog_term = TRUE;
16} 16}
17 17
18void 18void
19open_logfile( 19open_logfile(
20 const char *logfile 20 const char *logfile

cvs diff -r1.5 -r1.6 src/external/bsd/ntp/dist/sntp/networking.c (expand / switch to unified diff)

--- src/external/bsd/ntp/dist/sntp/networking.c 2012/02/01 07:46:23 1.5
+++ src/external/bsd/ntp/dist/sntp/networking.c 2012/02/01 20:48:01 1.6
@@ -1,36 +1,36 @@ @@ -1,36 +1,36 @@
1/* $NetBSD: networking.c,v 1.5 2012/02/01 07:46:23 kardel Exp $ */ 1/* $NetBSD: networking.c,v 1.6 2012/02/01 20:48:01 kardel Exp $ */
2 2
3#include <config.h> 3#include <config.h>
4#include "networking.h" 4#include "networking.h"
5 5
6char adr_buf[INET6_ADDRSTRLEN]; 6char adr_buf[INET6_ADDRSTRLEN];
7 7
8 8
9/* resolve_hosts consumes an array of hostnames/addresses and its length, stores a pointer 9/* resolve_hosts consumes an array of hostnames/addresses and its length, stores a pointer
10 * to the array with the resolved hosts in res and returns the size of the array res. 10 * to the array with the resolved hosts in res and returns the size of the array res.
11 * pref_family enforces IPv4 or IPv6 depending on commandline options and system  11 * pref_family enforces IPv4 or IPv6 depending on commandline options and system
12 * capability. If pref_family is NULL or PF_UNSPEC any compatible family will be accepted. 12 * capability. If pref_family is NULL or PF_UNSPEC any compatible family will be accepted.
13 * Check here: Probably getaddrinfo() can do without ISC's IPv6 availability check?  13 * Check here: Probably getaddrinfo() can do without ISC's IPv6 availability check?
14 */ 14 */
15int  15int
16resolve_hosts ( 16resolve_hosts (
17 const char **hosts,  17 const char **hosts,
18 int hostc,  18 int hostc,
19 struct addrinfo ***res, 19 struct addrinfo ***res,
20 int pref_family 20 int pref_family
21 )  21 )
22{ 22{
23 register unsigned int a; 23 register int a;
24 unsigned int resc; 24 unsigned int resc;
25 struct addrinfo **tres; 25 struct addrinfo **tres;
26 26
27 if (hostc < 1 || NULL == res) 27 if (hostc < 1 || NULL == res)
28 return 0; 28 return 0;
29  29
30 tres = emalloc(sizeof(struct addrinfo *) * hostc); 30 tres = emalloc(sizeof(struct addrinfo *) * hostc);
31 for (a = 0, resc = 0; a < hostc; a++) { 31 for (a = 0, resc = 0; a < hostc; a++) {
32 struct addrinfo hints; 32 struct addrinfo hints;
33 int error; 33 int error;
34 34
35 tres[resc] = NULL; 35 tres[resc] = NULL;
36#ifdef DEBUG 36#ifdef DEBUG
@@ -187,27 +187,27 @@ recv_bcst_data ( @@ -187,27 +187,27 @@ recv_bcst_data (
187 if (bind(rsock, &sas->sa, SOCKLEN(sas)) < 0) { 187 if (bind(rsock, &sas->sa, SOCKLEN(sas)) < 0) {
188 if (ENABLED_OPT(NORMALVERBOSE)) 188 if (ENABLED_OPT(NORMALVERBOSE))
189 printf("sntp recv_bcst_data: Couldn't bind() address %s:%d.\n", 189 printf("sntp recv_bcst_data: Couldn't bind() address %s:%d.\n",
190 stoa(sas), SRCPORT(sas)); 190 stoa(sas), SRCPORT(sas));
191 } 191 }
192 192
193#ifdef MCAST 193#ifdef MCAST
194 if (setsockopt(rsock, IPPROTO_IP, IP_MULTICAST_LOOP, &mtrue, sizeof(mtrue)) < 0) { 194 if (setsockopt(rsock, IPPROTO_IP, IP_MULTICAST_LOOP, &mtrue, sizeof(mtrue)) < 0) {
195 /* some error message regarding setting up multicast loop */ 195 /* some error message regarding setting up multicast loop */
196 return BROADCAST_FAILED; 196 return BROADCAST_FAILED;
197 } 197 }
198 mdevadr.imr_multiaddr.s_addr = NSRCADR(sas);  198 mdevadr.imr_multiaddr.s_addr = NSRCADR(sas);
199 mdevadr.imr_interface.s_addr = htonl(INADDR_ANY); 199 mdevadr.imr_interface.s_addr = htonl(INADDR_ANY);
200 if (mdevadr.imr_multiaddr.s_addr == -1) { 200 if (mdevadr.imr_multiaddr.s_addr == ~(unsigned)0) {
201 if (ENABLED_OPT(NORMALVERBOSE)) { 201 if (ENABLED_OPT(NORMALVERBOSE)) {
202 printf("sntp recv_bcst_data: %s:%d is not a broad-/multicast address, aborting...\n", 202 printf("sntp recv_bcst_data: %s:%d is not a broad-/multicast address, aborting...\n",
203 stoa(sas), SRCPORT(sas)); 203 stoa(sas), SRCPORT(sas));
204 } 204 }
205 return BROADCAST_FAILED; 205 return BROADCAST_FAILED;
206 } 206 }
207 if (setsockopt(rsock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mdevadr, sizeof(mdevadr)) < 0) { 207 if (setsockopt(rsock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mdevadr, sizeof(mdevadr)) < 0) {
208 if (ENABLED_OPT(NORMALVERBOSE)) { 208 if (ENABLED_OPT(NORMALVERBOSE)) {
209 buf = ss_to_str(sas); 209 buf = ss_to_str(sas);
210 printf("sntp recv_bcst_data: Couldn't add IP membership for %s\n", buf); 210 printf("sntp recv_bcst_data: Couldn't add IP membership for %s\n", buf);
211 free(buf); 211 free(buf);
212 } 212 }
213 } 213 }
@@ -283,47 +283,47 @@ recv_bcst_data ( @@ -283,47 +283,47 @@ recv_bcst_data (
283 if (IS_IPV6(sas)) 283 if (IS_IPV6(sas))
284 setsockopt(rsock, IPPROTO_IPV6, IPV6_LEAVE_GROUP, &btrue, sizeof(btrue)); 284 setsockopt(rsock, IPPROTO_IPV6, IPV6_LEAVE_GROUP, &btrue, sizeof(btrue));
285#endif 285#endif
286 return recv_bytes; 286 return recv_bytes;
287} 287}
288 288
289int 289int
290process_pkt ( 290process_pkt (
291 struct pkt *rpkt, 291 struct pkt *rpkt,
292 sockaddr_u *sas, 292 sockaddr_u *sas,
293 int pkt_len, 293 int pkt_len,
294 int mode, 294 int mode,
295 struct pkt *spkt, 295 struct pkt *spkt,
296 char * func_name 296 const char * func_name
297 ) 297 )
298{ 298{
299 unsigned int key_id = 0; 299 unsigned int key_id = 0;
300 struct key *pkt_key = NULL; 300 struct key *pkt_key = NULL;
301 int is_authentic = 0; 301 int is_authentic = 0;
302 unsigned int exten_words, exten_words_used = 0; 302 unsigned int exten_words, exten_words_used = 0;
303 int mac_size; 303 int mac_size;
304 /* 304 /*
305 * Parse the extension field if present. We figure out whether 305 * Parse the extension field if present. We figure out whether
306 * an extension field is present by measuring the MAC size. If 306 * an extension field is present by measuring the MAC size. If
307 * the number of words following the packet header is 0, no MAC 307 * the number of words following the packet header is 0, no MAC
308 * is present and the packet is not authenticated. If 1, the 308 * is present and the packet is not authenticated. If 1, the
309 * packet is a crypto-NAK; if 3, the packet is authenticated 309 * packet is a crypto-NAK; if 3, the packet is authenticated
310 * with DES; if 5, the packet is authenticated with MD5; if 6, 310 * with DES; if 5, the packet is authenticated with MD5; if 6,
311 * the packet is authenticated with SHA. If 2 or 4, the packet 311 * the packet is authenticated with SHA. If 2 or 4, the packet
312 * is a runt and discarded forthwith. If greater than 6, an 312 * is a runt and discarded forthwith. If greater than 6, an
313 * extension field is present, so we subtract the length of the 313 * extension field is present, so we subtract the length of the
314 * field and go around again. 314 * field and go around again.
315 */ 315 */
316 if (pkt_len < LEN_PKT_NOMAC || (pkt_len & 3) != 0) { 316 if (pkt_len < (int)LEN_PKT_NOMAC || (pkt_len & 3) != 0) {
317unusable: 317unusable:
318 if (ENABLED_OPT(NORMALVERBOSE)) 318 if (ENABLED_OPT(NORMALVERBOSE))
319 printf("sntp %s: Funny packet length: %i. Discarding package.\n", func_name, pkt_len); 319 printf("sntp %s: Funny packet length: %i. Discarding package.\n", func_name, pkt_len);
320 return PACKET_UNUSEABLE; 320 return PACKET_UNUSEABLE;
321 } 321 }
322 /* skip past the extensions, if any */ 322 /* skip past the extensions, if any */
323 exten_words = ((unsigned)pkt_len - LEN_PKT_NOMAC) >> 2; 323 exten_words = ((unsigned)pkt_len - LEN_PKT_NOMAC) >> 2;
324 while (exten_words > 6) { 324 while (exten_words > 6) {
325 unsigned int exten_len; 325 unsigned int exten_len;
326 exten_len = ntohl(rpkt->exten[exten_words_used]) & 0xffff; 326 exten_len = ntohl(rpkt->exten[exten_words_used]) & 0xffff;
327 exten_len = (exten_len + 7) >> 2; /* convert to words, add 1 */ 327 exten_len = (exten_len + 7) >> 2; /* convert to words, add 1 */
328 if (exten_len > exten_words || exten_len < 5) 328 if (exten_len > exten_words || exten_len < 5)
329 goto unusable; 329 goto unusable;

cvs diff -r1.1.1.2 -r1.2 src/external/bsd/ntp/dist/sntp/libopts/numeric.c (expand / switch to unified diff)

--- src/external/bsd/ntp/dist/sntp/libopts/numeric.c 2012/01/31 21:27:49 1.1.1.2
+++ src/external/bsd/ntp/dist/sntp/libopts/numeric.c 2012/02/01 20:48:01 1.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: numeric.c,v 1.1.1.2 2012/01/31 21:27:49 kardel Exp $ */ 1/* $NetBSD: numeric.c,v 1.2 2012/02/01 20:48:01 kardel Exp $ */
2 2
3 3
4/** 4/**
5 * \file numeric.c 5 * \file numeric.c
6 * 6 *
7 * Time-stamp: "2011-03-25 16:26:10 bkorb" 7 * Time-stamp: "2011-03-25 16:26:10 bkorb"
8 * 8 *
9 * This file is part of AutoOpts, a companion to AutoGen. 9 * This file is part of AutoOpts, a companion to AutoGen.
10 * AutoOpts is free software. 10 * AutoOpts is free software.
11 * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved 11 * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
12 * 12 *
13 * AutoOpts is available under any one of two licenses. The license 13 * AutoOpts is available under any one of two licenses. The license
14 * in use must be one of these two and the choice is under the control 14 * in use must be one of these two and the choice is under the control
@@ -30,27 +30,27 @@ @@ -30,27 +30,27 @@
30/*=export_func optionShowRange 30/*=export_func optionShowRange
31 * private: 31 * private:
32 * 32 *
33 * what:  33 * what:
34 * arg: + tOptions* + pOpts + program options descriptor + 34 * arg: + tOptions* + pOpts + program options descriptor +
35 * arg: + tOptDesc* + pOptDesc + the descriptor for this arg + 35 * arg: + tOptDesc* + pOptDesc + the descriptor for this arg +
36 * arg: + void * + rng_table + the value range tables + 36 * arg: + void * + rng_table + the value range tables +
37 * arg: + int + rng_count + the number of entries + 37 * arg: + int + rng_count + the number of entries +
38 * 38 *
39 * doc: 39 * doc:
40 * Show information about a numeric option with range constraints. 40 * Show information about a numeric option with range constraints.
41=*/ 41=*/
42void 42void
43optionShowRange(tOptions* pOpts, tOptDesc* pOD, void * rng_table, int rng_ct) 43optionShowRange(tOptions* pOpts, tOptDesc* pOD, const void * rng_table, int rng_ct)
44{ 44{
45 static char const bullet[] = "\t\t\t\t- "; 45 static char const bullet[] = "\t\t\t\t- ";
46 static char const deepin[] = "\t\t\t\t "; 46 static char const deepin[] = "\t\t\t\t ";
47 static char const onetab[] = "\t"; 47 static char const onetab[] = "\t";
48 48
49 const struct {long const rmin, rmax;} * rng = rng_table; 49 const struct {long const rmin, rmax;} * rng = rng_table;
50 50
51 char const * pz_indent = bullet; 51 char const * pz_indent = bullet;
52 52
53 /* 53 /*
54 * The range is shown only for full usage requests and an error 54 * The range is shown only for full usage requests and an error
55 * in this particular option. 55 * in this particular option.
56 */ 56 */

cvs diff -r1.3 -r1.4 src/external/bsd/ntp/dist/sntp/libopts/autoopts/options.h (expand / switch to unified diff)

--- src/external/bsd/ntp/dist/sntp/libopts/autoopts/options.h 2012/02/01 07:46:30 1.3
+++ src/external/bsd/ntp/dist/sntp/libopts/autoopts/options.h 2012/02/01 20:48:01 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: options.h,v 1.3 2012/02/01 07:46:30 kardel Exp $ */ 1/* $NetBSD: options.h,v 1.4 2012/02/01 20:48:01 kardel Exp $ */
2 2
3/* -*- buffer-read-only: t -*- vi: set ro: 3/* -*- buffer-read-only: t -*- vi: set ro:
4 *  4 *
5 * DO NOT EDIT THIS FILE (options.h) 5 * DO NOT EDIT THIS FILE (options.h)
6 *  6 *
7 * It has been AutoGen-ed April 29, 2011 at 03:44:02 PM by AutoGen 5.11.9 7 * It has been AutoGen-ed April 29, 2011 at 03:44:02 PM by AutoGen 5.11.9
8 * From the definitions funcs.def 8 * From the definitions funcs.def
9 * and the template file options_h 9 * and the template file options_h
10 * 10 *
11 * This file defines all the global structures and special values 11 * This file defines all the global structures and special values
12 * used in the automated option processing library. 12 * used in the automated option processing library.
13 * 13 *
14 * Automated Options Copyright (C) 1992-2011 by Bruce Korb 14 * Automated Options Copyright (C) 1992-2011 by Bruce Korb
@@ -1030,27 +1030,27 @@ extern void optionNumericVal(tOptions*,  @@ -1030,27 +1030,27 @@ extern void optionNumericVal(tOptions*,
1030 1030
1031extern void optionPagedUsage(tOptions*, tOptDesc*); 1031extern void optionPagedUsage(tOptions*, tOptDesc*);
1032 1032
1033extern void optionParseShell(tOptions*); 1033extern void optionParseShell(tOptions*);
1034 1034
1035extern void optionPrintVersion(tOptions*, tOptDesc*); 1035extern void optionPrintVersion(tOptions*, tOptDesc*);
1036 1036
1037extern void optionPutShell(tOptions*); 1037extern void optionPutShell(tOptions*);
1038 1038
1039extern void optionResetOpt(tOptions*, tOptDesc*); 1039extern void optionResetOpt(tOptions*, tOptDesc*);
1040 1040
1041extern void optionSetMembers(tOptions*, tOptDesc*, char const * const *, unsigned int); 1041extern void optionSetMembers(tOptions*, tOptDesc*, char const * const *, unsigned int);
1042 1042
1043extern void optionShowRange(tOptions*, tOptDesc*, void *, int); 1043extern void optionShowRange(tOptions*, tOptDesc*, const void *, int);
1044 1044
1045extern void optionStackArg(tOptions*, tOptDesc*); 1045extern void optionStackArg(tOptions*, tOptDesc*);
1046 1046
1047extern void optionTimeDate(tOptions*, tOptDesc*); 1047extern void optionTimeDate(tOptions*, tOptDesc*);
1048 1048
1049extern void optionTimeVal(tOptions*, tOptDesc*); 1049extern void optionTimeVal(tOptions*, tOptDesc*);
1050 1050
1051extern void optionUnstackArg(tOptions*, tOptDesc*); 1051extern void optionUnstackArg(tOptions*, tOptDesc*);
1052 1052
1053extern void optionUsage(tOptions*, int); 1053extern void optionUsage(tOptions*, int);
1054 1054
1055extern void optionVersionStderr(tOptions*, tOptDesc*); 1055extern void optionVersionStderr(tOptions*, tOptDesc*);
1056 1056

cvs diff -r1.3 -r1.4 src/external/bsd/ntp/dist/util/ntp-keygen-opts.c (expand / switch to unified diff)

--- src/external/bsd/ntp/dist/util/ntp-keygen-opts.c 2012/02/01 07:46:30 1.3
+++ src/external/bsd/ntp/dist/util/ntp-keygen-opts.c 2012/02/01 20:48:02 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ntp-keygen-opts.c,v 1.3 2012/02/01 07:46:30 kardel Exp $ */ 1/* $NetBSD: ntp-keygen-opts.c,v 1.4 2012/02/01 20:48:02 kardel Exp $ */
2 2
3/*  3/*
4 * EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.c) 4 * EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.c)
5 *  5 *
6 * It has been AutoGen-ed December 24, 2011 at 06:34:40 PM by AutoGen 5.12 6 * It has been AutoGen-ed December 24, 2011 at 06:34:40 PM by AutoGen 5.12
7 * From the definitions ntp-keygen-opts.def 7 * From the definitions ntp-keygen-opts.def
8 * and the template file options 8 * and the template file options
9 * 9 *
10 * Generated from AutoOpts 35:0:10 templates. 10 * Generated from AutoOpts 35:0:10 templates.
11 * 11 *
12 * AutoOpts is a copyrighted work. This source file is not encumbered 12 * AutoOpts is a copyrighted work. This source file is not encumbered
13 * by AutoOpts licensing, but is provided under the licensing terms chosen 13 * by AutoOpts licensing, but is provided under the licensing terms chosen
14 * by the ntp-keygen author or copyright holder. AutoOpts is 14 * by the ntp-keygen author or copyright holder. AutoOpts is
@@ -848,27 +848,27 @@ doOptModulus(tOptions* pOptions, tOptDes @@ -848,27 +848,27 @@ doOptModulus(tOptions* pOptions, tOptDes
848 continue; /* ranges need not be ordered. */ 848 continue; /* ranges need not be ordered. */
849 if (pOptDesc->optArg.argInt == rng[ix].rmin) 849 if (pOptDesc->optArg.argInt == rng[ix].rmin)
850 return; 850 return;
851 if (rng[ix].rmax == LONG_MIN) 851 if (rng[ix].rmax == LONG_MIN)
852 continue; 852 continue;
853 if (pOptDesc->optArg.argInt <= rng[ix].rmax) 853 if (pOptDesc->optArg.argInt <= rng[ix].rmax)
854 return; 854 return;
855 } 855 }
856 856
857 option_usage_fp = stderr; 857 option_usage_fp = stderr;
858 858
859emit_ranges: 859emit_ranges:
860 860
861 optionShowRange(pOptions, pOptDesc, (void *)rng, 1); 861 optionShowRange(pOptions, pOptDesc, (const void *)rng, 1);
862} 862}
863#endif /* defined OPENSSL */ 863#endif /* defined OPENSSL */
864/* extracted from optmain.tlib near line 128 */ 864/* extracted from optmain.tlib near line 128 */
865 865
866#if defined(TEST_NTP_KEYGEN_OPTS) /* TEST MAIN PROCEDURE: */ 866#if defined(TEST_NTP_KEYGEN_OPTS) /* TEST MAIN PROCEDURE: */
867 867
868extern void optionPutShell(tOptions*); 868extern void optionPutShell(tOptions*);
869 869
870int 870int
871main(int argc, char ** argv) 871main(int argc, char ** argv)
872{ 872{
873 int res = NTP_KEYGEN_EXIT_SUCCESS; 873 int res = NTP_KEYGEN_EXIT_SUCCESS;
874 (void)optionProcess(&ntp_keygenOptions, argc, argv); 874 (void)optionProcess(&ntp_keygenOptions, argc, argv);