/*
* We need to get by the [] if they were entered
*/
-
+
cp = hname;
-
+
if (*cp == '[') {
cp++;
for (i = 0; *cp && *cp != ']'; cp++, i++)
#ifdef AI_ADDRCONFIG
hints.ai_flags |= AI_ADDRCONFIG;
#endif
- a_info = getaddrinfo(hname, svc, &hints, &ai);
+ a_info = getaddrinfo(hname, svc, &hints, &ai);
}
#ifdef AI_ADDRCONFIG
/* Some older implementations don't like AI_ADDRCONFIG. */
if (a_info == EAI_BADFLAGS) {
hints.ai_flags &= ~AI_ADDRCONFIG;
- a_info = getaddrinfo(hname, svc, &hints, &ai);
+ a_info = getaddrinfo(hname, svc, &hints, &ai);
}
#endif
if (a_info != 0) {
return 0;
}
-
+
#ifdef NEED_RCVBUF_SLOP
# ifdef SO_RCVBUF
{ int rbufsize = DATASIZE + 2048; /* 2K for slop */
tvo = tvout;
else
tvo = tvsout;
-
+
FD_SET(sockfd, &fds);
n = select(sockfd + 1, &fds, NULL, NULL, &tvo);
* Find the position for the fragment relative to any
* previously received.
*/
- for (f = 0;
- f < numfrags && offsets[f] < offset;
+ for (f = 0;
+ f < numfrags && offsets[f] < offset;
f++) {
/* empty body */ ;
}
*/
if (!auth && !always_auth) {
return sendpkt(&qpkt, pktsize);
- }
+ }
/*
* Pad out packet to a multiple of 8 octets to be sure
if (info_auth_keyid == 0) {
key_id = getkeyid("Keyid: ");
if (key_id == 0 || key_id > NTP_MAXKEY) {
- fprintf(stderr,
+ fprintf(stderr,
"Invalid key identifier\n");
return 1;
}
* Do the encryption.
*/
maclen = authencrypt(info_auth_keyid, (void *)&qpkt, pktsize);
- if (!maclen) {
+ if (!maclen) {
fprintf(stderr, "Key not found\n");
return 1;
} else if ((size_t)maclen != (info_auth_hashlen + sizeof(keyid_t))) {
(u_long)info_auth_hashlen);
return 1;
}
-
+
return sendpkt((char *)&qpkt, pktsize + maclen);
}
res = sendrequest(opcode, associd, auth, qsize, qdata);
if (res != 0)
return res;
-
+
/*
* Get the response. If we got a standard error, print a message
*/
tokenize(cmdline, tokens, &ntok);
if (ntok == 0)
return;
-
+
/*
* Find the appropriate command description.
*/
tokens[0]);
return;
}
-
+
+ /* Warn about ignored extra args */
+ for (i = MAXARGS + 1; i < ntok ; ++i) {
+ fprintf(stderr, "***Extra arg `%s' ignored\n", tokens[i]);
+ }
+
/*
* Save the keyword, then walk through the arguments, interpreting
* as we go.
/*
* tokenize - turn a command line into tokens
*
- * SK: Modified to allow a quoted string
+ * SK: Modified to allow a quoted string
*
* HMS: If the first character of the first token is a ':' then (after
* eating inter-token whitespace) the 2nd token is the rest of the line.
#ifdef AI_ADDRCONFIG
hints.ai_flags |= AI_ADDRCONFIG;
#endif
-
+
/*
* decodenetnum only works with addresses, but handles syntax
* that getaddrinfo doesn't: [2001::1]:1234
return sptoa(netnum);
else if (ISREFCLOCKADR(netnum))
return refnumtoa(netnum);
-
+
hostn = socktohost(netnum);
LIB_GETBUF(buf);
snprintf(buf, LIB_BUFLENGTH, "%s:%u", hostn, SRCPORT(netnum));
if (*cp++ != '-')
return 0;
-
+
for (i = 0; i < 3; i++)
buf[i] = *cp++;
buf[3] = '\0';
if (*cp++ != '-')
return 0;
-
+
if (!isdigit((int)*cp))
return 0;
cal.year = (u_short)(*cp++ - '0');
qsort((void *)list, words, sizeof(list[0]), helpsort);
col = 0;
for (word = 0; word < words; word++) {
- length = strlen(list[word]);
+ length = strlen(list[word]);
col = max(col, length);
}
{
register int i;
+ /* XXX: Do we need to warn about extra args here too? */
+
(void) fprintf(fp, "usage: %s", xcp->keyword);
for (i = 0; i < MAXARGS && xcp->arg[i] != NO; i++) {
if (xcp->arg[i] & OPT)
size_t sl;
char * out;
-
+
sl = strlen(src);
if (sl > width && LIB_BUFLENGTH - 1 > width && width > 0) {
LIB_GETBUF(out);
cp++;
if (cp >= cpend)
return 0;
-
+
/*
* Copy name until we hit a ',', an '=', a '\r' or a '\n'. Backspace
* over any white space and terminate it.
*/
for (i = (int)strlen(name); i < 11; i++)
*bp++ = ' ';
-
+
for (i = narr; i > 0; i--) {
if (i != narr)
*bp++ = ' ';
output(fp, name, stoa(&hval));
}
break;
-
+
case RF:
if (decodenetnum(value, &hval)) {
if (ISREFCLOCKADR(&hval))
output(fp, name, b);
}
break;
-
+
case AR:
if (!decodearr(value, &narr, lfparr))
output_raw = '?';
else
output(fp, name, tstflags(uval));
break;
-
+
default:
fprintf(stderr, "Internal error in cookedprint, %s=%s, fmt %d\n",
name, value, fmt);
)
{
switch (pOptDesc->optValue) {
-
+
default:
- fprintf(stderr,
+ fprintf(stderr,
"ntpq_custom_opt_handler unexpected option '%c' (%d)\n",
pOptDesc->optValue, pOptDesc->optValue);
exit(-1);