style(9) cleanup.

Submitted by:	kris (an early version of this patch)
Reviewed by:	bde
Approved by:	ru
MFC after:	2 weeks
This commit is contained in:
Maxim Konovalov 2002-04-02 09:36:46 +00:00
parent 3419a3b021
commit 1ad0b1beb4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=93638

View File

@ -206,6 +206,7 @@ main(argc, argv)
struct timeval last, intvl;
struct hostent *hp;
struct sockaddr_in *to;
double t;
u_char *datap, *packet;
char *ep, *source, *target;
#ifdef IPSEC_POLICY_IPSEC
@ -275,23 +276,16 @@ main(argc, argv)
setbuf(stdout, (char *)NULL);
break;
case 'i': /* wait between sending packets */
{
double t = strtod(optarg, &ep) * 1000.0;
if (*ep || ep == optarg || t > (double)INT_MAX) {
errx(
EX_USAGE,
"invalid timing interval: `%s'",
optarg
);
}
t = strtod(optarg, &ep) * 1000.0;
if (*ep || ep == optarg || t > (double)INT_MAX)
errx(EX_USAGE, "invalid timing interval: `%s'",
optarg);
options |= F_INTERVAL;
interval = (int)t;
if (uid && interval < 1000) {
errno = EPERM;
err(EX_NOPERM, "-i interval too short");
}
}
break;
case 'I': /* multicast interface */
if (inet_aton(optarg, &ifaddr) == 0)
@ -318,8 +312,7 @@ main(argc, argv)
case 'm': /* TTL */
ultmp = strtoul(optarg, &ep, 0);
if (*ep || ep == optarg || ultmp > 255)
errx(EX_USAGE, "invalid TTL: `%s'",
optarg);
errx(EX_USAGE, "invalid TTL: `%s'", optarg);
ttl = ultmp;
options |= F_TTL;
break;
@ -491,7 +484,8 @@ main(argc, argv)
errx(EX_CONFIG, "%s", ipsec_strerror());
if (setsockopt(s, IPPROTO_IP, IP_IPSEC_POLICY,
buf, ipsec_get_policylen(buf)) < 0)
err(EX_CONFIG, "ipsec policy cannot be configured");
err(EX_CONFIG,
"ipsec policy cannot be configured");
free(buf);
}
@ -501,7 +495,8 @@ main(argc, argv)
errx(EX_CONFIG, "%s", ipsec_strerror());
if (setsockopt(s, IPPROTO_IP, IP_IPSEC_POLICY,
buf, ipsec_get_policylen(buf)) < 0)
err(EX_CONFIG, "ipsec policy cannot be configured");
err(EX_CONFIG,
"ipsec policy cannot be configured");
free(buf);
}
}
@ -886,14 +881,14 @@ pr_pack(buf, cc, from, tv)
if (*cp != *dp) {
(void)printf("\nwrong data byte #%d should be 0x%x but was 0x%x",
i, *dp, *cp);
printf("\ncp:");
(void)printf("\ncp:");
cp = (u_char*)&icp->icmp_data[0];
for (i = 0; i < datalen; ++i, ++cp) {
if ((i % 32) == 8)
(void)printf("\n\t");
(void)printf("%x ", *cp);
}
printf("\ndp:");
(void)printf("\ndp:");
cp = &outpack[8];
for (i = 0; i < datalen; ++i, ++cp) {
if ((i % 32) == 8)
@ -955,11 +950,12 @@ pr_pack(buf, cc, from, tv)
l = (l<<8) + *++cp;
l = (l<<8) + *++cp;
if (l == 0) {
printf("\t0.0.0.0");
(void)printf("\t0.0.0.0");
} else {
struct in_addr ina;
ina.s_addr = ntohl(l);
printf("\t%s", pr_addr(ina));
(void)printf("\t%s",
pr_addr(ina));
}
hlen -= 4;
j -= 4;
@ -1001,11 +997,11 @@ pr_pack(buf, cc, from, tv)
l = (l<<8) + *++cp;
l = (l<<8) + *++cp;
if (l == 0) {
printf("\t0.0.0.0");
(void)printf("\t0.0.0.0");
} else {
struct in_addr ina;
ina.s_addr = ntohl(l);
printf("\t%s", pr_addr(ina));
(void)printf("\t%s", pr_addr(ina));
}
hlen -= 4;
i -= 4;
@ -1155,8 +1151,8 @@ finish()
double n = nreceived + nrepeats;
double avg = tsum / n;
double vari = tsumsq / n - avg * avg;
printf("round-trip min/avg/max/stddev = "
"%.3f/%.3f/%.3f/%.3f ms\n",
(void)printf(
"round-trip min/avg/max/stddev = %.3f/%.3f/%.3f/%.3f ms\n",
tmin, avg, tmax, sqrt(vari));
}
if (reset_kerninfo && tcgetattr(STDOUT_FILENO, &ts) != -1) {
@ -1447,7 +1443,7 @@ fill(bp, patp)
static void
usage()
{
fprintf(stderr, "%s\n%s\n%s\n",
(void)fprintf(stderr, "%s\n%s\n%s\n",
"usage: ping [-QRadfnqrv] [-c count] [-i wait] [-l preload] [-m ttl]",
" [-p pattern] "
#ifdef IPSEC