diff options
author | 2019-04-29 18:54:12 +0000 | |
---|---|---|
committer | 2019-04-29 18:54:12 +0000 | |
commit | cbfc0aa29c54f5f75d22df59cc147bb0f2b3a8e4 (patch) | |
tree | ee401d19e908964fbe66ba1d3710a2a351e7dd41 | |
parent | $() is expanded by make itself, so consistently use `cat vnd`; ok deraadt@ (diff) | |
download | wireguard-openbsd-cbfc0aa29c54f5f75d22df59cc147bb0f2b3a8e4.tar.xz wireguard-openbsd-cbfc0aa29c54f5f75d22df59cc147bb0f2b3a8e4.zip |
Add '*' to disklabel(8) editor prompt when in-memory copy of disklabel
has been modified. Use name of disk being edited in fdisk(8) editor
prompt.
Idea from tb@.
ok tb@ deraadt@
-rw-r--r-- | sbin/disklabel/disklabel.8 | 20 | ||||
-rw-r--r-- | sbin/disklabel/editor.c | 6 | ||||
-rw-r--r-- | sbin/fdisk/fdisk.8 | 14 | ||||
-rw-r--r-- | sbin/fdisk/user.c | 5 |
4 files changed, 33 insertions, 12 deletions
diff --git a/sbin/disklabel/disklabel.8 b/sbin/disklabel/disklabel.8 index 5ce935836c3..1b61b565007 100644 --- a/sbin/disklabel/disklabel.8 +++ b/sbin/disklabel/disklabel.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: disklabel.8,v 1.134 2019/04/01 00:29:51 krw Exp $ +.\" $OpenBSD: disklabel.8,v 1.135 2019/04/29 18:54:12 krw Exp $ .\" $NetBSD: disklabel.8,v 1.9 1995/03/18 14:54:38 cgd Exp $ .\" .\" Copyright (c) 1987, 1988, 1991, 1993 @@ -33,7 +33,7 @@ .\" .\" @(#)disklabel.8 8.2 (Berkeley) 4/19/94 .\" -.Dd $Mdocdate: April 1 2019 $ +.Dd $Mdocdate: April 29 2019 $ .Dt DISKLABEL 8 .Os .Sh NAME @@ -245,6 +245,22 @@ used to rewrite the disk label. The built-in label editor .Pq fourth form provides a simple interactive label editor. +The editor prompt contains information about the state of the edit +process. +.Pp +.Dl Ar disk Ns *> +.Pp +Where +.Ar disk +is the name of the disk being edited, +.Sq * +means that the in-memory copy of the partition table has been modified but +not yet written to disk and the +.Sq > +is replaced by +.Sq # +when the editor is in expert mode. +.Pp Some commands or prompts take an optional unit. Available units are .Sq b diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c index 9e3b8e6e301..fd7a2af685f 100644 --- a/sbin/disklabel/editor.c +++ b/sbin/disklabel/editor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: editor.c,v 1.359 2019/04/03 01:10:30 krw Exp $ */ +/* $OpenBSD: editor.c,v 1.360 2019/04/29 18:54:12 krw Exp $ */ /* * Copyright (c) 1997-2000 Todd C. Miller <millert@openbsd.org> @@ -253,7 +253,9 @@ editor(int f) puts("Label editor (enter '?' for help at any prompt)"); for (;;) { - fprintf(stdout, "%s%s", dkname, (expert == 0) ? "> " : "# "); + fprintf(stdout, "%s%s%c ", dkname, + (memcmp(&lab, &newlab, sizeof(newlab)) == 0) ? "" : "*", + (expert == 0) ? '>' : '#'); if (fgets(buf, sizeof(buf), stdin) == NULL) { putchar('\n'); buf[0] = 'q'; diff --git a/sbin/fdisk/fdisk.8 b/sbin/fdisk/fdisk.8 index 844a34a3490..6a466d90b6d 100644 --- a/sbin/fdisk/fdisk.8 +++ b/sbin/fdisk/fdisk.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: fdisk.8,v 1.94 2017/03/26 00:22:49 sobrado Exp $ +.\" $OpenBSD: fdisk.8,v 1.95 2019/04/29 18:54:12 krw Exp $ .\" .\" .\" Copyright (c) 1997 Tobias Weingartner @@ -15,7 +15,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: March 26 2017 $ +.Dd $Mdocdate: April 29 2019 $ .Dt FDISK 8 .Os .Sh NAME @@ -342,13 +342,15 @@ to enter an interactive command mode. The prompt contains information about the state of the edit process. .Pp -.Dl fdisk:*1> +.Dl Ar disk Ns *:1> .Pp +Where +.Ar disk +is the name of the disk being edited, .Sq * means that the in-memory copy of the partition table has been modified, but -not yet written to disk. -.Pp -1 is the disk offset of the currently selected boot block being edited. +not yet written to disk and +1 is the number of the boot block being edited. This number will be 2 when editing an extended MBR partition, 3 when editing an extended MBR partition within an extended MBR partition, and so on. diff --git a/sbin/fdisk/user.c b/sbin/fdisk/user.c index 0df9928f793..b1cf5538541 100644 --- a/sbin/fdisk/user.c +++ b/sbin/fdisk/user.c @@ -1,4 +1,4 @@ -/* $OpenBSD: user.c,v 1.51 2018/04/26 15:55:14 guenther Exp $ */ +/* $OpenBSD: user.c,v 1.52 2019/04/29 18:54:12 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -31,6 +31,7 @@ #include "cmd.h" #include "user.h" #include "gpt.h" +#include "disk.h" /* Our command table */ struct cmd cmd_table[] = { @@ -87,7 +88,7 @@ USER_edit(off_t offset, off_t reloff) /* Edit cycle */ again: do { - printf("fdisk:%c%d> ", (modified)?'*':' ', editlevel); + printf("%s%s: %d> ", disk.name, modified ? "*" : "", editlevel); fflush(stdout); ask_cmd(&cmd, &args); |