diff options
author | Poul-Henning Kamp <phk@FreeBSD.org> | 2004-02-25 13:43:39 +0000 |
---|---|---|
committer | Poul-Henning Kamp <phk@FreeBSD.org> | 2004-02-25 13:43:39 +0000 |
commit | 9b28b5e64fe76569ce49b358dd84d917ac2323e1 (patch) | |
tree | 64102e8bea4e421c176f55d88d0182792c69334d /usr.sbin/fdcontrol | |
parent | 9cee00cf1074bff0d8fb250637e02caed9addc85 (diff) | |
download | src-test2-9b28b5e64fe76569ce49b358dd84d917ac2323e1.tar.gz src-test2-9b28b5e64fe76569ce49b358dd84d917ac2323e1.zip |
Notes
Diffstat (limited to 'usr.sbin/fdcontrol')
-rw-r--r-- | usr.sbin/fdcontrol/Makefile | 2 | ||||
-rw-r--r-- | usr.sbin/fdcontrol/fdcontrol.c | 51 |
2 files changed, 47 insertions, 6 deletions
diff --git a/usr.sbin/fdcontrol/Makefile b/usr.sbin/fdcontrol/Makefile index 32196b78fbd1..be67b664e7ca 100644 --- a/usr.sbin/fdcontrol/Makefile +++ b/usr.sbin/fdcontrol/Makefile @@ -7,6 +7,6 @@ SRCS= fdcontrol.c fdutil.c MAN= fdcontrol.8 WARNS?= 2 -CFLAGS+= -I${.CURDIR}/../fdread +CFLAGS+= -I${.CURDIR}/../fdread -static .include <bsd.prog.mk> diff --git a/usr.sbin/fdcontrol/fdcontrol.c b/usr.sbin/fdcontrol/fdcontrol.c index ba1e1f3dd513..5ef5057e5f77 100644 --- a/usr.sbin/fdcontrol/fdcontrol.c +++ b/usr.sbin/fdcontrol/fdcontrol.c @@ -92,7 +92,9 @@ main(int argc, char **argv) break; case 'f': - if (getnum(optarg, &format)) { + if (!strcmp(optarg, "auto")) { + format = -1; + } else if (getnum(optarg, &format)) { fprintf(stderr, "Bad argument %s to -f option; must be numeric\n", optarg); @@ -124,6 +126,7 @@ main(int argc, char **argv) mode = O_RDONLY | O_NONBLOCK; else mode = O_RDWR; +mode = O_RDONLY | O_NONBLOCK; if((fd = open(argv[0], mode)) < 0) err(EX_UNAVAILABLE, "open(%s)", argv[0]); @@ -154,10 +157,48 @@ main(int argc, char **argv) } if (showfmt) { - if (verbose) - printf("%s: %d KB media type, fmt = ", - argv[0], ft.size / 2); - print_fmt(ft); + if (verbose) { + char *s; + + printf("%s: %d KB media type\n", argv[0], + (128 << ft.secsize) * ft.size / 1024); + printf("\tFormat:\t\t"); + print_fmt(ft); + if (ft.datalen != 0xff && + ft.datalen != (128 << ft.secsize)) + printf("\tData length:\t%d\n", ft.datalen); + printf("\tSector size:\t%d\n", 128 << ft.secsize); + printf("\tSectors/track:\t%d\n", ft.sectrac); + printf("\tHeads/cylinder:\t%d\n", ft.heads); + printf("\tCylinders/disk:\t%d\n", ft.tracks); + switch (ft.trans) { + case 0: printf("\tTransfer rate:\t500 kbps\n"); break; + case 1: printf("\tTransfer rate:\t300 kbps\n"); break; + case 2: printf("\tTransfer rate:\t250 kbps\n"); break; + case 3: printf("\tTransfer rate:\t1 Mbps\n"); break; + } + printf("\tSector gap:\t%d\n", ft.gap); + printf("\tFormat gap:\t%d\n", ft.f_gap); + printf("\tInterleave:\t%d\n", ft.f_inter); + printf("\tSide offset:\t%d\n", ft.offset_side2); + printf("\tFlags\t\t<"); + s = ""; + if (ft.flags & FL_MFM) { + printf("%sMFM", s); + s = ","; + } + if (ft.flags & FL_2STEP) { + printf("%s2STEP", s); + s = ","; + } + if (ft.flags & FL_PERPND) { + printf("%sPERPENDICULAR", s); + s = ","; + } + printf(">\n"); + } else { + print_fmt(ft); + } return (0); } |