Module Name: src Committed By: christos Date: Fri Nov 7 14:57:08 UTC 2014
Modified Files: src/sbin/route: route.8 route.c Log Message: Now that the code can support tags and verbose route printing, enable them. Also document previously undocumented flags. To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/sbin/route/route.8 cvs rdiff -u -r1.145 -r1.146 src/sbin/route/route.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sbin/route/route.8 diff -u src/sbin/route/route.8:1.50 src/sbin/route/route.8:1.51 --- src/sbin/route/route.8:1.50 Tue Nov 5 02:42:48 2013 +++ src/sbin/route/route.8 Fri Nov 7 09:57:08 2014 @@ -1,4 +1,4 @@ -.\" $NetBSD: route.8,v 1.50 2013/11/05 07:42:48 kefren Exp $ +.\" $NetBSD: route.8,v 1.51 2014/11/07 14:57:08 christos Exp $ .\" .\" Copyright (c) 1983, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)route.8 8.4 (Berkeley) 6/1/94 .\" -.Dd November 5, 2013 +.Dd November 7, 2014 .Dt ROUTE 8 .Os .Sh NAME @@ -37,7 +37,7 @@ .Nd manually manipulate the routing tables .Sh SYNOPSIS .Nm -.Op Fl fnqSsv +.Op Fl dfnqSsTtv .Ar command .Oo .Op Ar modifiers @@ -67,6 +67,8 @@ programmatic interface discussed in .Xr route 4 . .Pp .Bl -tag -width Ds +.It Fl d +Turn on debugging .It Fl f Remove all routes (as per .Cm flush ) . @@ -96,6 +98,10 @@ instead of printing the flags that are s .Cm get command except for the actual gateway that will be used. How the gateway is printed depends on the type of route being looked up. +.It Fl T +Show tags in the route display. +.It Fl t +Test only, don't perform any actions. .It Fl v (verbose) Print additional details. .El Index: src/sbin/route/route.c diff -u src/sbin/route/route.c:1.145 src/sbin/route/route.c:1.146 --- src/sbin/route/route.c:1.145 Thu Nov 6 16:29:32 2014 +++ src/sbin/route/route.c Fri Nov 7 09:57:08 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: route.c,v 1.145 2014/11/06 21:29:32 christos Exp $ */ +/* $NetBSD: route.c,v 1.146 2014/11/07 14:57:08 christos Exp $ */ /* * Copyright (c) 1983, 1989, 1991, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19 #if 0 static char sccsid[] = "@(#)route.c 8.6 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: route.c,v 1.145 2014/11/06 21:29:32 christos Exp $"); +__RCSID("$NetBSD: route.c,v 1.146 2014/11/07 14:57:08 christos Exp $"); #endif #endif /* not lint */ @@ -126,7 +126,7 @@ static void sockaddr(const char *, struc int pid, rtm_addrs; int sock; -int forcehost, forcenet, doflush, nflag, af, qflag, tflag, Sflag; +int forcehost, forcenet, doflush, nflag, af, qflag, tflag, Sflag, Tflag; int iflag, verbose, aflen = sizeof(struct sockaddr_in), rtag; int locking, lockrest, debugonly, shortoutput; struct rt_metrics rt_metrics; @@ -134,6 +134,7 @@ int rtm_inits; short ns_nullh[] = {0,0,0}; short ns_bh[] = {-1,-1,-1}; +static const char opts[] = "dfnqSsTtv"; void usage(const char *cp) @@ -142,8 +143,7 @@ usage(const char *cp) if (cp) warnx("botched keyword: %s", cp); (void)fprintf(stderr, - "Usage: %s [ -fnqSsv ] cmd [[ -<qualifers> ] args ]\n", - getprogname()); + "Usage: %s [-%s] cmd [[-<qualifers>] args]\n", getprogname(), opts); exit(1); /* NOTREACHED */ } @@ -160,7 +160,7 @@ main(int argc, char * const *argv) if (argc < 2) usage(NULL); - while ((ch = getopt(argc, argv, "dfnqSstv")) != -1) + while ((ch = getopt(argc, argv, opts)) != -1) switch (ch) { case 'd': debugonly = 1; @@ -180,11 +180,14 @@ main(int argc, char * const *argv) case 's': shortoutput = 1; break; + case 'T': + Tflag = RT_TFLAG; + break; case 't': tflag = 1; break; case 'v': - verbose = 1; + verbose = RT_VFLAG; break; case '?': default: @@ -225,7 +228,7 @@ main(int argc, char * const *argv) return newroute(argc, argv); case K_SHOW: - show(argc, argv, nflag); + show(argc, argv, nflag|Tflag|verbose); return 0; #ifndef SMALL