diff options
author | phk <phk@FreeBSD.org> | 2000-06-01 22:27:30 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2000-06-01 22:27:30 +0000 |
commit | cd07a5410ebdb7b6ba2a119cb348ff5c105e1d53 (patch) | |
tree | 40da20b636204a2f0ea2a8420d062c23adfb3dd5 /usr.sbin/fdformat/fdformat.c | |
parent | 2e5551ad87228caa7a774df7bfb17c1e7bbf85a7 (diff) | |
download | FreeBSD-src-cd07a5410ebdb7b6ba2a119cb348ff5c105e1d53.zip FreeBSD-src-cd07a5410ebdb7b6ba2a119cb348ff5c105e1d53.tar.gz |
Add -y option which doesn't ask for confimation, but still shows progress
PR: 9259
Submitted by: Clark Gaylord <cgaylord@vt.edu>
Diffstat (limited to 'usr.sbin/fdformat/fdformat.c')
-rw-r--r-- | usr.sbin/fdformat/fdformat.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/usr.sbin/fdformat/fdformat.c b/usr.sbin/fdformat/fdformat.c index 0abf0c7..53db668 100644 --- a/usr.sbin/fdformat/fdformat.c +++ b/usr.sbin/fdformat/fdformat.c @@ -140,7 +140,7 @@ static void usage (void) { fprintf(stderr, "%s\n%s\n", - "usage: fdformat [-q] [-n | -v] [-f #] [-c #] [-s #] [-h #]", + "usage: fdformat [-y] [-q] [-n | -v] [-f #] [-c #] [-s #] [-h #]", " [-r #] [-g #] [-i #] [-S #] [-F #] [-t #] devname"); exit(2); } @@ -170,12 +170,12 @@ main(int argc, char **argv) { 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, 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: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); @@ -221,6 +221,10 @@ main(int argc, char **argv) quiet = 1; break; + case 'y': + confirm = 1; + break; + case 'n': verify = 0; break; @@ -291,7 +295,7 @@ main(int argc, char **argv) fdt.tracks * fdt.heads * bytes_per_track / 1024, devname); } - else if(!quiet) { + else if(!quiet && !confirm) { printf("Format %dK floppy `%s'? (y/n): ", fdt.tracks * fdt.heads * bytes_per_track / 1024, devname); |