merge lite-2 changes.

also replace index -> strchr, add <string.h> for strchr prototype, and
  clean up .Nm usage.
This commit is contained in:
mikel 1997-03-08 07:24:40 +00:00
parent 54d63208ce
commit 6aeb76c1f1
3 changed files with 27 additions and 24 deletions

View File

@ -1,5 +1,5 @@
# from: @(#)Makefile 5.3 (Berkeley) 5/11/90
# $Id: Makefile,v 1.3 1994/12/22 11:34:14 cgd Exp $
# from: @(#)Makefile 8.1 (Berkeley) 6/6/93
# $NetBSD: Makefile,v 1.4 1997/03/08 07:24:40 mikel Exp $
PROG= diskpart
MAN= diskpart.8

View File

@ -1,5 +1,5 @@
.\" Copyright (c) 1983, 1991 Regents of the University of California.
.\" All rights reserved.
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
@ -29,10 +29,10 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" from: @(#)diskpart.8 6.6 (Berkeley) 3/16/91
.\" $Id: diskpart.8,v 1.2 1993/08/01 07:25:13 mycroft Exp $
.\" from: @(#)diskpart.8 8.1 (Berkeley) 6/6/93
.\" $NetBSD: diskpart.8,v 1.3 1997/03/08 07:24:41 mikel Exp $
.\"
.Dd March 16, 1991
.Dd June 6, 1993
.Dt DISKPART 8
.Os BSD 4
.Sh NAME
@ -111,7 +111,7 @@ partitions
are variable-sized, occupying whatever space remains after allocation
of the fixed sized partitions.
If the disk is smaller than 20 Megabytes, then
.Nm diskpart
.Nm
aborts with the message
.Dq Li disk too small, calculate by hand .
.Bl -column Partition 20-60\ MB 61-205\ MB 206-355\ MB 356+\ MB
@ -124,7 +124,7 @@ h unused unused 291346 291346
.El
.Pp
If an unknown disk type is specified,
.Nm diskpart
.Nm
will prompt for the required disk geometry information.
.Sh SEE ALSO
.Xr disktab 5 ,

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 1983, 1988 Regents of the University of California.
* All rights reserved.
* Copyright (c) 1983, 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -32,14 +32,14 @@
*/
#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1983, 1988 Regents of the University of California.\n\
All rights reserved.\n";
static char copyright[] =
"@(#) Copyright (c) 1983, 1988, 1993\n\
The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
/*static char sccsid[] = "from: @(#)diskpart.c 5.11 (Berkeley) 6/1/90";*/
static char rcsid[] = "$Id: diskpart.c,v 1.6 1996/05/21 13:00:31 mrg Exp $";
/* static char sccsid[] = "from: @(#)diskpart.c 8.3 (Berkeley) 11/30/94"; */
static char rcsid[] = "$NetBSD: diskpart.c,v 1.7 1997/03/08 07:24:42 mikel Exp $";
#endif /* not lint */
/*
@ -50,6 +50,7 @@ static char rcsid[] = "$Id: diskpart.c,v 1.6 1996/05/21 13:00:31 mrg Exp $";
#include <sys/disklabel.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#define for_now /* show all of `c' partition for disklabel */
@ -344,9 +345,9 @@ main(argc, argv)
struct disklabel disk;
struct field {
char *f_name;
char *f_defaults;
u_int32_t *f_location;
char *f_name;
char *f_defaults;
u_int32_t *f_location;
} fields[] = {
{ "sector size", "512", &disk.d_secsize },
{ "#sectors/track", 0, &disk.d_nsectors },
@ -374,16 +375,18 @@ promptfordisk(name)
for (;;) {
fprintf(stderr, "Disk/controller type (%s)? ", dktypenames[1]);
(void) fgets(buf, BUFSIZ, stdin);
if (buf[0] == 0)
if (buf[0] == 0) {
dp->d_type = 1;
else
dp->d_type = gettype(buf, dktypenames);
if ((int16_t)dp->d_type >= 0)
break;
}
if ((i = gettype(buf, dktypenames)) >= 0) {
dp->d_type = i;
break;
}
fprintf(stderr, "%s: unrecognized controller type\n", buf);
fprintf(stderr, "use one of:\n", buf);
for (tp = dktypenames; *tp; tp++)
if (index(*tp, ' ') == 0)
if (strchr(*tp, ' ') == 0)
fprintf(stderr, "\t%s\n", *tp);
}
gettype: