summaryrefslogtreecommitdiffstats
path: root/sbin/route
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2002-05-25 12:51:34 +0000
committerru <ru@FreeBSD.org>2002-05-25 12:51:34 +0000
commit6e7ea044c12bde01fe8e977b66d8c0fdc8a64418 (patch)
tree8bd3d7a440a1ab7b6cf1fc6ea527344cbf38c5e5 /sbin/route
parent9ce8567e45fee2403cbcc88f4a55f638441b81f8 (diff)
downloadFreeBSD-src-6e7ea044c12bde01fe8e977b66d8c0fdc8a64418.zip
FreeBSD-src-6e7ea044c12bde01fe8e977b66d8c0fdc8a64418.tar.gz
Respect -q with "add" and "delete". Document who respects -q.
PR: bin/38531
Diffstat (limited to 'sbin/route')
-rw-r--r--sbin/route/route.86
-rw-r--r--sbin/route/route.c61
2 files changed, 36 insertions, 31 deletions
diff --git a/sbin/route/route.8 b/sbin/route/route.8
index 226517e..069c8d9 100644
--- a/sbin/route/route.8
+++ b/sbin/route/route.8
@@ -73,7 +73,11 @@ to forget this, especially when attempting to repair networking operations).
.It Fl v
(verbose) Print additional details.
.It Fl q
-Suppress all output.
+Suppress all output from the
+.Cm add , delete ,
+and
+.Cm flush
+commands.
.El
.Pp
The
diff --git a/sbin/route/route.c b/sbin/route/route.c
index ba00033..001dec6 100644
--- a/sbin/route/route.c
+++ b/sbin/route/route.c
@@ -784,38 +784,39 @@ 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 (ret == 0) {
- (void) printf("\n");
- exit(0);
- } else {
- switch (oerrno) {
- case ESRCH:
- err = "not in table";
- break;
- case EBUSY:
- err = "entry in use";
- break;
- case ENOBUFS:
- err = "routing table overflow";
- break;
- case EDQUOT: /* handle recursion avoidance in rt_setgate() */
- err = "gateway uses the same route";
- break;
- default:
- err = strerror(oerrno);
- break;
+ if (!qflag) {
+ 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 (ret == 0) {
+ (void) printf("\n");
+ } else {
+ switch (oerrno) {
+ case ESRCH:
+ err = "not in table";
+ break;
+ case EBUSY:
+ err = "entry in use";
+ break;
+ case ENOBUFS:
+ err = "routing table overflow";
+ break;
+ case EDQUOT: /* handle recursion avoidance in rt_setgate() */
+ err = "gateway uses the same route";
+ break;
+ default:
+ err = strerror(oerrno);
+ break;
+ }
+ (void) printf(": %s\n", err);
}
- (void) printf(": %s\n", err);
- exit(1);
}
+ exit(ret != 0);
}
void
OpenPOWER on IntegriCloud