> When I use Disklabel, I have been in the habit of issuing 'p m <enter>'
> rather than just 'p <enter>'
>
> Since I do it for disk / usb thumb setups, and so forth, I find the
> 'megabyte-able' printing more consistent to my liking.
>

Attached is an amended diff that allows the 'P' option to take an
argument just as the 'p' option does.

> I'd say leave it out, since CHS information may get scrolled off the
> screen if it was relevant. (Or am I thinking fdisk...?)
> As it is, both 'p' and 'm' keys have less wear than 'e' 't' and 's' and
> make for good finger dexterity...
>

That is the crux of the issue. For those of us who like to type less this diff helps, for you people who like type more... you're weird ;)

Anyway, with only one yay, I don't think this will progress much further.

-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    8 Apr 2010 07:03:35 -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':
@@ -473,6 +486,17 @@ editor(struct disklabel *lp, int f)
       default:
           printf("Unknown option: %c ('?' for help)\n", *cmd);
           break;
+        }
+
+        if (print_info || auto_print) {
+            if (auto_print) {
+                printf("--------------------------" \
+                    "----------------------\n");
+                if (!print_info)
+                    arg = argcpy;
+            }
+            display_edit(&label, arg ? *arg : 0, editor_countfree(&label));
+            print_info = 0;
       }

       /*

Reply via email to