Add __FBSDID. Replace local variable sin by sockin to not conflict with sin(3).

Use warnx() instead of warn() when error message is not of any interest. Add
prototypes.
This commit is contained in:
charnier 2004-07-26 20:18:11 +00:00
parent 0a8bce8ca9
commit cd48a1d32b
14 changed files with 82 additions and 78 deletions

View File

@ -31,13 +31,14 @@
* SUCH DAMAGE.
*/
#if 0
#ifndef lint
/*
static char sccsid[] = "@(#)atalk.c 1.1 (Whistle) 6/6/96";
*/
static const char rcsid[] =
"$FreeBSD$";
#endif /* not lint */
#endif
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/queue.h>

View File

@ -31,13 +31,14 @@
* SUCH DAMAGE.
*/
#if 0
#ifndef lint
/*
static char sccsid[] = "@(#)if.c 8.3 (Berkeley) 4/28/95";
*/
static const char rcsid[] =
"$FreeBSD$";
#endif /* not lint */
#endif
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/protosw.h>
@ -210,9 +211,9 @@ intpr(int _interval, u_long ifnetaddr, void (*pfunc)(char *))
}
ifaddraddr = 0;
while (ifnetaddr || ifaddraddr) {
struct sockaddr_in *sin;
struct sockaddr_in *sockin;
#ifdef INET6
struct sockaddr_in6 *sin6;
struct sockaddr_in6 *sockin6;
#endif
char *cp;
int n, m;
@ -291,7 +292,7 @@ intpr(int _interval, u_long ifnetaddr, void (*pfunc)(char *))
printf("%-15.15s ", "none");
break;
case AF_INET:
sin = (struct sockaddr_in *)sa;
sockin = (struct sockaddr_in *)sa;
#ifdef notdef
/* can't use inet_makeaddr because kernel
* keeps nets unshifted.
@ -306,19 +307,19 @@ intpr(int _interval, u_long ifnetaddr, void (*pfunc)(char *))
ifaddr.in.ia_subnetmask));
#endif
printf("%-17.17s ",
routename(sin->sin_addr.s_addr));
routename(sockin->sin_addr.s_addr));
network_layer = 1;
break;
#ifdef INET6
case AF_INET6:
sin6 = (struct sockaddr_in6 *)sa;
sockin6 = (struct sockaddr_in6 *)sa;
printf("%-13.13s ",
netname6(&ifaddr.in6.ia_addr,
&ifaddr.in6.ia_prefixmask.sin6_addr));
printf("%-17.17s ",
inet_ntop(AF_INET6,
&sin6->sin6_addr,
&sockin6->sin6_addr,
ntop_buf, sizeof(ntop_buf)));
network_layer = 1;

View File

@ -31,13 +31,14 @@
* SUCH DAMAGE.
*/
#if 0
#ifndef lint
/*
static char sccsid[] = "@(#)inet.c 8.5 (Berkeley) 5/24/95";
*/
static const char rcsid[] =
"$FreeBSD$";
#endif /* not lint */
#endif
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/queue.h>
@ -142,7 +143,7 @@ protopr(u_long proto, /* for sysctl version we pass proto # */
return;
}
if ((buf = malloc(len)) == 0) {
warn("malloc %lu bytes", (u_long)len);
warnx("malloc %lu bytes", (u_long)len);
return;
}
if (sysctlbyname(mibvar, buf, &len, 0, 0) < 0) {

View File

@ -30,15 +30,16 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#if 0
#ifndef lint
/*
static char sccsid[] = "@(#)inet6.c 8.4 (Berkeley) 4/20/94";
*/
#endif /* not lint */
#endif
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#ifdef INET6
#include <sys/param.h>
@ -72,7 +73,8 @@ static char sccsid[] = "@(#)inet6.c 8.4 (Berkeley) 4/20/94";
struct socket sockb;
char *inet6name (struct in6_addr *);
char *inet6name(struct in6_addr *);
const char *pluralies(int);
static char ntop_buf[INET6_ADDRSTRLEN];

View File

@ -63,15 +63,14 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "from: @(#)inet.c 8.4 (Berkeley) 4/20/94";
#else
static const char rcsid[] =
"$FreeBSD$";
#endif
#ifndef lint
static char sccsid[] = "@(#)inet.c 8.5 (Berkeley) 5/24/95";
#endif /* not lint */
#endif
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/queue.h>

View File

@ -31,13 +31,14 @@
* SUCH DAMAGE.
*/
#if 0
#ifndef lint
/*
static char sccsid[] = "@(#)ns.c 8.1 (Berkeley) 6/6/93";
*/
static const char rcsid[] =
"$FreeBSD$";
#endif /* not lint */
#endif
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/queue.h>
@ -74,6 +75,7 @@ struct socket sockb;
static char *ipx_prpr (struct ipx_addr *);
static int first = 1;
extern char *tcpstates[];
/*
* Print a summary of connections related to a Network Systems
@ -139,7 +141,6 @@ ipxprotopr(u_long off, const char *name, int af1 __unused)
printf(Aflag?" %-18.18s":" %-22.22s", ipx_prpr(&ipxpcb.ipxp_laddr));
printf(Aflag?" %-18.18s":" %-22.22s", ipx_prpr(&ipxpcb.ipxp_faddr));
if (isspx) {
extern char *tcpstates[];
if (spxpcb.s_state >= TCP_NSTATES)
printf(" %d", spxpcb.s_state);
else

View File

@ -37,13 +37,14 @@ char const copyright[] =
Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
#if 0
#ifndef lint
static char sccsid[] = "@(#)main.c 8.4 (Berkeley) 3/1/94";
#endif
static const char rcsid[] =
"$FreeBSD$";
#endif /* not lint */
#endif
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/file.h>
@ -245,10 +246,11 @@ struct protox *protoprotox[] = {
#endif
ipxprotox, atalkprotox, NULL };
static void printproto (struct protox *, const char *);
static void usage (void);
static struct protox *name2protox (char *);
static struct protox *knownname (char *);
const char *pluralies(int);
static void printproto(struct protox *, const char *);
static void usage(void);
static struct protox *name2protox(char *);
static struct protox *knownname(char *);
static kvm_t *kvmd;
static char *nlistf = NULL, *memf = NULL;

View File

@ -31,13 +31,14 @@
* SUCH DAMAGE.
*/
#ifndef lint
#if 0
#ifndef lint
static char sccsid[] = "@(#)mbuf.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$FreeBSD$";
#endif /* not lint */
#endif
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/mbuf.h>

View File

@ -25,10 +25,8 @@
*
*/
#ifndef lint
static const char rcsid[] =
"$FreeBSD$";
#endif /* not lint */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
/*
* Print the system's current multicast group memberships.

View File

@ -37,10 +37,8 @@
* @(#)mroute.c 8.2 (Berkeley) 4/28/95
*/
#ifndef lint
static const char rcsid[] =
"$FreeBSD$";
#endif /* not lint */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
/*
* Print multicast routing structures and statistics.

View File

@ -64,9 +64,11 @@
* SUCH DAMAGE.
*
* @(#)mroute.c 8.2 (Berkeley) 4/28/95
* $FreeBSD$
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#ifdef INET6
#include <sys/param.h>
#include <sys/queue.h>

View File

@ -30,14 +30,10 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef lint
static const char rcsid[] =
"$Id: atalk.c,v 1.11 1998/07/06 21:01:22 bde Exp $";
#endif /* not lint */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/queue.h>

View File

@ -31,13 +31,14 @@
* SUCH DAMAGE.
*/
#ifndef lint
#if 0
#ifndef lint
static char sccsid[] = "From: @(#)route.c 8.6 (Berkeley) 4/28/95";
#endif
static const char rcsid[] =
"$FreeBSD$";
#endif /* not lint */
#endif
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/protosw.h>
@ -486,7 +487,7 @@ ntreestuff(void)
}
if ((buf = malloc(needed)) == 0) {
err(2, "malloc(%lu)", (unsigned long)needed);
errx(2, "malloc(%lu)", (unsigned long)needed);
}
if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0) {
err(1, "sysctl: net.route.0.0.dump");
@ -563,21 +564,21 @@ fmt_sockaddr(struct sockaddr *sa, struct sockaddr *mask, int flags)
switch(sa->sa_family) {
case AF_INET:
{
struct sockaddr_in *sin = (struct sockaddr_in *)sa;
struct sockaddr_in *sockin = (struct sockaddr_in *)sa;
if ((sin->sin_addr.s_addr == INADDR_ANY) &&
if ((sockin->sin_addr.s_addr == INADDR_ANY) &&
mask &&
ntohl(((struct sockaddr_in *)mask)->sin_addr.s_addr)
==0L)
cp = "default" ;
else if (flags & RTF_HOST)
cp = routename(sin->sin_addr.s_addr);
cp = routename(sockin->sin_addr.s_addr);
else if (mask)
cp = netname(sin->sin_addr.s_addr,
cp = netname(sockin->sin_addr.s_addr,
ntohl(((struct sockaddr_in *)mask)
->sin_addr.s_addr));
else
cp = netname(sin->sin_addr.s_addr, 0L);
cp = netname(sockin->sin_addr.s_addr, 0L);
break;
}

View File

@ -31,13 +31,14 @@
* SUCH DAMAGE.
*/
#ifndef lint
#if 0
#ifndef lint
static char sccsid[] = "@(#)unix.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$FreeBSD$";
#endif /* not lint */
#endif
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
/*
* Display protocol blocks in the unix domain.
@ -88,7 +89,7 @@ unixpr(void)
continue;
}
if ((buf = malloc(len)) == 0) {
warn("malloc %lu bytes", (u_long)len);
warnx("malloc %lu bytes", (u_long)len);
return;
}
if (sysctlbyname(mibvar, buf, &len, 0, 0) < 0) {