From 218314382592fa830247b3a7d856ac1d818e03aa Mon Sep 17 00:00:00 2001 From: "Andrey A. Chernov" Date: Mon, 23 Feb 1998 09:41:02 +0000 Subject: [PATCH] Implement loadable upper->lower local conversion table Recently introduced -w renamed to -W --- sbin/i386/mount_msdos/mount_msdos.8 | 10 +++++++--- sbin/i386/mount_msdos/mount_msdos.c | 27 +++++++++++++++++++++++---- sbin/mount_msdos/mount_msdos.8 | 10 +++++++--- sbin/mount_msdos/mount_msdos.c | 27 +++++++++++++++++++++++---- sbin/mount_msdosfs/mount_msdosfs.8 | 10 +++++++--- sbin/mount_msdosfs/mount_msdosfs.c | 27 +++++++++++++++++++++++---- 6 files changed, 90 insertions(+), 21 deletions(-) diff --git a/sbin/i386/mount_msdos/mount_msdos.8 b/sbin/i386/mount_msdos/mount_msdos.8 index 97dad8c0c2c7..dc36d999952d 100644 --- a/sbin/i386/mount_msdos/mount_msdos.8 +++ b/sbin/i386/mount_msdos/mount_msdos.8 @@ -28,7 +28,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: mount_msdos.8,v 1.7 1998/02/18 09:30:28 jkh Exp $ +.\" $Id: mount_msdos.8,v 1.8 1998/02/22 15:28:00 ache Exp $ .\" .Dd April 7, 1994 .Dt MOUNT_MSDOS 8 @@ -46,7 +46,8 @@ .Op Fl l .Op Fl 9 .\".Op Fl G -.Op Fl w Ar table +.Op Fl L Ar locale +.Op Fl W Ar table .Pa special .Pa node .Sh DESCRIPTION @@ -128,7 +129,10 @@ if deleting or renaming a file. This forces .\"filesystem. The differences to the msdos filesystem are minimal and .\"limited to the boot block. This option enforces .\".Fl s . -.It Fl w Ar table +.It Fl L Ar locale +Specify locale name used for internal uppercase to lowercase conversion +for DOS and Win'95 names. +.It Fl W Ar table Specify file with local character set to Unicode conversion table for Win'95 long names. This table is text file contains 128 Unicode codes corresponding to diff --git a/sbin/i386/mount_msdos/mount_msdos.c b/sbin/i386/mount_msdos/mount_msdos.c index b747c95fec43..c65a2f9370b3 100644 --- a/sbin/i386/mount_msdos/mount_msdos.c +++ b/sbin/i386/mount_msdos/mount_msdos.c @@ -32,7 +32,7 @@ #ifndef lint static const char rcsid[] = - "$Id: mount_msdos.c,v 1.11 1998/02/18 09:30:31 jkh Exp $"; + "$Id: mount_msdos.c,v 1.12 1998/02/22 15:28:06 ache Exp $"; #endif /* not lint */ #include @@ -44,6 +44,7 @@ static const char rcsid[] = #include #include #include +#include #include #include #include @@ -66,6 +67,7 @@ static uid_t a_uid __P((char *)); static mode_t a_mask __P((char *)); static void usage __P((void)) __dead2; static void load_u2wtable __P((u_int16_t *, char *)); +static void load_ultable __P((u_int8_t *, char *)); int main(argc, argv) @@ -82,7 +84,7 @@ main(argc, argv) (void)memset(&args, '\0', sizeof(args)); args.magic = MSDOSFS_ARGSMAGIC; - while ((c = getopt(argc, argv, "sl9u:g:m:o:w:")) != -1) { + while ((c = getopt(argc, argv, "sl9u:g:m:o:L:W:")) != -1) { switch (c) { #ifdef MSDOSFSMNT_GEMDOSFS case 'G': @@ -110,7 +112,11 @@ main(argc, argv) args.mask = a_mask(optarg); set_mask = 1; break; - case 'w': + case 'L': + load_ultable(args.ul, optarg); + args.flags |= MSDOSFSMNT_ULTABLE; + break; + case 'W': load_u2wtable(args.u2w, optarg); args.flags |= MSDOSFSMNT_U2WTABLE; break; @@ -234,7 +240,7 @@ a_mask(s) void usage() { - fprintf(stderr, "usage: mount_msdos [-o options] [-u user] [-g group] [-m mask] [-s] [-l] [-9] [-w table] bdev dir\n"); + fprintf(stderr, "usage: mount_msdos [-o options] [-u user] [-g group] [-m mask] [-s] [-l] [-9] [-L locale] [-W table] bdev dir\n"); exit(EX_USAGE); } @@ -264,3 +270,16 @@ load_u2wtable (table, name) } fclose(f); } + +void +load_ultable (table, name) + u_int8_t *table; + char *name; +{ + int i; + + if (setlocale(LC_CTYPE, name) == NULL) + err(EX_CONFIG, name); + for (i = 0; i < 128; i++) + table[i] = tolower(i | 0x80); +} diff --git a/sbin/mount_msdos/mount_msdos.8 b/sbin/mount_msdos/mount_msdos.8 index 97dad8c0c2c7..dc36d999952d 100644 --- a/sbin/mount_msdos/mount_msdos.8 +++ b/sbin/mount_msdos/mount_msdos.8 @@ -28,7 +28,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: mount_msdos.8,v 1.7 1998/02/18 09:30:28 jkh Exp $ +.\" $Id: mount_msdos.8,v 1.8 1998/02/22 15:28:00 ache Exp $ .\" .Dd April 7, 1994 .Dt MOUNT_MSDOS 8 @@ -46,7 +46,8 @@ .Op Fl l .Op Fl 9 .\".Op Fl G -.Op Fl w Ar table +.Op Fl L Ar locale +.Op Fl W Ar table .Pa special .Pa node .Sh DESCRIPTION @@ -128,7 +129,10 @@ if deleting or renaming a file. This forces .\"filesystem. The differences to the msdos filesystem are minimal and .\"limited to the boot block. This option enforces .\".Fl s . -.It Fl w Ar table +.It Fl L Ar locale +Specify locale name used for internal uppercase to lowercase conversion +for DOS and Win'95 names. +.It Fl W Ar table Specify file with local character set to Unicode conversion table for Win'95 long names. This table is text file contains 128 Unicode codes corresponding to diff --git a/sbin/mount_msdos/mount_msdos.c b/sbin/mount_msdos/mount_msdos.c index b747c95fec43..c65a2f9370b3 100644 --- a/sbin/mount_msdos/mount_msdos.c +++ b/sbin/mount_msdos/mount_msdos.c @@ -32,7 +32,7 @@ #ifndef lint static const char rcsid[] = - "$Id: mount_msdos.c,v 1.11 1998/02/18 09:30:31 jkh Exp $"; + "$Id: mount_msdos.c,v 1.12 1998/02/22 15:28:06 ache Exp $"; #endif /* not lint */ #include @@ -44,6 +44,7 @@ static const char rcsid[] = #include #include #include +#include #include #include #include @@ -66,6 +67,7 @@ static uid_t a_uid __P((char *)); static mode_t a_mask __P((char *)); static void usage __P((void)) __dead2; static void load_u2wtable __P((u_int16_t *, char *)); +static void load_ultable __P((u_int8_t *, char *)); int main(argc, argv) @@ -82,7 +84,7 @@ main(argc, argv) (void)memset(&args, '\0', sizeof(args)); args.magic = MSDOSFS_ARGSMAGIC; - while ((c = getopt(argc, argv, "sl9u:g:m:o:w:")) != -1) { + while ((c = getopt(argc, argv, "sl9u:g:m:o:L:W:")) != -1) { switch (c) { #ifdef MSDOSFSMNT_GEMDOSFS case 'G': @@ -110,7 +112,11 @@ main(argc, argv) args.mask = a_mask(optarg); set_mask = 1; break; - case 'w': + case 'L': + load_ultable(args.ul, optarg); + args.flags |= MSDOSFSMNT_ULTABLE; + break; + case 'W': load_u2wtable(args.u2w, optarg); args.flags |= MSDOSFSMNT_U2WTABLE; break; @@ -234,7 +240,7 @@ a_mask(s) void usage() { - fprintf(stderr, "usage: mount_msdos [-o options] [-u user] [-g group] [-m mask] [-s] [-l] [-9] [-w table] bdev dir\n"); + fprintf(stderr, "usage: mount_msdos [-o options] [-u user] [-g group] [-m mask] [-s] [-l] [-9] [-L locale] [-W table] bdev dir\n"); exit(EX_USAGE); } @@ -264,3 +270,16 @@ load_u2wtable (table, name) } fclose(f); } + +void +load_ultable (table, name) + u_int8_t *table; + char *name; +{ + int i; + + if (setlocale(LC_CTYPE, name) == NULL) + err(EX_CONFIG, name); + for (i = 0; i < 128; i++) + table[i] = tolower(i | 0x80); +} diff --git a/sbin/mount_msdosfs/mount_msdosfs.8 b/sbin/mount_msdosfs/mount_msdosfs.8 index 97dad8c0c2c7..dc36d999952d 100644 --- a/sbin/mount_msdosfs/mount_msdosfs.8 +++ b/sbin/mount_msdosfs/mount_msdosfs.8 @@ -28,7 +28,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: mount_msdos.8,v 1.7 1998/02/18 09:30:28 jkh Exp $ +.\" $Id: mount_msdos.8,v 1.8 1998/02/22 15:28:00 ache Exp $ .\" .Dd April 7, 1994 .Dt MOUNT_MSDOS 8 @@ -46,7 +46,8 @@ .Op Fl l .Op Fl 9 .\".Op Fl G -.Op Fl w Ar table +.Op Fl L Ar locale +.Op Fl W Ar table .Pa special .Pa node .Sh DESCRIPTION @@ -128,7 +129,10 @@ if deleting or renaming a file. This forces .\"filesystem. The differences to the msdos filesystem are minimal and .\"limited to the boot block. This option enforces .\".Fl s . -.It Fl w Ar table +.It Fl L Ar locale +Specify locale name used for internal uppercase to lowercase conversion +for DOS and Win'95 names. +.It Fl W Ar table Specify file with local character set to Unicode conversion table for Win'95 long names. This table is text file contains 128 Unicode codes corresponding to diff --git a/sbin/mount_msdosfs/mount_msdosfs.c b/sbin/mount_msdosfs/mount_msdosfs.c index b747c95fec43..c65a2f9370b3 100644 --- a/sbin/mount_msdosfs/mount_msdosfs.c +++ b/sbin/mount_msdosfs/mount_msdosfs.c @@ -32,7 +32,7 @@ #ifndef lint static const char rcsid[] = - "$Id: mount_msdos.c,v 1.11 1998/02/18 09:30:31 jkh Exp $"; + "$Id: mount_msdos.c,v 1.12 1998/02/22 15:28:06 ache Exp $"; #endif /* not lint */ #include @@ -44,6 +44,7 @@ static const char rcsid[] = #include #include #include +#include #include #include #include @@ -66,6 +67,7 @@ static uid_t a_uid __P((char *)); static mode_t a_mask __P((char *)); static void usage __P((void)) __dead2; static void load_u2wtable __P((u_int16_t *, char *)); +static void load_ultable __P((u_int8_t *, char *)); int main(argc, argv) @@ -82,7 +84,7 @@ main(argc, argv) (void)memset(&args, '\0', sizeof(args)); args.magic = MSDOSFS_ARGSMAGIC; - while ((c = getopt(argc, argv, "sl9u:g:m:o:w:")) != -1) { + while ((c = getopt(argc, argv, "sl9u:g:m:o:L:W:")) != -1) { switch (c) { #ifdef MSDOSFSMNT_GEMDOSFS case 'G': @@ -110,7 +112,11 @@ main(argc, argv) args.mask = a_mask(optarg); set_mask = 1; break; - case 'w': + case 'L': + load_ultable(args.ul, optarg); + args.flags |= MSDOSFSMNT_ULTABLE; + break; + case 'W': load_u2wtable(args.u2w, optarg); args.flags |= MSDOSFSMNT_U2WTABLE; break; @@ -234,7 +240,7 @@ a_mask(s) void usage() { - fprintf(stderr, "usage: mount_msdos [-o options] [-u user] [-g group] [-m mask] [-s] [-l] [-9] [-w table] bdev dir\n"); + fprintf(stderr, "usage: mount_msdos [-o options] [-u user] [-g group] [-m mask] [-s] [-l] [-9] [-L locale] [-W table] bdev dir\n"); exit(EX_USAGE); } @@ -264,3 +270,16 @@ load_u2wtable (table, name) } fclose(f); } + +void +load_ultable (table, name) + u_int8_t *table; + char *name; +{ + int i; + + if (setlocale(LC_CTYPE, name) == NULL) + err(EX_CONFIG, name); + for (i = 0; i < 128; i++) + table[i] = tolower(i | 0x80); +}