summaryrefslogtreecommitdiff
path: root/sbin/disklabel/disklabel.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2009-03-22 19:01:33 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2009-03-22 19:01:33 +0000
commit8cb079ae55ab72da01dc67f6a1f427af4486d064 (patch)
treea770b2b307fa675a55aa06a2ca15f3b2ad99ca05 /sbin/disklabel/disklabel.c
parent8ffc7c509407f9484d596eeec08bc6e8c772487a (diff)
Add 'A' command to Editor mode, and -A flag to automatically execute it
on disks without an existing label. The 'A' command allocates all space on the disk into a reasonable partition scheme for a root disk. Feedback from several, time to work on it in-tree. Prodded (repeatedly) by and ok deraadt@
Diffstat (limited to 'sbin/disklabel/disklabel.c')
-rw-r--r--sbin/disklabel/disklabel.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c
index 500f42c7f15..5eac5ddb29f 100644
--- a/sbin/disklabel/disklabel.c
+++ b/sbin/disklabel/disklabel.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disklabel.c,v 1.138 2009/02/15 21:07:00 krw Exp $ */
+/* $OpenBSD: disklabel.c,v 1.139 2009/03/22 19:01:32 krw Exp $ */
/*
* Copyright (c) 1987, 1993
@@ -39,7 +39,7 @@ static const char copyright[] =
#endif /* not lint */
#ifndef lint
-static const char rcsid[] = "$OpenBSD: disklabel.c,v 1.138 2009/02/15 21:07:00 krw Exp $";
+static const char rcsid[] = "$OpenBSD: disklabel.c,v 1.139 2009/03/22 19:01:32 krw Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -105,6 +105,7 @@ enum {
UNSPEC, EDIT, EDITOR, READ, RESTORE, SETWRITEABLE, WRITE, WRITEBOOT
} op = UNSPEC;
+int aflag;
int cflag;
int dflag;
int tflag;
@@ -145,8 +146,11 @@ main(int argc, char *argv[])
char print_unit = 0;
FILE *t;
- while ((ch = getopt(argc, argv, "BEf:NRWb:cdenp:s:tvw")) != -1)
+ while ((ch = getopt(argc, argv, "ABEf:NRWb:cdenp:s:tvw")) != -1)
switch (ch) {
+ case 'A':
+ ++aflag;
+ break;
#if NUMBOOT > 0
case 'B':
++installboot;
@@ -278,7 +282,7 @@ main(int argc, char *argv[])
usage();
if ((lp = readlabel(f)) == NULL)
exit(1);
- error = editor(lp, f, specname, fstabfile);
+ error = editor(lp, f, specname, fstabfile, aflag);
break;
case READ:
if (argc != 1)
@@ -1724,7 +1728,7 @@ usage(void)
fprintf(stderr,
" disklabel -e [-c | -d] [-nv] disk\t\t\t(edit)\n");
fprintf(stderr,
- " disklabel -E [-c | -d] [-nv] [-f tempfile] disk\t\t(simple editor)\n");
+ " disklabel -E [-A] [-c | -d] [-nv] [-f tempfile] disk\t\t(simple editor)\n");
fprintf(stderr,
" disklabel -R [-nv] disk protofile\t\t\t(restore)\n");
fprintf(stderr,