PR/32632: Yves-Emmanuel JUTARD: Improvment suggestion in 'route' display.
Add a new -S flag that prints a space for missing flags.
This commit is contained in:
parent
e7e64b6ab3
commit
81a178c561
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: extern.h,v 1.6 2005/08/15 19:28:08 ginsbach Exp $ */
|
||||
/* $NetBSD: extern.h,v 1.7 2006/01/25 16:29:10 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Christos Zoulas. All rights reserved.
|
||||
@ -40,7 +40,7 @@ void show(int, char **);
|
||||
int ccitt_addr(char *, struct sockaddr_x25 *);
|
||||
|
||||
/* route.c */
|
||||
extern int nflag;
|
||||
extern int nflag, Sflag;
|
||||
#define NOTDEFSTRING "0.0.0.0/xxx.xxx.xxx.xxx\0"
|
||||
int keyword(char *);
|
||||
int netmask_length(struct sockaddr *, int);
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: route.8,v 1.36 2003/10/02 00:09:06 itojun Exp $
|
||||
.\" $NetBSD: route.8,v 1.37 2006/01/25 16:29:10 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 July 19, 2003
|
||||
.Dd January 25, 2006
|
||||
.Dt ROUTE 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -37,7 +37,7 @@
|
||||
.Nd manually manipulate the routing tables
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl fnqsv
|
||||
.Op Fl fnqsSv
|
||||
.Ar command
|
||||
.Oo
|
||||
.Op Ar modifiers
|
||||
@ -93,6 +93,9 @@ Suppress all output from commands that manipulate the routing table.
|
||||
.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 S
|
||||
Print a space when a flag is missing so that flags are vertically aligned
|
||||
instead of printing the flags that are set as a contiguous string.
|
||||
.It Fl v
|
||||
(verbose) Print additional details.
|
||||
.El
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: route.c,v 1.94 2006/01/25 16:19:50 christos Exp $ */
|
||||
/* $NetBSD: route.c,v 1.95 2006/01/25 16:29:10 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1989, 1991, 1993
|
||||
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1989, 1991, 1993\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)route.c 8.6 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: route.c,v 1.94 2006/01/25 16:19:50 christos Exp $");
|
||||
__RCSID("$NetBSD: route.c,v 1.95 2006/01/25 16:29:10 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -121,7 +121,7 @@ union sockunion {
|
||||
|
||||
int pid, rtm_addrs;
|
||||
int sock;
|
||||
int forcehost, forcenet, doflush, nflag, af, qflag, tflag;
|
||||
int forcehost, forcenet, doflush, nflag, af, qflag, tflag, Sflag;
|
||||
int iflag, verbose, aflen = sizeof(struct sockaddr_in);
|
||||
int locking, lockrest, debugonly, shortoutput;
|
||||
struct rt_metrics rt_metrics;
|
||||
@ -137,7 +137,7 @@ usage(const char *cp)
|
||||
if (cp)
|
||||
warnx("botched keyword: %s", cp);
|
||||
(void)fprintf(stderr,
|
||||
"Usage: %s [ -fnqvs ] cmd [[ -<qualifers> ] args ]\n",
|
||||
"Usage: %s [ -fnqsSv ] cmd [[ -<qualifers> ] args ]\n",
|
||||
getprogname());
|
||||
exit(1);
|
||||
/* NOTREACHED */
|
||||
@ -158,7 +158,7 @@ main(int argc, char **argv)
|
||||
if (argc < 2)
|
||||
usage(NULL);
|
||||
|
||||
while ((ch = getopt(argc, argv, "dfnqstv")) != -1)
|
||||
while ((ch = getopt(argc, argv, "dfnqsStv")) != -1)
|
||||
switch (ch) {
|
||||
case 'd':
|
||||
debugonly = 1;
|
||||
@ -175,6 +175,9 @@ main(int argc, char **argv)
|
||||
case 's':
|
||||
shortoutput = 1;
|
||||
break;
|
||||
case 'S':
|
||||
Sflag = 1;
|
||||
break;
|
||||
case 't':
|
||||
tflag = 1;
|
||||
break;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: show.c,v 1.28 2005/08/31 02:58:30 ginsbach Exp $ */
|
||||
/* $NetBSD: show.c,v 1.29 2006/01/25 16:29:10 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1988, 1993
|
||||
@ -34,7 +34,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "from: @(#)route.c 8.3 (Berkeley) 3/9/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: show.c,v 1.28 2005/08/31 02:58:30 ginsbach Exp $");
|
||||
__RCSID("$NetBSD: show.c,v 1.29 2006/01/25 16:29:10 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -381,6 +381,8 @@ p_flags(int f)
|
||||
for (flags = name; p->b_mask; p++)
|
||||
if (p->b_mask & f)
|
||||
*flags++ = p->b_val;
|
||||
else if (Sflag)
|
||||
*flags++ = ' ';
|
||||
*flags = '\0';
|
||||
printf("%-6.6s ", name);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user