From toor@gaylord.async.vt.edu  Thu Dec 31 19:46:27 1998
Received: from gaylord.async.vt.edu (gaylord.async.vt.edu [128.173.18.131])
          by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id TAA25983
          for <FreeBSD-gnats-submit@freebsd.org>; Thu, 31 Dec 1998 19:46:19 -0800 (PST)
          (envelope-from toor@gaylord.async.vt.edu)
Received: (from root@localhost)
	by gaylord.async.vt.edu (8.9.1/8.9.1) id WAA58228;
	Thu, 31 Dec 1998 22:48:19 -0500 (EST)
	(envelope-from toor)
Message-Id: <199901010348.WAA58228@gaylord.async.vt.edu>
Date: Thu, 31 Dec 1998 22:48:19 -0500 (EST)
From: cgaylord@vt.edu
Reply-To: cgaylord@vt.edu
To: FreeBSD-gnats-submit@freebsd.org
Subject: Adding -y to fdformat for autoyes
X-Send-Pr-Version: 3.2

>Number:         9259
>Category:       bin
>Synopsis:       allow no prompt for yes in fdformat, but still show progress
>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:   Thu Dec 31 19:50:01 PST 1998
>Closed-Date:    Thu Jun 1 15:27:40 PDT 2000
>Last-Modified:  Thu Jun 01 15:27:58 PDT 2000
>Originator:     Clark Gaylord
>Release:        FreeBSD 3.0-CURRENT i386
>Organization:
Virginia Tech
>Environment:

FreeBSD gaylord.async.vt.edu 3.0-CURRENT FreeBSD 3.0-CURRENT #2: 
Sun Dec 13 21:24:29 EST 1998     
toor@gaylord.async.vt.edu:/big/FreeBSD-current/src/sys/compile/BADGER  i386

>Description:

fdformat -q both gives no feedback and requires no input; proposed change
provides more granularity by allowing no input while still providing feedback.


>How-To-Repeat:

N/A

>Fix:

Following diffs to fdformat.c and fdformat.1 seem to work.

===== fdformat.c.diff =====	
*** fdformat.c.orig	Thu Dec 31 21:12:46 1998
--- fdformat.c	Thu Dec 31 21:23:59 1998
***************
*** 138,144 ****
  usage (void)
  {
  	fprintf(stderr, "%s\n%s\n",
! 	"usage: fdformat [-q] [-n | -v] [-f #] [-c #] [-s #] [-h #]",
  	"                [-r #] [-g #] [-i #] [-S #] [-F #] [-t #] devname");
  	exit(2);
  }
--- 138,144 ----
  usage (void)
  {
  	fprintf(stderr, "%s\n%s\n",
! 	"usage: fdformat [-y] [-q] [-n | -v] [-f #] [-c #] [-s #] [-h #]",
  	"                [-r #] [-g #] [-i #] [-S #] [-F #] [-t #] devname");
  	exit(2);
  }
***************
*** 168,179 ****
  {
  	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 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)
  		switch(c) {
  		case 'f':	/* format in kilobytes */
  			format = atoi(optarg);
--- 168,179 ----
  {
  	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, confirm = 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:qyvn")) != -1)
  		switch(c) {
  		case 'f':	/* format in kilobytes */
  			format = atoi(optarg);
***************
*** 219,224 ****
--- 219,228 ----
  			quiet = 1;
  			break;
  
+ 		case 'y':
+ 			confirm = 1;
+ 			break;
+ 
  		case 'n':
  			verify = 0;
  			break;
***************
*** 285,291 ****
  				fdt.tracks * fdt.heads * bytes_per_track / 1024,
  				devname);
  	}
! 	else if(!quiet) {
  		printf("Format %dK floppy `%s'? (y/n): ",
  			fdt.tracks * fdt.heads * bytes_per_track / 1024,
  			devname);
--- 289,295 ----
  				fdt.tracks * fdt.heads * bytes_per_track / 1024,
  				devname);
  	}
! 	else if(!quiet && !confirm) {
  		printf("Format %dK floppy `%s'? (y/n): ",
  			fdt.tracks * fdt.heads * bytes_per_track / 1024,
  			devname);

===== fdformat.1.diff =====
*** fdformat.1.orig	Thu Dec 31 21:47:34 1998
--- fdformat.1	Thu Dec 31 21:52:38 1998
***************
*** 31,36 ****
--- 31,37 ----
  .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
***************
*** 71,76 ****
--- 72,80 ----
  Suppress any normal output from the command, and don't ask the
  user for a confirmation whether to format the floppy disk at
  .Ar device_name .
+ .It Fl y
+ Suppress confirmation request by automagically responding "yes", but still
+ report format status.
  .It Fl f Ar capacity
  The normal way to specify the desired formatting parameters.
  .Ar Capacity
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: phk 
State-Changed-When: Thu Jun 1 15:27:40 PDT 2000 
State-Changed-Why:  
committed thanks 

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