diff options
| author | Philippe Charnier <charnier@FreeBSD.org> | 1997-09-17 06:27:23 +0000 |
|---|---|---|
| committer | Philippe Charnier <charnier@FreeBSD.org> | 1997-09-17 06:27:23 +0000 |
| commit | 355c9698df97aa85cbea1afbd8f29773e720ea4e (patch) | |
| tree | abc96e0cbd82858996e600ac2d06a1a78d09f4cd | |
| parent | 9006448ee552ad23a7cf5a2dc2878650bae61f2d (diff) | |
Notes
| -rw-r--r-- | usr.sbin/diskpart/diskpart.8 | 4 | ||||
| -rw-r--r-- | usr.sbin/diskpart/diskpart.c | 36 |
2 files changed, 21 insertions, 19 deletions
diff --git a/usr.sbin/diskpart/diskpart.8 b/usr.sbin/diskpart/diskpart.8 index 0b02de2ed76cf..e13613a52ec42 100644 --- a/usr.sbin/diskpart/diskpart.8 +++ b/usr.sbin/diskpart/diskpart.8 @@ -110,7 +110,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 @@ -123,7 +123,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 , diff --git a/usr.sbin/diskpart/diskpart.c b/usr.sbin/diskpart/diskpart.c index c9505fde8e61b..86b4122ae316b 100644 --- a/usr.sbin/diskpart/diskpart.c +++ b/usr.sbin/diskpart/diskpart.c @@ -32,7 +32,7 @@ */ #ifndef lint -static char copyright[] = +static const char copyright[] = "@(#) Copyright (c) 1983, 1988, 1993\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ @@ -42,7 +42,7 @@ static char copyright[] = static char sccsid[] = "@(#)diskpart.c 8.3 (Berkeley) 11/30/94"; #endif static const char rcsid[] = - "$Id$"; + "$Id: diskpart.c,v 1.8 1997/02/22 16:05:46 peter Exp $"; #endif /* not lint */ /* @@ -52,8 +52,9 @@ static const char rcsid[] = #define DKTYPENAMES #include <sys/disklabel.h> -#include <stdio.h> #include <ctype.h> +#include <err.h> +#include <stdio.h> #define for_now /* show all of `c' partition for disklabel */ #define NPARTITIONS 8 @@ -113,7 +114,9 @@ int pflag; /* print device driver partition tables */ int dflag; /* print disktab entry */ struct disklabel *promptfordisk(); +static void usage __P((void)); +int main(argc, argv) int argc; char *argv[]; @@ -125,11 +128,8 @@ main(argc, argv) char *lp, *tyname; argc--, argv++; - if (argc < 1) { - fprintf(stderr, - "usage: disktab [ -p ] [ -d ] [ -s size ] disk-type\n"); - exit(1); - } + if (argc < 1) + usage(); if (argc > 0 && strcmp(*argv, "-p") == 0) { pflag++; argc--, argv++; @@ -146,10 +146,8 @@ main(argc, argv) if (dp == NULL) { if (isatty(0)) dp = promptfordisk(*argv); - if (dp == NULL) { - fprintf(stderr, "%s: unknown disk type\n", *argv); - exit(2); - } + if (dp == NULL) + errx(2, "%s: unknown disk type", *argv); } else { if (dp->d_flags & D_REMOVABLE) tyname = "removable"; @@ -198,11 +196,8 @@ main(argc, argv) if (curcyl < dp->d_ncylinders - threshhold) break; } - if (def >= NDEFAULTS) { - fprintf(stderr, "%s: disk too small, calculate by hand\n", - *argv); - exit(3); - } + if (def >= NDEFAULTS) + errx(3, "%s: disk too small, calculate by hand", *argv); /* * Calculate number of cylinders allocated to each disk @@ -344,6 +339,13 @@ main(argc, argv) } } +static void +usage() +{ + fprintf(stderr, "usage: disktab [-p] [-d] [-s size] disk-type\n"); + exit(1); +} + struct disklabel disk; struct field { |
