Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Dec 1998 22:48:19 -0500 (EST)
From:      cgaylord@vt.edu
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   bin/9259: Adding -y to fdformat for autoyes
Message-ID:  <199901010348.WAA58228@gaylord.async.vt.edu>

next in thread | raw e-mail | index | archive | help

>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:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Dec 31 19:50:01 PST 1998
>Last-Modified:
>Originator:     Clark Gaylord
>Organization:
Virginia Tech
>Release:        FreeBSD 3.0-CURRENT i386
>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
>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?199901010348.WAA58228>