Date: Sun, 14 Mar 1999 15:40:05 -0500 (EST) From: adrian@ubergeeks.com To: FreeBSD-gnats-submit@freebsd.org Subject: bin/10590: convenient option for fdformat(1) Message-ID: <199903142040.PAA00718@thneed.ubergeeks.com>
next in thread | raw e-mail | index | archive | help
>Number: 10590
>Category: bin
>Synopsis: new option to silince confirmation but not suppress output
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Sun Mar 14 12:40:01 PST 1999
>Closed-Date:
>Last-Modified:
>Originator: Adrian Filipi-Martin
>Release: FreeBSD 3.1-STABLE i386
>Organization:
Ubergeeks Consulting
>Environment:
>Description:
I like to see the output from fdformat(1), but I also get tired of
either being prompted to confirm, or piping from yes(1) on stdin.
>How-To-Repeat:
>Fix:
Apply the following patch to implement the new '-y' option, which
only silences the y/n prompt and not all output.
--- fdformat.1.orig Sun Mar 14 13:21:23 1999
+++ fdformat.1 Sun Mar 14 13:33:51 1999
@@ -31,6 +31,7 @@
.Sh SYNOPSIS
.Nm fdformat
.Op Fl q
+.Op Fl y
.Op Fl v | Fl n
.Op Fl f Ar capacity
.Op Fl c Ar cyls
@@ -68,8 +69,12 @@
The options are as follows:
.Bl -tag -width 10n -offset indent
.It Fl q
-Suppress any normal output from the command, and don't ask the
-user for a confirmation whether to format the floppy disk at
+Suppress any normal output from the command. This option
+implies the
+.Fl y
+option is also set.
+.It Fl y
+Do not ask the user for a confirmation whether to format the floppy disk at
.Ar device_name .
.It Fl f Ar capacity
The normal way to specify the desired formatting parameters.
--- fdformat.c.orig Sun Mar 14 13:15:21 1999
+++ fdformat.c Sun Mar 14 13:34:19 1999
@@ -168,12 +168,12 @@
{
int format = -1, cyls = -1, secs = -1, heads = -1, intleave = -1;
int rate = -1, gaplen = -1, secsize = -1, steps = -1;
- int fill = 0xf6, quiet = 0, verify = 1, verify_only = 0;
+ int fill = 0xf6, quiet = 0, no_prompt = 0, verify = 1, verify_only = 0;
int fd, c, track, error, tracks_per_dot, bytes_per_track, errs;
const char *devname, *suffix;
struct fd_type fdt;
- while((c = getopt(argc, argv, "f:c:s:h:r:g:S:F:t:i:qvn")) != -1)
+ while((c = getopt(argc, argv, "f:c:s:h:r:g:S:F:t:i:qyvn")) != -1)
switch(c) {
case 'f': /* format in kilobytes */
format = atoi(optarg);
@@ -217,6 +217,8 @@
case 'q':
quiet = 1;
+ case 'y':
+ no_prompt = 1;
break;
case 'n':
@@ -285,7 +287,7 @@
fdt.tracks * fdt.heads * bytes_per_track / 1024,
devname);
}
- else if(!quiet) {
+ else if(!no_prompt) {
printf("Format %dK floppy `%s'? (y/n): ",
fdt.tracks * fdt.heads * bytes_per_track / 1024,
devname);
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199903142040.PAA00718>
