Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Jun 2010 12:52:33 +0000 (UTC)
From:      Ed Schouten <ed@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r209366 - head/sbin/ping
Message-ID:  <201006201252.o5KCqXqY007734@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ed
Date: Sun Jun 20 12:52:33 2010
New Revision: 209366
URL: http://svn.freebsd.org/changeset/base/209366

Log:
  Small style fixes:
  
  - ANSIfy prototypes.
  - Remove unneeded whitespace.
  - Add const keyword to function where it can be used.

Modified:
  head/sbin/ping/ping.c

Modified: head/sbin/ping/ping.c
==============================================================================
--- head/sbin/ping/ping.c	Sun Jun 20 10:23:46 2010	(r209365)
+++ head/sbin/ping/ping.c	Sun Jun 20 12:52:33 2010	(r209366)
@@ -210,13 +210,11 @@ static void pr_pack(char *, int, struct 
 static void pr_retip(struct ip *);
 static void status(int);
 static void stopit(int);
-static void tvsub(struct timeval *, struct timeval *);
+static void tvsub(struct timeval *, const struct timeval *);
 static void usage(void) __dead2;
 
 int
-main(argc, argv)
-	int argc;
-	char *const *argv;
+main(int argc, char *const *argv)
 {
 	struct sockaddr_in from, sock_in;
 	struct in_addr ifaddr;
@@ -916,8 +914,7 @@ main(argc, argv)
  * to be called from a signal handler.
  */
 void
-stopit(sig)
-	int sig __unused;
+stopit(int sig __unused)
 {
 
 	/*
@@ -1012,11 +1009,7 @@ pinger(void)
  * program to be run without having intermingled output (or statistics!).
  */
 static void
-pr_pack(buf, cc, from, tv)
-	char *buf;
-	int cc;
-	struct sockaddr_in *from;
-	struct timeval *tv;
+pr_pack(char *buf, int cc, struct sockaddr_in *from, struct timeval *tv)
 {
 	struct in_addr ina;
 	u_char *cp, *dp;
@@ -1280,9 +1273,7 @@ pr_pack(buf, cc, from, tv)
  *	Checksum routine for Internet Protocol family headers (C Version)
  */
 u_short
-in_cksum(addr, len)
-	u_short *addr;
-	int len;
+in_cksum(u_short *addr, int len)
 {
 	int nleft, sum;
 	u_short *w;
@@ -1326,8 +1317,7 @@ in_cksum(addr, len)
  * be >= in.
  */
 static void
-tvsub(out, in)
-	struct timeval *out, *in;
+tvsub(struct timeval *out, const struct timeval *in)
 {
 
 	if ((out->tv_usec -= in->tv_usec) < 0) {
@@ -1343,15 +1333,14 @@ tvsub(out, in)
  */
 
 static void
-status(sig)
-	int sig __unused;
+status(int sig __unused)
 {
 
 	siginfo_p = 1;
 }
 
 static void
-check_status()
+check_status(void)
 {
 
 	if (siginfo_p) {
@@ -1371,7 +1360,7 @@ check_status()
  *	Print out statistics, and give up.
  */
 static void
-finish()
+finish(void)
 {
 
 	(void)signal(SIGINT, SIG_IGN);
@@ -1430,8 +1419,7 @@ static char *ttab[] = {
  *	Print a descriptive string about an ICMP header.
  */
 static void
-pr_icmph(icp)
-	struct icmp *icp;
+pr_icmph(struct icmp *icp)
 {
 
 	switch(icp->icmp_type) {
@@ -1578,8 +1566,7 @@ pr_icmph(icp)
  *	Print an IP header with options.
  */
 static void
-pr_iph(ip)
-	struct ip *ip;
+pr_iph(struct ip *ip)
 {
 	u_char *cp;
 	int hlen;
@@ -1611,8 +1598,7 @@ pr_iph(ip)
  * a hostname.
  */
 static char *
-pr_addr(ina)
-	struct in_addr ina;
+pr_addr(struct in_addr ina)
 {
 	struct hostent *hp;
 	static char buf[16 + 3 + MAXHOSTNAMELEN];
@@ -1631,8 +1617,7 @@ pr_addr(ina)
  *	Dump some info on a returned (via ICMP) IP packet.
  */
 static void
-pr_retip(ip)
-	struct ip *ip;
+pr_retip(struct ip *ip)
 {
 	u_char *cp;
 	int hlen;
@@ -1650,7 +1635,7 @@ pr_retip(ip)
 }
 
 static char *
-pr_ntime (n_time timestamp)
+pr_ntime(n_time timestamp)
 {
 	static char buf[10];
 	int hour, min, sec;
@@ -1666,8 +1651,7 @@ pr_ntime (n_time timestamp)
 }
 
 static void
-fill(bp, patp)
-	char *bp, *patp;
+fill(char *bp, char *patp)
 {
 	char *cp;
 	int pat[16];
@@ -1703,7 +1687,7 @@ fill(bp, patp)
 #define	SECOPT		""
 #endif
 static void
-usage()
+usage(void)
 {
 
 	(void)fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201006201252.o5KCqXqY007734>