Accept both 'modstat -n name' as well as 'modstat name' to display information

about a single module.
This commit is contained in:
mbalmer 2011-08-02 16:46:45 +00:00
parent 3bcfc66d27
commit 3bc190836a
2 changed files with 14 additions and 9 deletions

View File

@ -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. * Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -28,7 +28,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #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 */ #endif /* !lint */
#include <sys/module.h> #include <sys/module.h>
@ -88,7 +88,9 @@ main(int argc, char **argv)
argc -= optind; argc -= optind;
argv += optind; argv += optind;
if (argc != 0) if (argc == 1 && name == NULL)
name = argv[0];
else if (argc != 0)
usage(); usage();
if (prog_init && prog_init() == -1) if (prog_init && prog_init() == -1)
@ -155,7 +157,7 @@ static void
usage(void) usage(void)
{ {
(void)fprintf(stderr, "Usage: %s [-n name]\n", getprogname()); (void)fprintf(stderr, "Usage: %s [-n] [name]\n", getprogname());
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }

View File

@ -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 .\" Copyright (c) 1993 Christopher G. Demetriou
.\" All rights reserved. .\" All rights reserved.
@ -32,7 +32,7 @@
.\" .\"
.\" <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>> .\" <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
.\" .\"
.Dd December 14, 2010 .Dd August 2, 2011
.Dt MODSTAT 8 .Dt MODSTAT 8
.Os .Os
.Sh NAME .Sh NAME
@ -40,17 +40,20 @@
.Nd display status of loaded kernel modules .Nd display status of loaded kernel modules
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm .Nm
.Op Fl n Ar name .Op Fl n
.Op Ar name
.Sh DESCRIPTION .Sh DESCRIPTION
The The
.Nm .Nm
utility displays the status of any kernel modules utility displays the status of any kernel modules present in the kernel.
present in the kernel.
.Pp .Pp
The options are as follows: The options are as follows:
.Bl -tag -width indent .Bl -tag -width indent
.It Fl n Ar name .It Fl n Ar name
Display the status of only the module with this name. Display the status of only the module with this name.
Please note that
.Fl n
is optional.
.El .El
.Pp .Pp
In addition to listing the currently loaded modules' name, In addition to listing the currently loaded modules' name,