summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2008-07-31 00:55:29 +0000
committerobrien <obrien@FreeBSD.org>2008-07-31 00:55:29 +0000
commit30175e1d312b18e64973e086d39506ab92b5aeba (patch)
tree3827e07b4b75d3a7953bb4d6292b095539fdf864 /sbin
parentffceb287be89960c730f8f60a22c3fed82f70bd1 (diff)
downloadFreeBSD-src-30175e1d312b18e64973e086d39506ab92b5aeba.zip
FreeBSD-src-30175e1d312b18e64973e086d39506ab92b5aeba.tar.gz
Add a -q[uiet] flag for scripts.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/fdisk/fdisk.85
-rw-r--r--sbin/fdisk/fdisk.c11
2 files changed, 12 insertions, 4 deletions
diff --git a/sbin/fdisk/fdisk.8 b/sbin/fdisk/fdisk.8
index 562adbb..1537266 100644
--- a/sbin/fdisk/fdisk.8
+++ b/sbin/fdisk/fdisk.8
@@ -8,7 +8,7 @@
.Nd PC slice table maintenance utility
.Sh SYNOPSIS
.Nm
-.Op Fl BIaipstu
+.Op Fl BIaipqstu
.Op Fl b Ar bootcode
.Op Fl 1234
.Op Ar disk
@@ -115,6 +115,9 @@ Print a slice table in
configuration file format and exit; see
.Sx CONFIGURATION FILE ,
below.
+.It Fl q
+Be quiet.
+Benign warnings (such as "GEOM not found") are suppressed.
.It Fl s
Print summary information and exit.
.It Fl t
diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c
index 5b5f174..e484578 100644
--- a/sbin/fdisk/fdisk.c
+++ b/sbin/fdisk/fdisk.c
@@ -115,6 +115,7 @@ static int I_flag = 0; /* use entire disk for FreeBSD */
static int a_flag = 0; /* set active partition */
static char *b_flag = NULL; /* path to boot code */
static int i_flag = 0; /* replace partition data */
+static int q_flag = 0; /* Be quiet */
static int u_flag = 0; /* update partition data */
static int s_flag = 0; /* Print a summary and exit */
static int t_flag = 0; /* test only */
@@ -249,7 +250,7 @@ main(int argc, char *argv[])
int partition = -1;
struct dos_partition *partp;
- while ((c = getopt(argc, argv, "BIab:f:ipstuv1234")) != -1)
+ while ((c = getopt(argc, argv, "BIab:f:ipqstuv1234")) != -1)
switch (c) {
case 'B':
B_flag = 1;
@@ -272,6 +273,9 @@ main(int argc, char *argv[])
case 'p':
print_config_flag = 1;
break;
+ case 'q':
+ q_flag = 1;
+ break;
case 's':
s_flag = 1;
break;
@@ -440,7 +444,7 @@ static void
usage()
{
fprintf(stderr, "%s%s",
- "usage: fdisk [-BIaipstu] [-b bootcode] [-1234] [disk]\n",
+ "usage: fdisk [-BIaipqstu] [-b bootcode] [-1234] [disk]\n",
" fdisk -f configfile [-itv] [disk]\n");
exit(1);
}
@@ -793,7 +797,8 @@ write_disk(off_t sector, void *buf)
gctl_free(grq);
return(0);
}
- warnx("%s", q);
+ if (!q_flag) /* GEOM errors are benign, not all devices supported */
+ warnx("%s", q);
gctl_free(grq);
error = pwrite(fd, buf, secsize, (sector * 512));
OpenPOWER on IntegriCloud