This diff includes the 'P' option in the manpage and interactive helptext.

The install floppys are here:

http://www.cyodesigns.com/diffs/floppy47.fs
http://www.cyodesigns.com/diffs/floppyB47.fs
http://www.cyodesigns.com/diffs/floppyC47.fs

If you take one for a spin, could you let me know pls. I have only tested floppyB47.fs on a vm since the my machine with a floppy drive is transit in a 40ft container somewhere.

-mark

Index: editor.c
===================================================================
RCS file: /cvs/src/sbin/disklabel/editor.c,v
retrieving revision 1.231
diff -u -p -r1.231 editor.c
--- editor.c    4 Apr 2010 14:12:12 -0000       1.231
+++ editor.c    9 Apr 2010 22:45:03 -0000
@@ -150,6 +150,7 @@ static u_int64_t starting_sector;
static u_int64_t ending_sector;
static int expert;
static int overlap;
+static int auto_print = 0;

/*
 * Simple partition editor.
@@ -164,7 +165,8 @@ editor(struct disklabel *lp, int f)
        char buf[BUFSIZ], *cmd, *arg;
        char **omountpoints = NULL;
        char **origmountpoints = NULL, **tmpmountpoints = NULL;
-       int i, error = 0;
+       int i, error = 0, print_info = 0;
+       static char *argcpy;

        /* Alloc and init mount point info */
        if (!(omountpoints = calloc(MAXPARTITIONS, sizeof(char *))) ||
@@ -305,8 +307,19 @@ editor(struct disklabel *lp, int f)
                        editor_name(&label, arg);
                        break;

+               case 'P':
+                       free(argcpy);
+                       argcpy = NULL;
+                       if (arg) {
+                               if ((argcpy = strdup(arg)) == NULL)
+                                       err(1, "strdup");
+                               auto_print = 1;
+                       } else
+                               auto_print = !auto_print;
+                       break;
+
                case 'p':
-                       display_edit(&label, arg ? *arg : 0, 
editor_countfree(&label));
+                       print_info = 1;
                        break;

                case 'l':
@@ -475,6 +488,19 @@ editor(struct disklabel *lp, int f)
                        break;
                }

+               if ((print_info || auto_print) &&
+                   (*cmd != 'h' && *cmd != '?')) {
+                       if (auto_print) {
+                               printf("--------------------------" \
+                                   "----------------------\n");
+                               if (!print_info)
+                                       arg = argcpy;
+                       }
+ display_edit(&label, arg ? *arg : 0, + editor_countfree(&label));
+                       print_info = 0;
+               }
+
                /*
                 * If no changes were made to label or mountpoints, then
                 * restore undo info.
@@ -1734,6 +1760,11 @@ editor_help(char *arg)

        /* XXX - put these strings in a table instead? */
        switch (*arg) {
+       case 'P':
+               puts(
+"The 'P' command will print disklabel information after every command.\n"
+"The information displayed and arguments accepted are equivalent to 'p'\n"
+"(see below).\n");
        case 'p':
                puts(
"The 'p' command prints the current partitions.  By default, it prints size\n"
@@ -1887,7 +1918,7 @@ editor_help(char *arg)
        default:
                puts("Available commands:");
                puts(
-"  ? [cmd]  - show help                  n [part] - set mount point\n"
+"  ? [cmd]  - show help                  P [unit] - always print partitions\n"
"  A        - auto partition all space   p [unit] - print partitions\n"
"  a [part] - add partition              q        - quit & save changes\n"
"  b        - set OpenBSD boundaries     R [part] - resize a partition\n"
@@ -1899,6 +1930,7 @@ editor_help(char *arg)
"  l [unit] - print disk label header    X        - toggle expert mode\n"
"  M        - disklabel(8) man page      x        - exit & lose changes\n"
"  m [part] - modify partition           z        - delete all partitions\n"
+"  n [part] - set mount point\n"
"\n"
"Suffixes can be used to indicate units other than sectors:\n"
"\t'b' (bytes), 'k' (kilobytes), 'm' (megabytes), 'g' (gigabytes)\n"
Index: disklabel.8
===================================================================
RCS file: /cvs/src/sbin/disklabel/disklabel.8,v
retrieving revision 1.88
diff -u -p -r1.88 disklabel.8
--- disklabel.8 23 Mar 2010 18:43:06 -0000      1.88
+++ disklabel.8 9 Apr 2010 22:45:03 -0000
@@ -183,6 +183,8 @@ Disallow writing of the pack label area .It Fl n
Make no permanent changes to the disklabel
.Pq useful for debugging purposes .
+.It Fl P Ar unit
+Equivalent to 'p' (see below) but print information after every command.
.It Fl p Ar unit
Print partition sizes in
.Ar unit

Reply via email to