|
|||||||||||
|
disklabel: support (non-interactive) printing in selectable units
From: mho <mho(at)mho.nu>
Date: Sun Feb 02 2003 - 03:34:01 EST
The following patch adds support for '[-p unit]' to disklabel. This allows one to view the partition sizes and offsets in megabytes, etc, without being root and entering 'disklabel -E'.
Index: disklabel.8 RCS file: /cvs/src/sbin/disklabel/disklabel.8,v retrieving revision 1.48 diff -u -r1.48 disklabel.8 --- disklabel.8 2003/02/01 16:29:52 1.48 +++ disklabel.8 2003/02/02 08:27:53 @@ -47,6 +47,7 @@ .Nm disklabel .Op Fl n .Op Fl cd Li \&| Fl r +.Op Fl p Ar unit .Op Fl t .Op Fl v .Ar disk @@ -187,6 +188,12 @@ If .Ar tempfile already exists, it will be overwritten. +.It Fl p Ar unit +Print partition sizes and offsets in +.Ar unit +instead of sectors. +Valid units are b(ytes), c(ylinders), k(ilobytes), m(egabytes) and +g(igabytes). .It Fl t Format the label as a .Xr disktab 5 Index: disklabel.c RCS file: /cvs/src/sbin/disklabel/disklabel.c,v retrieving revision 1.76 diff -u -r1.76 disklabel.c --- disklabel.c 2002/12/31 16:22:25 1.76 +++ disklabel.c 2003/02/02 08:27:53*
void
FILE *f;
struct disklabel *lp;
+ char unit;
{
int i, j;
int width;
}
@@ -1158,7 +1163,7 @@
warn("%s", tmpfil);
return (1);
}
- display(fp, lp);
+ display(fp, lp, 'S');
fprintf(fp, "\n# Notes:\n");
fprintf(fp,
"# Up to 16 partitions are valid, named from 'a' to 'p'. Partition 'a' is\n" @@ -1758,7 +1763,7 @@ fprintf(stderr, "usage:\n"); fprintf(stderr, - " disklabel [-nv] [-r|-cd] [-t] disk%s (read)\n", + " disklabel [-nv] [-r|-cd] [-p unit] [-t] disk%s (read)\n", blank); fprintf(stderr, " disklabel [-nv] [-r|-cd] -e disk%s (edit)\n",Index: editor.c RCS file: /cvs/src/sbin/disklabel/editor.c,v retrieving revision 1.81 diff -u -r1.81 editor.c --- editor.c 2002/06/09 08:13:05 1.81 +++ editor.c 2003/02/02 08:27:53 *
/* from disklabel.c */ int checklabel(struct disklabel *); -void display(FILE *, struct disklabel *); +void display(FILE *, struct disklabel *, char); void display_partition(FILE *, struct disklabel *, char **, int, char, int); int width_partition(struct disklabel *, int);Received on Sun Feb 2 03:34:36 2003 This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 13:48:29 EDT |
||||||||||
|
|||||||||||