From 95bf5e413f062cd563385e46551e7268ad66a3b1 Mon Sep 17 00:00:00 2001 From: ache Date: Sun, 22 Feb 1998 15:28:06 +0000 Subject: Add loadable local<->Unicode conversion support for Win95 names Note: DOS names still not work and require similar changes --- sbin/i386/mount_msdos/Makefile | 10 +++++++++- sbin/i386/mount_msdos/koi2uni | 16 ++++++++++++++++ sbin/i386/mount_msdos/mount_msdos.8 | 16 +++++++++++++++- sbin/i386/mount_msdos/mount_msdos.c | 38 ++++++++++++++++++++++++++++++++++--- sbin/mount_msdos/Makefile | 10 +++++++++- sbin/mount_msdos/mount_msdos.8 | 16 +++++++++++++++- sbin/mount_msdos/mount_msdos.c | 38 ++++++++++++++++++++++++++++++++++--- sbin/mount_msdosfs/Makefile | 10 +++++++++- sbin/mount_msdosfs/mount_msdosfs.8 | 16 +++++++++++++++- sbin/mount_msdosfs/mount_msdosfs.c | 38 ++++++++++++++++++++++++++++++++++--- 10 files changed, 193 insertions(+), 15 deletions(-) create mode 100644 sbin/i386/mount_msdos/koi2uni (limited to 'sbin') diff --git a/sbin/i386/mount_msdos/Makefile b/sbin/i386/mount_msdos/Makefile index 4b8557a..3d2b67c 100644 --- a/sbin/i386/mount_msdos/Makefile +++ b/sbin/i386/mount_msdos/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile,v 1.6 1997/10/21 07:26:50 bde Exp $ +# $Id: Makefile,v 1.7 1998/01/20 10:39:55 bde Exp $ # PROG= mount_msdos @@ -10,4 +10,12 @@ MOUNT= ${.CURDIR}/../../mount CFLAGS+= -I${MOUNT} .PATH: ${MOUNT} +TABDIR= /usr/libdata/msdosfs +TABLES= koi2uni + +afterinstall: + cd ${.CURDIR} && \ + ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${SHAREMODE} \ + ${TABLES} ${TABDIR} + .include diff --git a/sbin/i386/mount_msdos/koi2uni b/sbin/i386/mount_msdos/koi2uni new file mode 100644 index 0000000..3db347c --- /dev/null +++ b/sbin/i386/mount_msdos/koi2uni @@ -0,0 +1,16 @@ +0x2500 0x2502 0x250c 0x2510 0x2514 0x2518 0x251c 0x2524 +0x252c 0x2534 0x253c 0x2580 0x2584 0x2588 0x258c 0x2590 +0x2591 0x2592 0x2593 0x2320 0x25a0 0x2219 0x221a 0x2248 +0x2264 0x2265 0x00a0 0x2321 0x00b0 0x00b2 0x00b7 0x00f7 +0x2550 0x2551 0x2552 0x0451 0x2553 0x2554 0x2555 0x2556 +0x2557 0x2558 0x2559 0x255a 0x255b 0x255c 0x255d 0x255e +0x255f 0x2560 0x2561 0x0401 0x2562 0x2563 0x2564 0x2565 +0x2566 0x2567 0x2568 0x2569 0x256a 0x256b 0x256c 0x00a9 +0x044e 0x0430 0x0431 0x0446 0x0434 0x0435 0x0444 0x0433 +0x0445 0x0438 0x0439 0x043a 0x043b 0x043c 0x043d 0x043e +0x043f 0x044f 0x0440 0x0441 0x0442 0x0443 0x0436 0x0432 +0x044c 0x044b 0x0437 0x0448 0x044d 0x0449 0x0447 0x044a +0x042e 0x0410 0x0411 0x0426 0x0414 0x0415 0x0424 0x0413 +0x0425 0x0418 0x0419 0x041a 0x041b 0x041c 0x041d 0x041e +0x041f 0x042f 0x0420 0x0421 0x0422 0x0423 0x0416 0x0412 +0x042c 0x042b 0x0417 0x0428 0x042d 0x0429 0x0427 0x042a diff --git a/sbin/i386/mount_msdos/mount_msdos.8 b/sbin/i386/mount_msdos/mount_msdos.8 index 9ed2683..97dad8c 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.6 1997/12/19 23:03:00 bde Exp $ +.\" $Id: mount_msdos.8,v 1.7 1998/02/18 09:30:28 jkh Exp $ .\" .Dd April 7, 1994 .Dt MOUNT_MSDOS 8 @@ -46,6 +46,7 @@ .Op Fl l .Op Fl 9 .\".Op Fl G +.Op Fl w Ar table .Pa special .Pa node .Sh DESCRIPTION @@ -127,6 +128,19 @@ 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 +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 +upper half of local character set. +If file path isn't absolute, +.Pa /usr/libdata/msdosfs/ +prefix prepended. +.El +.Sh FILES +.Bl -tag -width /usr/libdata/msdosfs -compact +.It Pa /usr/libdata/msdosfs +default place for Unicode conversion tables .El .Sh SEE ALSO .Xr mount 2 , diff --git a/sbin/i386/mount_msdos/mount_msdos.c b/sbin/i386/mount_msdos/mount_msdos.c index 512ee0d..b747c95 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.10 1997/08/25 20:23:16 bde Exp $"; + "$Id: mount_msdos.c,v 1.11 1998/02/18 09:30:31 jkh Exp $"; #endif /* not lint */ #include @@ -65,6 +65,7 @@ static gid_t a_gid __P((char *)); 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 *)); int main(argc, argv) @@ -81,7 +82,7 @@ main(argc, argv) (void)memset(&args, '\0', sizeof(args)); args.magic = MSDOSFS_ARGSMAGIC; - while ((c = getopt(argc, argv, "sl9u:g:m:o:")) != -1) { + while ((c = getopt(argc, argv, "sl9u:g:m:o:w:")) != -1) { switch (c) { #ifdef MSDOSFSMNT_GEMDOSFS case 'G': @@ -109,6 +110,10 @@ main(argc, argv) args.mask = a_mask(optarg); set_mask = 1; break; + case 'w': + load_u2wtable(args.u2w, optarg); + args.flags |= MSDOSFSMNT_U2WTABLE; + break; case 'o': getmntopts(optarg, mopts, &mntflags, 0); break; @@ -229,6 +234,33 @@ a_mask(s) void usage() { - fprintf(stderr, "usage: mount_msdos [-o options] [-u user] [-g group] [-m mask] bdev dir\n"); + fprintf(stderr, "usage: mount_msdos [-o options] [-u user] [-g group] [-m mask] [-s] [-l] [-9] [-w table] bdev dir\n"); exit(EX_USAGE); } + +void +load_u2wtable (table, name) + u_int16_t *table; + char *name; +{ + FILE *f; + int i, code; + char buf[128]; + char *fn; + + if (*name == '/') + fn = name; + else { + snprintf(buf, sizeof(buf), "/usr/libdata/msdosfs/%s", name); + buf[127] = '\0'; + fn = buf; + } + if ((f = fopen(fn, "r")) == NULL) + err(EX_NOINPUT, "%s", fn); + for (i = 0; i < 128; i++) { + if (fscanf(f, "%i", &code) != 1) + errx(EX_DATAERR, "missing item number %d", i); + table[i] = code; + } + fclose(f); +} diff --git a/sbin/mount_msdos/Makefile b/sbin/mount_msdos/Makefile index 4b8557a..3d2b67c 100644 --- a/sbin/mount_msdos/Makefile +++ b/sbin/mount_msdos/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile,v 1.6 1997/10/21 07:26:50 bde Exp $ +# $Id: Makefile,v 1.7 1998/01/20 10:39:55 bde Exp $ # PROG= mount_msdos @@ -10,4 +10,12 @@ MOUNT= ${.CURDIR}/../../mount CFLAGS+= -I${MOUNT} .PATH: ${MOUNT} +TABDIR= /usr/libdata/msdosfs +TABLES= koi2uni + +afterinstall: + cd ${.CURDIR} && \ + ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${SHAREMODE} \ + ${TABLES} ${TABDIR} + .include diff --git a/sbin/mount_msdos/mount_msdos.8 b/sbin/mount_msdos/mount_msdos.8 index 9ed2683..97dad8c 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.6 1997/12/19 23:03:00 bde Exp $ +.\" $Id: mount_msdos.8,v 1.7 1998/02/18 09:30:28 jkh Exp $ .\" .Dd April 7, 1994 .Dt MOUNT_MSDOS 8 @@ -46,6 +46,7 @@ .Op Fl l .Op Fl 9 .\".Op Fl G +.Op Fl w Ar table .Pa special .Pa node .Sh DESCRIPTION @@ -127,6 +128,19 @@ 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 +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 +upper half of local character set. +If file path isn't absolute, +.Pa /usr/libdata/msdosfs/ +prefix prepended. +.El +.Sh FILES +.Bl -tag -width /usr/libdata/msdosfs -compact +.It Pa /usr/libdata/msdosfs +default place for Unicode conversion tables .El .Sh SEE ALSO .Xr mount 2 , diff --git a/sbin/mount_msdos/mount_msdos.c b/sbin/mount_msdos/mount_msdos.c index 512ee0d..b747c95 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.10 1997/08/25 20:23:16 bde Exp $"; + "$Id: mount_msdos.c,v 1.11 1998/02/18 09:30:31 jkh Exp $"; #endif /* not lint */ #include @@ -65,6 +65,7 @@ static gid_t a_gid __P((char *)); 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 *)); int main(argc, argv) @@ -81,7 +82,7 @@ main(argc, argv) (void)memset(&args, '\0', sizeof(args)); args.magic = MSDOSFS_ARGSMAGIC; - while ((c = getopt(argc, argv, "sl9u:g:m:o:")) != -1) { + while ((c = getopt(argc, argv, "sl9u:g:m:o:w:")) != -1) { switch (c) { #ifdef MSDOSFSMNT_GEMDOSFS case 'G': @@ -109,6 +110,10 @@ main(argc, argv) args.mask = a_mask(optarg); set_mask = 1; break; + case 'w': + load_u2wtable(args.u2w, optarg); + args.flags |= MSDOSFSMNT_U2WTABLE; + break; case 'o': getmntopts(optarg, mopts, &mntflags, 0); break; @@ -229,6 +234,33 @@ a_mask(s) void usage() { - fprintf(stderr, "usage: mount_msdos [-o options] [-u user] [-g group] [-m mask] bdev dir\n"); + fprintf(stderr, "usage: mount_msdos [-o options] [-u user] [-g group] [-m mask] [-s] [-l] [-9] [-w table] bdev dir\n"); exit(EX_USAGE); } + +void +load_u2wtable (table, name) + u_int16_t *table; + char *name; +{ + FILE *f; + int i, code; + char buf[128]; + char *fn; + + if (*name == '/') + fn = name; + else { + snprintf(buf, sizeof(buf), "/usr/libdata/msdosfs/%s", name); + buf[127] = '\0'; + fn = buf; + } + if ((f = fopen(fn, "r")) == NULL) + err(EX_NOINPUT, "%s", fn); + for (i = 0; i < 128; i++) { + if (fscanf(f, "%i", &code) != 1) + errx(EX_DATAERR, "missing item number %d", i); + table[i] = code; + } + fclose(f); +} diff --git a/sbin/mount_msdosfs/Makefile b/sbin/mount_msdosfs/Makefile index 4b8557a..3d2b67c 100644 --- a/sbin/mount_msdosfs/Makefile +++ b/sbin/mount_msdosfs/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile,v 1.6 1997/10/21 07:26:50 bde Exp $ +# $Id: Makefile,v 1.7 1998/01/20 10:39:55 bde Exp $ # PROG= mount_msdos @@ -10,4 +10,12 @@ MOUNT= ${.CURDIR}/../../mount CFLAGS+= -I${MOUNT} .PATH: ${MOUNT} +TABDIR= /usr/libdata/msdosfs +TABLES= koi2uni + +afterinstall: + cd ${.CURDIR} && \ + ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${SHAREMODE} \ + ${TABLES} ${TABDIR} + .include diff --git a/sbin/mount_msdosfs/mount_msdosfs.8 b/sbin/mount_msdosfs/mount_msdosfs.8 index 9ed2683..97dad8c 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.6 1997/12/19 23:03:00 bde Exp $ +.\" $Id: mount_msdos.8,v 1.7 1998/02/18 09:30:28 jkh Exp $ .\" .Dd April 7, 1994 .Dt MOUNT_MSDOS 8 @@ -46,6 +46,7 @@ .Op Fl l .Op Fl 9 .\".Op Fl G +.Op Fl w Ar table .Pa special .Pa node .Sh DESCRIPTION @@ -127,6 +128,19 @@ 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 +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 +upper half of local character set. +If file path isn't absolute, +.Pa /usr/libdata/msdosfs/ +prefix prepended. +.El +.Sh FILES +.Bl -tag -width /usr/libdata/msdosfs -compact +.It Pa /usr/libdata/msdosfs +default place for Unicode conversion tables .El .Sh SEE ALSO .Xr mount 2 , diff --git a/sbin/mount_msdosfs/mount_msdosfs.c b/sbin/mount_msdosfs/mount_msdosfs.c index 512ee0d..b747c95 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.10 1997/08/25 20:23:16 bde Exp $"; + "$Id: mount_msdos.c,v 1.11 1998/02/18 09:30:31 jkh Exp $"; #endif /* not lint */ #include @@ -65,6 +65,7 @@ static gid_t a_gid __P((char *)); 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 *)); int main(argc, argv) @@ -81,7 +82,7 @@ main(argc, argv) (void)memset(&args, '\0', sizeof(args)); args.magic = MSDOSFS_ARGSMAGIC; - while ((c = getopt(argc, argv, "sl9u:g:m:o:")) != -1) { + while ((c = getopt(argc, argv, "sl9u:g:m:o:w:")) != -1) { switch (c) { #ifdef MSDOSFSMNT_GEMDOSFS case 'G': @@ -109,6 +110,10 @@ main(argc, argv) args.mask = a_mask(optarg); set_mask = 1; break; + case 'w': + load_u2wtable(args.u2w, optarg); + args.flags |= MSDOSFSMNT_U2WTABLE; + break; case 'o': getmntopts(optarg, mopts, &mntflags, 0); break; @@ -229,6 +234,33 @@ a_mask(s) void usage() { - fprintf(stderr, "usage: mount_msdos [-o options] [-u user] [-g group] [-m mask] bdev dir\n"); + fprintf(stderr, "usage: mount_msdos [-o options] [-u user] [-g group] [-m mask] [-s] [-l] [-9] [-w table] bdev dir\n"); exit(EX_USAGE); } + +void +load_u2wtable (table, name) + u_int16_t *table; + char *name; +{ + FILE *f; + int i, code; + char buf[128]; + char *fn; + + if (*name == '/') + fn = name; + else { + snprintf(buf, sizeof(buf), "/usr/libdata/msdosfs/%s", name); + buf[127] = '\0'; + fn = buf; + } + if ((f = fopen(fn, "r")) == NULL) + err(EX_NOINPUT, "%s", fn); + for (i = 0; i < 128; i++) { + if (fscanf(f, "%i", &code) != 1) + errx(EX_DATAERR, "missing item number %d", i); + table[i] = code; + } + fclose(f); +} -- cgit v1.1