Don't require an argument for -v flag

Correct checks for null special file names
Add Usage entry for -v flag
Get terminology straight in man page
Reviewed by:	bde
This commit is contained in:
Greg Lehey 1998-09-29 23:20:04 +00:00
parent e68e908bda
commit 11ee80a991
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=39791
2 changed files with 18 additions and 11 deletions

View File

@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)newfs.8 8.6 (Berkeley) 5/3/95
.\" $Id: newfs.8,v 1.15 1998/07/15 06:28:04 charnier Exp $
.\" $Id: newfs.8,v 1.17 1998/09/11 07:08:49 grog Exp $
.\"
.Dd May 3, 1995
.Dt NEWFS 8
@ -92,7 +92,12 @@ or
the disk must be labeled using
.Xr disklabel 8 .
.Nm Newfs
builds a file system on the specified special device.
builds a file system on the specified special file. (We often refer to the
.Dq special file
as the
.Dq disk ,
although the special file need not be a physical disk. In fact, it need not
even be special.)
Typically the defaults are reasonable, however
.Nm
has numerous options to allow the defaults to be selectively overridden.
@ -214,12 +219,10 @@ for more details on how to set this option.
.It Fl s Ar size
The size of the file system in sectors.
.It Fl v
Specify that the slice does not contain any partitions, and that
Specify that the special device does not contain any partitions, and that
.Nm
should treat the whole slice as the file system. This option is useful for
synthetic disks such as
.Nm ccd
and
.Nm vinum.
.El
.Pp

View File

@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)newfs.c 8.13 (Berkeley) 5/1/95";
#endif
static const char rcsid[] =
"$Id: newfs.c,v 1.22 1998/07/20 12:04:42 bde Exp $";
"$Id: newfs.c,v 1.23 1998/09/11 06:26:08 grog Exp $";
#endif /* not lint */
/*
@ -247,7 +247,7 @@ main(argc, argv)
opstring = mfs ?
"NF:T:a:b:c:d:e:f:i:m:o:s:" :
"NOS:T:a:b:c:d:e:f:i:k:l:m:n:o:p:r:s:t:u:v:x";
"NOS:T:a:b:c:d:e:f:i:k:l:m:n:o:p:r:s:t:u:vx";
while ((ch = getopt(argc, argv, opstring)) != -1)
switch (ch) {
case 'N':
@ -454,10 +454,12 @@ main(argc, argv)
if ((st.st_mode & S_IFMT) != S_IFCHR && !mfs)
printf("%s: %s: not a character-special device\n",
progname, special);
cp = strchr(argv[0], '\0') - 1;
if (!vflag &&
cp == (char *)-1 ||
((*cp < 'a' || *cp > 'h') && !isdigit(*cp)))
cp = strchr(argv[0], '\0');
if (cp == argv[0])
fatal("null special file name");
cp--;
if (!vflag && (*cp < 'a' || *cp > 'h') && !isdigit(*cp))
((*cp < 'a' || *cp > 'h') && !isdigit(*cp))))
fatal("%s: can't figure out file system partition",
argv[0]);
#ifdef COMPAT
@ -757,6 +759,8 @@ usage()
fprintf(stderr, "\t-r revolutions/minute\n");
fprintf(stderr, "\t-t tracks/cylinder\n");
fprintf(stderr, "\t-u sectors/track\n");
fprintf(stderr,
"\t-v do not attempt to determine partition name from device name\n");
fprintf(stderr, "\t-x spare sectors per cylinder\n");
exit(1);
}