Subject: fdformat output
To: None <current-users@netbsd.org>
From: Mike M. Volokhov <mishka@apk.od.ua>
List: current-users
Date: 07/26/2004 14:36:24
This is a multi-part message in MIME format.
--Multipart=_Mon__26_Jul_2004_14_36_24_+0300_ays7kelN_5RBgb9u
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Greetings!
In bin/15897 Ryo HAYASAKA provides a solution for "damaged" fdformat(1)
output (see details in PR). I have a bit alternate patch for this -
fdformat will print the formatting position, and in case if error
occurs, it will explain the problem and jump to next line. Some example
output will looks like this:
nostromo# ./fdformat
Ready to format /dev/rfd0a with 80 cylinders, 2 tracks, 18 sectors of 512 bytes
(1440 KB) Yes/no [y]?
Formatting track 5 / head 0 - VERIFY ERROR
Formatting track 6 / head 0 - VERIFY ERROR
Formatting track 20 / head 0 - IO ERROR
Formatting track 20 / head 1 - IO ERROR
Formatting track 21 / head 0 - IO ERROR
Formatting track 79 / head 1 (all done)
fdformat: 5 track formatting errors
The tracks 5 and 6 on head 0 have a real errors, and the rest errors
was manualy generated by ejecting floppy from FDD.
The "features" of this:
- works in generic way (\n, \r, etc.)
- more informative than standard fdformat
- no need to cross over theterminal line boundary (for not too narrow
terminals)
- bit shorten than current implementation
The patch applies to fdformat.c revision 1.12.
Any objections, please?
--
Mishka.
--Multipart=_Mon__26_Jul_2004_14_36_24_+0300_ays7kelN_5RBgb9u
Content-Type: text/plain;
name="fdformat.c.patch"
Content-Disposition: attachment;
filename="fdformat.c.patch"
Content-Transfer-Encoding: base64
SW5kZXg6IGZkZm9ybWF0LmMKPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PQpSQ1MgZmlsZTogL2N2c3Jvb3Qvc3JjL3Vzci5i
aW4vZmRmb3JtYXQvZmRmb3JtYXQuYyx2CnJldHJpZXZpbmcgcmV2aXNpb24gMS4xMgpkaWZmIC11
IC1yMS4xMiBmZGZvcm1hdC5jCi0tLSBmZGZv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gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNvbGNudCAlIGNvbHNpemUgPT0g
MCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZv
aWQpcHV0Y2hhcignXG4nKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgIGNvbGNudCsrOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotCQkJCSh2b2lkKXB1dGNo
YXIoJ0YnKTsKLQkJCQlpZiAodmVyaWZ5KQotCQkJCQkodm9pZClwdXRjaGFyKCdcYicpOwotCQkJ
CSh2b2lkKWZmbHVzaChzdGRvdXQpOwogCQkJCWlmICh2ZXJpZnkpCiAJCQkJCWVycmNudCArPSB2
ZXJpZnlfdHJhY2soZmQsIGN5bCwgdHJrLAogCQkJCQkgICAgJnBhcm1zLCB0cmFja2J1Zik7CkBA
IC0zMzMsMTMgKzMwOCwxMiBAQAogCQkJCWVycngoMSwgIkZvcm1hdHRpbmcgYm90Y2ggYXQgPCVk
LCVkPiIsCiAJCQkJICAgICBjeWwsIHRyayk7CiAJCQl9IGVsc2UgaWYgKGVycm5vID09IEVJTykg
ewotCQkJCSh2b2lkKXB1dGNoYXIoJ0UnKTsKLQkJCQkodm9pZClmZmx1c2goc3Rkb3V0KTsKKwkJ
CQkodm9pZClwcmludGYoIi0gSU8gRVJST1JcbiIpOwogCQkJCWVycmNudCsrOwogCQkJfQogCQl9
CiAJfQotCSh2b2lkKXB1dGNoYXIoJ1xuJyk7CisJKHZvaWQpcHJpbnRmKCIoYWxsIGRvbmUpXG4i
KTsKIAlpZiAoZXJyY250KQogCQllcnJ4KDEsICIlZCB0cmFjayBmb3JtYXR0aW5nIGVycm9yJXMi
LAogCQkgICAgZXJyY250LCBlcnJjbnQgPT0gMSA/ICIiIDogInMiKTsK
--Multipart=_Mon__26_Jul_2004_14_36_24_+0300_ays7kelN_5RBgb9u--