Make the supported media info output the default.

The -m switch is now accepted for backwards compatability.

Suggested by: davidg
This commit is contained in:
Peter Wemm 1997-10-16 03:55:29 +00:00
parent d39b43a399
commit 41cd75b799
3 changed files with 10 additions and 27 deletions

View File

@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94
.\" $Id: ifconfig.8,v 1.13 1997/05/03 23:03:56 peter Exp $
.\" $Id: ifconfig.8,v 1.14 1997/09/27 02:55:39 peter Exp $
.\"
.Dd February 13, 1996
.Dt IFCONFIG 8
@ -47,12 +47,7 @@
.Oc
.Op Ar parameters
.Nm ifconfig
.Op Fl m
.Ar interface
.Op Ar protocol_family
.Nm ifconfig
.Fl a
.Op Fl m
.Op Fl d
.Op Fl u
.Op Ar protocol_family
@ -298,13 +293,8 @@ when no optional parameters are supplied.
If a protocol family is specified,
Ifconfig will report only the details specific to that protocol family.
.Pp
If the
.Fl m
flag is passed before an interface name,
.Nm
will display all of the supported media for the specified interface.
If the driver does not support the media selection system, the list will
be blank - no media options supported.
If the driver does supports the media selection system, the supported
media list will be included in the output.
.Pp
Optionally, the
.Fl a

View File

@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94";
*/
static const char rcsid[] =
"$Id: ifconfig.c,v 1.29 1997/05/10 14:47:34 peter Exp $";
"$Id: ifconfig.c,v 1.30 1997/05/10 17:14:52 peter Exp $";
#endif /* not lint */
#include <sys/param.h>
@ -118,7 +118,6 @@ int setipdst;
int doalias;
int clearaddr;
int newaddr = 1;
int allmedia;
struct afswtch;
@ -279,9 +278,8 @@ rt_xaddrs(cp, cplim, rtinfo)
void
usage()
{
fputs("usage: ifconfig -a [ -m ] [ -d ] [ -u ] [ af ]\n", stderr);
fputs("usage: ifconfig -a [ -d ] [ -u ] [ af ]\n", stderr);
fputs(" ifconfig -l [ -d ] [ -u ]\n", stderr);
fputs(" ifconfig [ -m ] interface\n", stderr);
fputs(" [ af [ address [ dest_addr ] ] [ netmask mask ] [ broadcast addr ]\n", stderr);
fputs(" [ alias ] [ delete ] ]\n", stderr);
fputs(" [ up ] [ down ]\n", stderr);
@ -317,7 +315,7 @@ main(argc, argv)
int mib[6];
/* Parse leading line options */
all = allmedia = downonly = uponly = namesonly = 0;
all = downonly = uponly = namesonly = 0;
while ((c = getopt(argc, argv, "adlmu")) != -1) {
switch (c) {
case 'a': /* scan all interfaces */
@ -333,12 +331,7 @@ main(argc, argv)
uponly++;
break;
case 'm': /* show media choices in status */
#ifdef USE_IF_MEDIA
allmedia++;
#else
fputs("WARNING: if_media not compiled in!\n", stderr);
usage();
#endif
/* ignored for compatability */
break;
default:
usage();
@ -349,7 +342,7 @@ main(argc, argv)
argv += optind;
/* -l cannot be used with -a or -m */
if (namesonly && (all || allmedia))
if (namesonly && all)
usage();
/* nonsense.. */

View File

@ -1,5 +1,5 @@
/* $NetBSD: ifconfig.c,v 1.34 1997/04/21 01:17:58 lukem Exp $ */
/* $Id: ifmedia.c,v 1.2 1997/05/10 14:47:35 peter Exp $ */
/* $Id: ifmedia.c,v 1.3 1997/05/10 17:14:53 peter Exp $ */
/*
* Copyright (c) 1997 Jason R. Thorpe.
@ -158,7 +158,7 @@ media_status(s, info)
putchar('\n');
if (allmedia) {
if (ifmr.ifm_count > 0) {
printf("\tsupported media:");
for (i = 0; i < ifmr.ifm_count; i++) {
putchar(' ');