From owner-freebsd-bugs Sun Mar 14 12:40:15 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 50C72153A3 for ; Sun, 14 Mar 1999 12:40:14 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.2/8.9.2) id MAA17095; Sun, 14 Mar 1999 12:40:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from thneed.ubergeeks.com (thneed.ubergeeks.com [206.205.41.245]) by hub.freebsd.org (Postfix) with ESMTP id 3014F1543C for ; Sun, 14 Mar 1999 12:37:06 -0800 (PST) (envelope-from adrian@thneed.ubergeeks.com) Received: (from adrian@localhost) by thneed.ubergeeks.com (8.9.2/8.9.1) id PAA00718; Sun, 14 Mar 1999 15:40:05 -0500 (EST) (envelope-from adrian) Message-Id: <199903142040.PAA00718@thneed.ubergeeks.com> Date: Sun, 14 Mar 1999 15:40:05 -0500 (EST) From: adrian@ubergeeks.com Reply-To: adrian@ubergeeks.com To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/10590: convenient option for fdformat(1) Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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