4d2d26a5269fd5f91f861715ca808d6c2dd1428f
[openwrt/openwrt.git] / tools / dosfstools / patches / 0005-mkfs.fat-Allow-0xF0-to-be-specified-as-media-byte.patch
1 From 266a5fc635135a9ffaa8683da1ec03aae1553b7b Mon Sep 17 00:00:00 2001
2 From: Andreas Bombe <aeb@debian.org>
3 Date: Fri, 20 Feb 2015 03:19:28 +0100
4 Subject: [PATCH 05/14] mkfs.fat: Allow 0xF0 to be specified as media byte
5
6 Let the -M option accept 0xF0, which should be the proper descriptor
7 byte for 3.5" 1.44 MB and 2.88 MB floppies.
8
9 Also split the error reporting for -M between badly formatted and
10 invalid numbers.
11
12 Signed-off-by: Andreas Bombe <aeb@debian.org>
13 ---
14 manpages/de/mkfs.fat.de.8 | 4 ++--
15 manpages/en/mkfs.fat.8 | 2 +-
16 manpages/po/de/mkfs.fat.8.po | 6 +++---
17 manpages/pot/mkfs.fat.8.pot | 6 +++---
18 src/mkfs.fat.c | 12 ++++++++----
19 5 files changed, 17 insertions(+), 13 deletions(-)
20
21 diff --git a/manpages/de/mkfs.fat.de.8 b/manpages/de/mkfs.fat.de.8
22 index 5a6eb1a..2386410 100644
23 --- a/manpages/de/mkfs.fat.de.8
24 +++ b/manpages/de/mkfs.fat.de.8
25 @@ -121,8 +121,8 @@ return\-line feed combinations, and tabs have been expanded. If the filename
26 is a hyphen (\-), the text is taken from standard input.
27 .IP "\fB\-M\fP \fIFAT\-media\-type\fP" 4
28 Specify the media type to be stored in the FAT boot sector. This value is
29 -usually 0xF8 for hard disks and has a value from 0xF9 to 0xFF for floppies
30 -or partitions to be used for floppy emulation.
31 +usually 0xF8 for hard disks and is 0xF0 or a value from 0xF9 to 0xFF for
32 +floppies or partitions to be used for floppy emulation.
33 .IP "\fB\-n\fP \fIvolume\-name\fP" 4
34 Sets the volume name (label) of the filesystem. The volume name can be up to
35 11 characters long. The default is no label.
36 diff --git a/manpages/en/mkfs.fat.8 b/manpages/en/mkfs.fat.8
37 index 9dd8115..81bf461 100644
38 --- a/manpages/en/mkfs.fat.8
39 +++ b/manpages/en/mkfs.fat.8
40 @@ -58,7 +58,7 @@ Read the bad blocks list from \fIfilename\fR.
41 .IP "\fB\-m\fR \fImessage-file\fR" 4
42 Sets the message the user receives on attempts to boot this filesystem without having properly installed an operating system. The message file must not exceed 418 bytes once line feeds have been converted to carriage return-line feed combinations, and tabs have been expanded. If the filename is a hyphen (-), the text is taken from standard input.
43 .IP "\fB\-M\fR \fIFAT-media-type\fR" 4
44 -Specify the media type to be stored in the FAT boot sector. This value is usually 0xF8 for hard disks and has a value from 0xF9 to 0xFF for floppies or partitions to be used for floppy emulation.
45 +Specify the media type to be stored in the FAT boot sector. This value is usually 0xF8 for hard disks and is 0xF0 or a value from 0xF9 to 0xFF for floppies or partitions to be used for floppy emulation.
46 .IP "\fB\-n\fR \fIvolume-name\fR" 4
47 Sets the volume name (label) of the filesystem. The volume name can be up to 11 characters long. The default is no label.
48 .IP "\fB\-r\fR \fIroot-dir-entries\fR" 4
49 diff --git a/manpages/po/de/mkfs.fat.8.po b/manpages/po/de/mkfs.fat.8.po
50 index 2531179..360fe16 100644
51 --- a/manpages/po/de/mkfs.fat.8.po
52 +++ b/manpages/po/de/mkfs.fat.8.po
53 @@ -3,7 +3,7 @@
54 msgid ""
55 msgstr ""
56 "Project-Id-Version: dosfstools VERSION\n"
57 -"POT-Creation-Date: 2014-11-12 00:52+0100\n"
58 +"POT-Creation-Date: 2015-02-20 03:31+0100\n"
59 "PO-Revision-Date: 2013-06-06 09:34+0300\n"
60 "Last-Translator: Automatically generated\n"
61 "Language-Team: none\n"
62 @@ -354,8 +354,8 @@ msgstr ""
63 #: en/mkfs.fat.8:62
64 msgid ""
65 "Specify the media type to be stored in the FAT boot sector. This value is "
66 -"usually 0xF8 for hard disks and has a value from 0xF9 to 0xFF for floppies "
67 -"or partitions to be used for floppy emulation."
68 +"usually 0xF8 for hard disks and is 0xF0 or a value from 0xF9 to 0xFF for "
69 +"floppies or partitions to be used for floppy emulation."
70 msgstr ""
71
72 #. type: IP
73 diff --git a/manpages/pot/mkfs.fat.8.pot b/manpages/pot/mkfs.fat.8.pot
74 index a6106bc..32486ea 100644
75 --- a/manpages/pot/mkfs.fat.8.pot
76 +++ b/manpages/pot/mkfs.fat.8.pot
77 @@ -7,7 +7,7 @@
78 msgid ""
79 msgstr ""
80 "Project-Id-Version: dosfstools VERSION\n"
81 -"POT-Creation-Date: 2014-11-12 00:52+0100\n"
82 +"POT-Creation-Date: 2015-02-20 03:31+0100\n"
83 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
84 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
85 "Language-Team: LANGUAGE <LL@li.org>\n"
86 @@ -357,8 +357,8 @@ msgstr ""
87 #: en/mkfs.fat.8:62
88 msgid ""
89 "Specify the media type to be stored in the FAT boot sector. This value is "
90 -"usually 0xF8 for hard disks and has a value from 0xF9 to 0xFF for floppies "
91 -"or partitions to be used for floppy emulation."
92 +"usually 0xF8 for hard disks and is 0xF0 or a value from 0xF9 to 0xFF for "
93 +"floppies or partitions to be used for floppy emulation."
94 msgstr ""
95
96 #. type: IP
97 diff --git a/src/mkfs.fat.c b/src/mkfs.fat.c
98 index a3dff54..e6f9390 100644
99 --- a/src/mkfs.fat.c
100 +++ b/src/mkfs.fat.c
101 @@ -1569,10 +1569,14 @@ int main(int argc, char **argv)
102 break;
103
104 case 'M': /* M : FAT Media byte */
105 - fat_media_byte = (int) strtol (optarg, &tmp, 0);
106 - if (*tmp || fat_media_byte < 248 || fat_media_byte > 255) {
107 - printf ("FAT Media byte must be between 0xF8 and 0xFF : %s\n", optarg);
108 - usage ();
109 + fat_media_byte = (int)strtol(optarg, &tmp, 0);
110 + if (*tmp) {
111 + printf("Bad number for media descriptor : %s\n", optarg);
112 + usage();
113 + }
114 + if (fat_media_byte != 0xf0 && (fat_media_byte < 0xf8 || fat_media_byte > 0xff)) {
115 + printf("FAT Media byte must either be between 0xF8 and 0xFF or be 0xF0 : %s\n", optarg);
116 + usage();
117 }
118 break;
119
120 --
121 1.9.1
122