From adrian@thneed.ubergeeks.com Sun Mar 14 12:37:08 1999
Return-Path: <adrian@thneed.ubergeeks.com>
Received: from thneed.ubergeeks.com (thneed.ubergeeks.com [206.205.41.245])
	by hub.freebsd.org (Postfix) with ESMTP id 3014F1543C
	for <FreeBSD-gnats-submit@freebsd.org>; 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
Sender: adrian@thneed.ubergeeks.com
Reply-To: adrian@ubergeeks.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: convenient option for fdformat(1)
X-Send-Pr-Version: 3.2

>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:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 14 12:40:01 PST 1999
>Closed-Date:    Thu Jun 1 19:49:52 PDT 2000
>Last-Modified:  Thu Jun 01 19:50:46 PDT 2000
>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:
State-Changed-From-To: open->closed 
State-Changed-By: nrahlstr 
State-Changed-When: Thu Jun 1 19:49:52 PDT 2000 
State-Changed-Why:  
phk commited a similar patch from PR bin/9259 in revision 1.12 of 
fdformat.c. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=10590 
>Unformatted:
