Bitch if both an id and a name are specified. Make the man page and usage

message reflect this. As a bonus, make the -n optional so that 'kldunload
name' works as one would expect.
This commit is contained in:
Dag-Erling Smørgrav 1998-11-07 00:42:52 +00:00
parent 9b84d62900
commit eda1fa0957
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=40981
2 changed files with 14 additions and 6 deletions

View File

@ -23,7 +23,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: kldunload.8,v 1.3 1998/01/05 07:10:41 charnier Exp $
.\" $Id: kldunload.8,v 1.4 1998/03/19 07:45:32 charnier Exp $
.\"
.Dd April 25, 1997
.Dt KLDUNLOAD 8
@ -34,8 +34,10 @@
.Sh SYNOPSIS
.Nm kldunload
.Op Fl v
.Op Fl i Ar id
.Op Fl n Ar name
.Fl i Ar id
.Nm kldunload
.Op Fl v
.Fl n Ar name
.Sh DESCRIPTION
The
.Nm

View File

@ -26,7 +26,7 @@
#ifndef lint
static const char rcsid[] =
"$Id: kldunload.c,v 1.5 1998/01/05 07:10:42 charnier Exp $";
"$Id: kldunload.c,v 1.6 1998/07/06 06:59:52 charnier Exp $";
#endif /* not lint */
#include <err.h>
@ -39,7 +39,8 @@ static const char rcsid[] =
static void
usage(void)
{
fprintf(stderr, "usage: kldunload [-v] [-i id] [-n name]\n");
fprintf(stderr, "usage: kldunload [-v] -i id\n");
fprintf(stderr, " kldunload [-v] -n name\n");
exit(1);
}
@ -68,7 +69,12 @@ main(int argc, char** argv)
argc -= optind;
argv += optind;
if (argc != 0)
if (!fileid && !filename && (argc == 1)) {
filename = *argv;
argc--;
}
if (argc != 0 || fileid && filename)
usage();
if (fileid == 0 && filename == 0)