merge lite-2 changes.
also replace index -> strchr, add <string.h> for strchr prototype, and clean up .Nm usage.
This commit is contained in:
parent
54d63208ce
commit
6aeb76c1f1
|
@ -1,5 +1,5 @@
|
||||||
# from: @(#)Makefile 5.3 (Berkeley) 5/11/90
|
# from: @(#)Makefile 8.1 (Berkeley) 6/6/93
|
||||||
# $Id: Makefile,v 1.3 1994/12/22 11:34:14 cgd Exp $
|
# $NetBSD: Makefile,v 1.4 1997/03/08 07:24:40 mikel Exp $
|
||||||
|
|
||||||
PROG= diskpart
|
PROG= diskpart
|
||||||
MAN= diskpart.8
|
MAN= diskpart.8
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.\" Copyright (c) 1983, 1991 Regents of the University of California.
|
.\" Copyright (c) 1983, 1991, 1993
|
||||||
.\" All rights reserved.
|
.\" The Regents of the University of California. All rights reserved.
|
||||||
.\"
|
.\"
|
||||||
.\" Redistribution and use in source and binary forms, with or without
|
.\" Redistribution and use in source and binary forms, with or without
|
||||||
.\" modification, are permitted provided that the following conditions
|
.\" 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
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.\" from: @(#)diskpart.8 6.6 (Berkeley) 3/16/91
|
.\" from: @(#)diskpart.8 8.1 (Berkeley) 6/6/93
|
||||||
.\" $Id: diskpart.8,v 1.2 1993/08/01 07:25:13 mycroft Exp $
|
.\" $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
|
.Dt DISKPART 8
|
||||||
.Os BSD 4
|
.Os BSD 4
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
|
@ -111,7 +111,7 @@ partitions
|
||||||
are variable-sized, occupying whatever space remains after allocation
|
are variable-sized, occupying whatever space remains after allocation
|
||||||
of the fixed sized partitions.
|
of the fixed sized partitions.
|
||||||
If the disk is smaller than 20 Megabytes, then
|
If the disk is smaller than 20 Megabytes, then
|
||||||
.Nm diskpart
|
.Nm
|
||||||
aborts with the message
|
aborts with the message
|
||||||
.Dq Li disk too small, calculate by hand .
|
.Dq Li disk too small, calculate by hand .
|
||||||
.Bl -column Partition 20-60\ MB 61-205\ MB 206-355\ MB 356+\ MB
|
.Bl -column Partition 20-60\ MB 61-205\ MB 206-355\ MB 356+\ MB
|
||||||
|
@ -124,7 +124,7 @@ h unused unused 291346 291346
|
||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
If an unknown disk type is specified,
|
If an unknown disk type is specified,
|
||||||
.Nm diskpart
|
.Nm
|
||||||
will prompt for the required disk geometry information.
|
will prompt for the required disk geometry information.
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr disktab 5 ,
|
.Xr disktab 5 ,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1983, 1988 Regents of the University of California.
|
* Copyright (c) 1983, 1988, 1993
|
||||||
* All rights reserved.
|
* The Regents of the University of California. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
|
@ -32,14 +32,14 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
char copyright[] =
|
static char copyright[] =
|
||||||
"@(#) Copyright (c) 1983, 1988 Regents of the University of California.\n\
|
"@(#) Copyright (c) 1983, 1988, 1993\n\
|
||||||
All rights reserved.\n";
|
The Regents of the University of California. All rights reserved.\n";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
/*static char sccsid[] = "from: @(#)diskpart.c 5.11 (Berkeley) 6/1/90";*/
|
/* static char sccsid[] = "from: @(#)diskpart.c 8.3 (Berkeley) 11/30/94"; */
|
||||||
static char rcsid[] = "$Id: diskpart.c,v 1.6 1996/05/21 13:00:31 mrg Exp $";
|
static char rcsid[] = "$NetBSD: diskpart.c,v 1.7 1997/03/08 07:24:42 mikel Exp $";
|
||||||
#endif /* not lint */
|
#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 <sys/disklabel.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#define for_now /* show all of `c' partition for disklabel */
|
#define for_now /* show all of `c' partition for disklabel */
|
||||||
|
@ -344,9 +345,9 @@ main(argc, argv)
|
||||||
struct disklabel disk;
|
struct disklabel disk;
|
||||||
|
|
||||||
struct field {
|
struct field {
|
||||||
char *f_name;
|
char *f_name;
|
||||||
char *f_defaults;
|
char *f_defaults;
|
||||||
u_int32_t *f_location;
|
u_int32_t *f_location;
|
||||||
} fields[] = {
|
} fields[] = {
|
||||||
{ "sector size", "512", &disk.d_secsize },
|
{ "sector size", "512", &disk.d_secsize },
|
||||||
{ "#sectors/track", 0, &disk.d_nsectors },
|
{ "#sectors/track", 0, &disk.d_nsectors },
|
||||||
|
@ -374,16 +375,18 @@ promptfordisk(name)
|
||||||
for (;;) {
|
for (;;) {
|
||||||
fprintf(stderr, "Disk/controller type (%s)? ", dktypenames[1]);
|
fprintf(stderr, "Disk/controller type (%s)? ", dktypenames[1]);
|
||||||
(void) fgets(buf, BUFSIZ, stdin);
|
(void) fgets(buf, BUFSIZ, stdin);
|
||||||
if (buf[0] == 0)
|
if (buf[0] == 0) {
|
||||||
dp->d_type = 1;
|
dp->d_type = 1;
|
||||||
else
|
|
||||||
dp->d_type = gettype(buf, dktypenames);
|
|
||||||
if ((int16_t)dp->d_type >= 0)
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
if ((i = gettype(buf, dktypenames)) >= 0) {
|
||||||
|
dp->d_type = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
fprintf(stderr, "%s: unrecognized controller type\n", buf);
|
fprintf(stderr, "%s: unrecognized controller type\n", buf);
|
||||||
fprintf(stderr, "use one of:\n", buf);
|
fprintf(stderr, "use one of:\n", buf);
|
||||||
for (tp = dktypenames; *tp; tp++)
|
for (tp = dktypenames; *tp; tp++)
|
||||||
if (index(*tp, ' ') == 0)
|
if (strchr(*tp, ' ') == 0)
|
||||||
fprintf(stderr, "\t%s\n", *tp);
|
fprintf(stderr, "\t%s\n", *tp);
|
||||||
}
|
}
|
||||||
gettype:
|
gettype:
|
||||||
|
|
Loading…
Reference in New Issue