Now that the code can support tags and verbose route printing, enable them.

Also document previously undocumented flags.
This commit is contained in:
christos 2014-11-07 14:57:08 +00:00
parent a5d8dd44b5
commit 74d147444a
2 changed files with 20 additions and 11 deletions

View File

@ -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 set as a contiguous string.
.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

View File

@ -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, 1989, 1991, 1993\
#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 *, struct sockaddr *);
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