- make "device" non optional and remove "-d device", and actually make

it work with "device"...
- tweak the docco a bit
This commit is contained in:
lukem 2002-12-21 08:11:28 +00:00
parent 133ea6e570
commit 52c78c8a7d
2 changed files with 27 additions and 36 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: sunlabel.8,v 1.3 2002/02/08 01:38:56 ross Exp $
.\" $NetBSD: sunlabel.8,v 1.4 2002/12/21 08:11:28 lukem Exp $
.\"
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -34,7 +34,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd January 12, 2002
.Dd December 21, 2002
.Dt SUNLABEL 8
.Os
.Sh NAME
@ -42,32 +42,25 @@
.Nd read or modify a SunOS disk label
.Sh SYNOPSIS
.Nm
.Op Fl d Ar device
.Op Fl mnqs
.Op Ar device
.Ar device
.Sh DESCRIPTION
.Nm
reads or modifies a
.Tn Sun disk label on
.Ar device .
Either
.Ar device
or
.Fl d Ar device
must be specified on the command line.
.Tn SunOS
disk label on
.Ar device ,
which is used by the
.Tn PROM
on
.Nx Ns /sparc
hardware to find partitions to boot from.
.Nm
only reads/writes the first 512 bytes of
.Ar device .
.Pp
The supported options are:
.Bl -tag -width "-disk device" -offset indent
.It Fl d Ar device
Use
.Ar device
as target for the operations (in case
.Ar device
would start with a dash
.Pq Sq \&- ) .
.Bl -tag -width 4n -offset indent
.It Fl m
Ignore an incorrect magic number in the disk label.
.It Fl n
@ -97,7 +90,7 @@ prints a prompt
.Dq sunlabel\*[Gt]
and expects commands.
The following commands are understood:
.Bl -tag -width 35n -offset indent -compact
.Bl -tag -width 16n -offset indent
.It \&?
Show a short help message.
.It Ic [abcdefghijklmnop] Ar \*[Lt]cylno\*[Gt] Ar \*[Lt]size\*[Gt]

View File

@ -1,4 +1,4 @@
/* $NetBSD: sunlabel.c,v 1.7 2002/12/21 06:53:29 lukem Exp $ */
/* $NetBSD: sunlabel.c,v 1.8 2002/12/21 08:11:28 lukem Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: sunlabel.c,v 1.7 2002/12/21 06:53:29 lukem Exp $");
__RCSID("$NetBSD: sunlabel.c,v 1.8 2002/12/21 08:11:28 lukem Exp $");
#include <stdio.h>
#include <errno.h>
@ -277,7 +277,7 @@ static void usage(void) __attribute__((__noreturn__));
static void
usage(void)
{
(void)fprintf(stderr, "Usage: %s [-mnqs] [-d disk]\n", getprogname());
(void)fprintf(stderr, "Usage: %s [-mnqs] disk\n", getprogname());
exit(1);
}
@ -285,11 +285,6 @@ usage(void)
* Command-line arguments. We can have at most one non-flag
* argument, which is the disk name; we can also have flags
*
* -d diskdev
* Specifies disk device unambiguously (if it begins with
* a dash, it will be mistaken for a flag if simply placed
* on the command line).
*
* -m
* Turns on fixmagic, which causes bad magic numbers to be
* ignored (though a complaint is still printed), rather
@ -303,9 +298,9 @@ usage(void)
* -n
* Turns on newlabel, which means we're creating a new
* label and anything in the label sector should be
* ignored. This is a bit like -fixmagic -fixsum, except
* that it doesn't print complaints and it ignores
* possible garbage on-disk.
* ignored. This is a bit like -m -s, except that it
* doesn't print complaints and it ignores possible
* garbage on-disk.
*
* -q
* Turns on quiet, which suppresses printing of prompts
@ -317,11 +312,8 @@ handleargs(int ac, char **av)
{
int c;
while ((c = getopt(ac, av, "d:mnqs")) != -1) {
while ((c = getopt(ac, av, "mnqs")) != -1) {
switch (c) {
case 'd':
setdisk(optarg);
break;
case 'm':
fixmagic++;
break;
@ -339,7 +331,13 @@ handleargs(int ac, char **av)
usage();
}
}
ac -= optind;
av += optind;
if (ac != 1)
usage();
setdisk(av[0]);
}
/*
* Sets the ending cylinder for a partition. This exists mainly to
* centralize the check. (If spc is zero, cylinder numbers make
@ -891,7 +889,7 @@ chvalue(const char *str)
}
}
if (!fields[i].tag)
warnx("Bad name %.*s - see l output for names", (int)n, str);
warnx("Bad name %.*s - see L output for names", (int)n, str);
}
/*