summaryrefslogtreecommitdiffstats
path: root/usr.sbin/fdformat
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2000-06-01 22:27:30 +0000
committerphk <phk@FreeBSD.org>2000-06-01 22:27:30 +0000
commitcd07a5410ebdb7b6ba2a119cb348ff5c105e1d53 (patch)
tree40da20b636204a2f0ea2a8420d062c23adfb3dd5 /usr.sbin/fdformat
parent2e5551ad87228caa7a774df7bfb17c1e7bbf85a7 (diff)
downloadFreeBSD-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')
-rw-r--r--usr.sbin/fdformat/fdformat.14
-rw-r--r--usr.sbin/fdformat/fdformat.c12
2 files changed, 12 insertions, 4 deletions
diff --git a/usr.sbin/fdformat/fdformat.1 b/usr.sbin/fdformat/fdformat.1
index 998aa42..306e575 100644
--- a/usr.sbin/fdformat/fdformat.1
+++ b/usr.sbin/fdformat/fdformat.1
@@ -33,6 +33,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
@@ -73,6 +74,9 @@ The options are as follows:
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
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);
OpenPOWER on IntegriCloud