Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/modstat Accept both 'modstat -n name' as well as 'modst...



details:   https://anonhg.NetBSD.org/src/rev/8c83b981181e
branches:  trunk
changeset: 767892:8c83b981181e
user:      mbalmer <mbalmer%NetBSD.org@localhost>
date:      Tue Aug 02 16:46:45 2011 +0000

description:
Accept both 'modstat -n name' as well as 'modstat name' to display information
about a single module.

diffstat:

 sbin/modstat/main.c    |  10 ++++++----
 sbin/modstat/modstat.8 |  13 ++++++++-----
 2 files changed, 14 insertions(+), 9 deletions(-)

diffs (80 lines):

diff -r cb78b5922903 -r 8c83b981181e sbin/modstat/main.c
--- a/sbin/modstat/main.c       Tue Aug 02 16:44:01 2011 +0000
+++ b/sbin/modstat/main.c       Tue Aug 02 16:46:45 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.13 2011/06/03 16:35:35 pgoyette Exp $       */
+/*     $NetBSD: main.c,v 1.14 2011/08/02 16:46:45 mbalmer Exp $        */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.13 2011/06/03 16:35:35 pgoyette Exp $");
+__RCSID("$NetBSD: main.c,v 1.14 2011/08/02 16:46:45 mbalmer Exp $");
 #endif /* !lint */
 
 #include <sys/module.h>
@@ -88,7 +88,9 @@
 
        argc -= optind;
        argv += optind;
-       if (argc != 0)
+       if (argc == 1 && name == NULL)
+               name = argv[0];
+       else if (argc != 0)
                usage();
 
        if (prog_init && prog_init() == -1)
@@ -155,7 +157,7 @@
 usage(void)
 {
 
-       (void)fprintf(stderr, "Usage: %s [-n name]\n", getprogname());
+       (void)fprintf(stderr, "Usage: %s [-n] [name]\n", getprogname());
        exit(EXIT_FAILURE);
 }
 
diff -r cb78b5922903 -r 8c83b981181e sbin/modstat/modstat.8
--- a/sbin/modstat/modstat.8    Tue Aug 02 16:44:01 2011 +0000
+++ b/sbin/modstat/modstat.8    Tue Aug 02 16:46:45 2011 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: modstat.8,v 1.8 2010/12/14 16:23:59 jruoho Exp $
+.\" $NetBSD: modstat.8,v 1.9 2011/08/02 16:46:45 mbalmer Exp $
 .\"
 .\" Copyright (c) 1993 Christopher G. Demetriou
 .\" All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\" <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
 .\"
-.Dd December 14, 2010
+.Dd August 2, 2011
 .Dt MODSTAT 8
 .Os
 .Sh NAME
@@ -40,17 +40,20 @@
 .Nd display status of loaded kernel modules
 .Sh SYNOPSIS
 .Nm
-.Op Fl n Ar name
+.Op Fl n
+.Op Ar name
 .Sh DESCRIPTION
 The
 .Nm
-utility displays the status of any kernel modules
-present in the kernel.
+utility displays the status of any kernel modules present in the kernel.
 .Pp
 The options are as follows:
 .Bl -tag -width indent
 .It Fl n Ar name
 Display the status of only the module with this name.
+Please note that
+.Fl n
+is optional.
 .El
 .Pp
 In addition to listing the currently loaded modules' name,



Home | Main Index | Thread Index | Old Index