summaryrefslogtreecommitdiff
path: root/sbin/route/route.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-01-08 07:32:13 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-01-08 07:32:13 +0000
commit02f8d2bd154374eb838e10623afe40ca37374fbf (patch)
treec6dfcfb8b5c89a4e64c285811896beee0c7427aa /sbin/route/route.c
parent29ea1e379a9c338ff01d1cb70072a389be168462 (diff)
Produce less output on -q as promised by the man page;
from jhawk@mit.edu; netbsd pr#998
Diffstat (limited to 'sbin/route/route.c')
-rw-r--r--sbin/route/route.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/sbin/route/route.c b/sbin/route/route.c
index 7ebc136f5f8..8c2e31a2d05 100644
--- a/sbin/route/route.c
+++ b/sbin/route/route.c
@@ -1,4 +1,4 @@
-/* $NetBSD: route.c,v 1.14 1995/04/20 20:52:46 mycroft Exp $ */
+/* $NetBSD: route.c,v 1.15 1996/01/07 00:07:23 pk Exp $ */
/*
* Copyright (c) 1983, 1989, 1991, 1993
@@ -43,7 +43,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)route.c 8.3 (Berkeley) 3/19/94";
#else
-static char rcsid[] = "$NetBSD: route.c,v 1.14 1995/04/20 20:52:46 mycroft Exp $";
+static char rcsid[] = "$NetBSD: route.c,v 1.15 1996/01/07 00:07:23 pk Exp $";
#endif
#endif /* not lint */
@@ -636,7 +636,7 @@ newroute(argc, argv)
int ret = atoi(*argv);
if (ret == 0) {
- if (strcmp(*argv, "0") == 0)
+ if (!qflag && strcmp(*argv, "0") == 0)
printf("%s,%s",
"old usage of trailing 0",
"assuming route to if\n");
@@ -645,8 +645,10 @@ newroute(argc, argv)
iflag = 1;
continue;
} else if (ret > 0 && ret < 10) {
- printf("old usage of trailing digit, ");
- printf("assuming route via gateway\n");
+ if (!qflag) {
+ printf("old usage of trailing digit, ");
+ printf("assuming route via gateway\n");
+ }
iflag = 0;
continue;
}
@@ -679,16 +681,19 @@ newroute(argc, argv)
if (*cmd == 'g')
exit(0);
oerrno = errno;
- (void) printf("%s %s %s", cmd, ishost? "host" : "net", dest);
- if (*gateway) {
- (void) printf(": gateway %s", gateway);
- if (attempts > 1 && ret == 0 && af == AF_INET)
- (void) printf(" (%s)",
- inet_ntoa(((struct sockaddr_in *)&route.rt_gateway)->sin_addr));
+ if (!qflag) {
+ (void) printf("%s %s %s", cmd, ishost? "host" : "net", dest);
+ if (*gateway) {
+ (void) printf(": gateway %s", gateway);
+ if (attempts > 1 && ret == 0 && af == AF_INET)
+ (void) printf(" (%s)",
+ inet_ntoa(((struct sockaddr_in *)
+ &route.rt_gateway)->sin_addr));
+ }
+ if (ret == 0)
+ (void) printf("\n");
}
- if (ret == 0)
- (void) printf("\n");
- else {
+ if (ret != 0) {
switch (oerrno) {
case ESRCH:
err = "not in table";