Daniel,
please find attached a patch that adds a -l|--lower option to fatlabel
to allow lower case characters in labels. Without this option, lower
case characters are not allowed.
Kind regards,
--
Ben Caradoc-Davies <b...@wintersun.org>
>From 47a938f98f829d3fc0640c7c5b374e933c78824c Mon Sep 17 00:00:00 2001
From: Ben Caradoc-Davies <b...@wintersun.org>
Date: Wed, 17 Jul 2013 07:54:18 +0800
Subject: [PATCH] Added -l|--lower option to allow lower case characters in
labels
---
manpages/de/fatlabel.de.8 | 7 +++++--
manpages/en/fatlabel.8 | 6 ++++--
manpages/po/de/fatlabel.8.po | 32 ++++++++++++++++++++++----------
manpages/pot/fatlabel.8.pot | 32 ++++++++++++++++++++++----------
src/fatlabel.c | 26 ++++++++++++++++----------
5 files changed, 69 insertions(+), 34 deletions(-)
diff --git a/manpages/de/fatlabel.de.8 b/manpages/de/fatlabel.de.8
index bf6fd53..aa3b142 100644
--- a/manpages/de/fatlabel.de.8
+++ b/manpages/de/fatlabel.de.8
@@ -30,19 +30,22 @@
\fBfatlabel\fP \- set or get MS\-DOS filesystem label
.SH SYNOPSIS
-\fBfatlabel\fP \fIDEVICE\fP [\fILABEL\fP]
+\fBfatlabel\fP [\fIOPTION\fP] \fIDEVICE\fP [\fILABEL\fP]
.SH DESCRIPTION
\fBfatlabel\fP set or gets a MS\-DOS filesystem label from a given device.
.PP
If the label is omitted, then the label name of the specified device is
-written on the standard output. A label can't be longer than 11 bytes.
+written on the standard output. A label cannot be longer than 11 bytes, or
+contain lower case characters (unless \-l is used).
.SH OPTIONS
.IP "\fB\-h\fP, \fB\-\-help\fP" 4
Displays a help message.
.IP "\fB\-V\fP, \fB\-\-version\fP" 4
Shows version.
+.IP "\fB\-l\fP, \fB\-\-lower\fP" 4
+Allow lower case characters.
.SH "SEE ALSO"
\fBfsck.fat\fP(8)
diff --git a/manpages/en/fatlabel.8 b/manpages/en/fatlabel.8
index 7f4d263..15c832c 100644
--- a/manpages/en/fatlabel.8
+++ b/manpages/en/fatlabel.8
@@ -25,18 +25,20 @@
\fBfatlabel\fR \- set or get MS\-DOS filesystem label
.SH SYNOPSIS
-\fBfatlabel\fR \fIDEVICE\fR [\fILABEL\fR]
+\fBfatlabel\fR [\fIOPTION\fR] \fIDEVICE\fR [\fILABEL\fR]
.SH DESCRIPTION
\fBfatlabel\fR set or gets a MS\-DOS filesystem label from a given device.
.PP
-If the label is omitted, then the label name of the specified device is written on the standard output. A label can't be longer than 11 bytes.
+If the label is omitted, then the label name of the specified device is written on the standard output. A label cannot be longer than 11 bytes, or contain lower case characters (unless \-l is used).
.SH OPTIONS
.IP "\fB\-h\fR, \fB\-\-help\fR" 4
Displays a help message.
.IP "\fB\-V\fR, \fB\-\-version\fR" 4
Shows version.
+.IP "\fB\-l\fR, \fB\-\-lower\fR" 4
+Allow lower case characters.
.SH SEE ALSO
\fBfsck.fat\fR(8)
diff --git a/manpages/po/de/fatlabel.8.po b/manpages/po/de/fatlabel.8.po
index d397e7b..a15124a 100644
--- a/manpages/po/de/fatlabel.8.po
+++ b/manpages/po/de/fatlabel.8.po
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: dosfstools VERSION\n"
-"POT-Creation-Date: 2013-07-16 08:33+0300\n"
+"POT-Creation-Date: 2013-07-17 07:48+0800\n"
"PO-Revision-Date: 2013-06-06 09:34+0300\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
@@ -59,7 +59,7 @@ msgstr ""
#. type: Plain text
#: en/fatlabel.8:29
-msgid "B<fatlabel> I<DEVICE> [I<LABEL>]"
+msgid "B<fatlabel> [I<OPTION>] I<DEVICE> [I<LABEL>]"
msgstr ""
#. type: SH
@@ -77,7 +77,8 @@ msgstr ""
#: en/fatlabel.8:34
msgid ""
"If the label is omitted, then the label name of the specified device is "
-"written on the standard output. A label can't be longer than 11 bytes."
+"written on the standard output. A label cannot be longer than 11 bytes, or "
+"contain lower case characters (unless -l is used)."
msgstr ""
#. type: SH
@@ -108,43 +109,54 @@ msgstr ""
msgid "Shows version."
msgstr ""
+#. type: IP
+#: en/fatlabel.8:40
+#, no-wrap
+msgid "B<-l>, B<--lower>"
+msgstr ""
+
+#. type: Plain text
+#: en/fatlabel.8:42
+msgid "Allow lower case characters."
+msgstr ""
+
#. type: SH
-#: en/fatlabel.8:41 en/fsck.fat.8:128 en/mkfs.fat.8:241
+#: en/fatlabel.8:43 en/fsck.fat.8:128 en/mkfs.fat.8:241
#, no-wrap
msgid "SEE ALSO"
msgstr ""
#. type: Plain text
-#: en/fatlabel.8:43
+#: en/fatlabel.8:45
msgid "B<fsck.fat>(8)"
msgstr ""
#. type: Plain text
-#: en/fatlabel.8:45 en/fsck.fat.8:132
+#: en/fatlabel.8:47 en/fsck.fat.8:132
msgid "B<mkfs.fat>(8)"
msgstr ""
#. type: SH
-#: en/fatlabel.8:46 en/fsck.fat.8:133
+#: en/fatlabel.8:48 en/fsck.fat.8:133
#, no-wrap
msgid "HOMEPAGE"
msgstr ""
#. type: Plain text
-#: en/fatlabel.8:48
+#: en/fatlabel.8:50
msgid ""
"More information about B<fatlabel> and B<dosfstools> can be found at "
"E<lt>I<http://daniel-baumann.ch/software/dosfstools/>E<gt>."
msgstr ""
#. type: SH
-#: en/fatlabel.8:49 en/fsck.fat.8:136
+#: en/fatlabel.8:51 en/fsck.fat.8:136
#, no-wrap
msgid "AUTHORS"
msgstr ""
#. type: Plain text
-#: en/fatlabel.8:50 en/fsck.fat.8:137
+#: en/fatlabel.8:52 en/fsck.fat.8:137
msgid ""
"B<dosfstools> were written by Werner Almesberger E<lt>I<werner."
"almesber...@lrc.di.epfl.ch>E<gt>, Roman Hodek E<lt>I<Roman.Hodek@informatik."
diff --git a/manpages/pot/fatlabel.8.pot b/manpages/pot/fatlabel.8.pot
index 6599269..21ee122 100644
--- a/manpages/pot/fatlabel.8.pot
+++ b/manpages/pot/fatlabel.8.pot
@@ -7,7 +7,7 @@
msgid ""
msgstr ""
"Project-Id-Version: dosfstools VERSION\n"
-"POT-Creation-Date: 2013-07-16 08:33+0300\n"
+"POT-Creation-Date: 2013-07-17 07:48+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <l...@li.org>\n"
@@ -59,7 +59,7 @@ msgstr ""
#. type: Plain text
#: en/fatlabel.8:29
-msgid "B<fatlabel> I<DEVICE> [I<LABEL>]"
+msgid "B<fatlabel> [I<OPTION>] I<DEVICE> [I<LABEL>]"
msgstr ""
#. type: SH
@@ -77,7 +77,8 @@ msgstr ""
#: en/fatlabel.8:34
msgid ""
"If the label is omitted, then the label name of the specified device is "
-"written on the standard output. A label can't be longer than 11 bytes."
+"written on the standard output. A label cannot be longer than 11 bytes, or "
+"contain lower case characters (unless -l is used)."
msgstr ""
#. type: SH
@@ -108,43 +109,54 @@ msgstr ""
msgid "Shows version."
msgstr ""
+#. type: IP
+#: en/fatlabel.8:40
+#, no-wrap
+msgid "B<-l>, B<--lower>"
+msgstr ""
+
+#. type: Plain text
+#: en/fatlabel.8:42
+msgid "Allow lower case characters."
+msgstr ""
+
#. type: SH
-#: en/fatlabel.8:41 en/fsck.fat.8:128 en/mkfs.fat.8:241
+#: en/fatlabel.8:43 en/fsck.fat.8:128 en/mkfs.fat.8:241
#, no-wrap
msgid "SEE ALSO"
msgstr ""
#. type: Plain text
-#: en/fatlabel.8:43
+#: en/fatlabel.8:45
msgid "B<fsck.fat>(8)"
msgstr ""
#. type: Plain text
-#: en/fatlabel.8:45 en/fsck.fat.8:132
+#: en/fatlabel.8:47 en/fsck.fat.8:132
msgid "B<mkfs.fat>(8)"
msgstr ""
#. type: SH
-#: en/fatlabel.8:46 en/fsck.fat.8:133
+#: en/fatlabel.8:48 en/fsck.fat.8:133
#, no-wrap
msgid "HOMEPAGE"
msgstr ""
#. type: Plain text
-#: en/fatlabel.8:48
+#: en/fatlabel.8:50
msgid ""
"More information about B<fatlabel> and B<dosfstools> can be found at "
"E<lt>I<http://daniel-baumann.ch/software/dosfstools/>E<gt>."
msgstr ""
#. type: SH
-#: en/fatlabel.8:49 en/fsck.fat.8:136
+#: en/fatlabel.8:51 en/fsck.fat.8:136
#, no-wrap
msgid "AUTHORS"
msgstr ""
#. type: Plain text
-#: en/fatlabel.8:50 en/fsck.fat.8:137
+#: en/fatlabel.8:52 en/fsck.fat.8:137
msgid ""
"B<dosfstools> were written by Werner Almesberger E<lt>I<werner."
"almesber...@lrc.di.epfl.ch>E<gt>, Roman Hodek E<lt>I<Roman.Hodek@informatik."
diff --git a/src/fatlabel.c b/src/fatlabel.c
index 8397a97..de57a75 100644
--- a/src/fatlabel.c
+++ b/src/fatlabel.c
@@ -40,7 +40,7 @@
#include "file.h"
#include "check.h"
-int interactive = 0, rw = 0, list = 0, test = 0, verbose = 0, write_immed = 0;
+int interactive = 0, rw = 0, list = 0, test = 0, verbose = 0, write_immed = 0, lower = 0;
int atari_format = 0;
unsigned n_files = 0;
void *mem_queue = NULL;
@@ -50,7 +50,7 @@ static void usage(int error)
FILE *f = error ? stderr : stdout;
int status = error ? 1 : 0;
- fprintf(f, "usage: fatlabel device [label]\n");
+ fprintf(f, "usage: fatlabel [-h|-V|-l] device [label]\n");
exit(status);
}
@@ -97,7 +97,7 @@ int main(int argc, char *argv[])
check_atari();
- if (argc < 2 || argc > 3)
+ if (argc < 2 || argc > 4)
usage(1);
if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help"))
@@ -105,6 +105,10 @@ int main(int argc, char *argv[])
else if (!strcmp(argv[1], "-V") || !strcmp(argv[1], "--version")) {
printf("fatlabel " VERSION " (" VERSION_DATE ")\n");
exit(0);
+ } else if (!strcmp(argv[1], "-l") || !strcmp(argv[1], "--lower")) {
+ lower = 1;
+ argv++;
+ argc--;
}
device = argv[1];
@@ -115,13 +119,15 @@ int main(int argc, char *argv[])
"fatlabel: labels can be no longer than 11 characters\n");
exit(1);
}
- for (i = 0; label[i] && i < 11; i++)
- /* don't know if here should be more strict !uppercase(label[i]) */
- if (islower(label[i])) {
- fprintf(stderr,
- "fatlabel: labels cannot contain lower case characters\n");
- exit(1);
- }
+ if (!lower) {
+ for (i = 0; label[i] && i < 11; i++)
+ /* don't know if here should be more strict !uppercase(label[i]) */
+ if (islower(label[i])) {
+ fprintf(stderr,
+ "fatlabel: labels cannot contain lower case characters\n");
+ exit(1);
+ }
+ }
rw = 1;
}
--
1.8.3.2