summaryrefslogtreecommitdiffstats
path: root/sbin/mount_msdosfs
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1998-02-23 16:49:16 +0000
committerache <ache@FreeBSD.org>1998-02-23 16:49:16 +0000
commit24cabc92c35269b989994eb4c2a6edf8b7dcf31c (patch)
treee456275720ee4b92d04420e572401ac518f3de80 /sbin/mount_msdosfs
parent495995d8abf05d35e39492513fef8d94d7282d31 (diff)
downloadFreeBSD-src-24cabc92c35269b989994eb4c2a6edf8b7dcf31c.zip
FreeBSD-src-24cabc92c35269b989994eb4c2a6edf8b7dcf31c.tar.gz
Implement loadable DOS<->local conversion tables for DOS names
Additionly load toupper table to create DOS names always in uppercase
Diffstat (limited to 'sbin/mount_msdosfs')
-rw-r--r--sbin/mount_msdosfs/Makefile4
-rw-r--r--sbin/mount_msdosfs/koi2dos50
-rw-r--r--sbin/mount_msdosfs/mount_msdosfs.821
-rw-r--r--sbin/mount_msdosfs/mount_msdosfs.c38
4 files changed, 92 insertions, 21 deletions
diff --git a/sbin/mount_msdosfs/Makefile b/sbin/mount_msdosfs/Makefile
index 6e9fd5f..d172a07 100644
--- a/sbin/mount_msdosfs/Makefile
+++ b/sbin/mount_msdosfs/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile,v 1.8 1998/02/22 15:27:56 ache Exp $
+# $Id: Makefile,v 1.9 1998/02/23 09:10:56 ache Exp $
#
PROG= mount_msdos
@@ -11,7 +11,7 @@ CFLAGS+= -I${MOUNT}
.PATH: ${MOUNT}
TABDIR= ${DESTDIR}/usr/libdata/msdosfs
-TABLES= koi2uni
+TABLES= koi2dos
afterinstall:
cd ${.CURDIR} && \
diff --git a/sbin/mount_msdosfs/koi2dos b/sbin/mount_msdosfs/koi2dos
new file mode 100644
index 0000000..0db136b
--- /dev/null
+++ b/sbin/mount_msdosfs/koi2dos
@@ -0,0 +1,50 @@
+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
+
+0xe1 0xe2 0xf7 0xe7 0xe4 0xe5 0xf6 0xfa
+0xe9 0xea 0xeb 0xec 0xed 0xee 0xef 0xf0
+0xf2 0xf3 0xf4 0xf5 0xe6 0xe8 0xe3 0xfe
+0xfb 0xfd 0xff 0xf9 0xf8 0xfc 0xe0 0xf1
+0xc1 0xc2 0xd7 0xc7 0xc4 0xc5 0xd6 0xda
+0xc9 0xca 0xcb 0xcc 0xcd 0xce 0xcf 0xd0
+0x90 0x91 0x92 0x81 0x87 0xb2 0xb4 0xa7
+0xa6 0xb5 0xa1 0xa8 0xae 0xad 0xac 0x83
+0x84 0x89 0x88 0x86 0x80 0x8a 0xaf 0xb0
+0xab 0xa5 0xbb 0xb8 0xb1 0xa0 0xbe 0xb9
+0xba 0xb6 0xb7 0xaa 0xa9 0xa2 0xa4 0xbd
+0xbc 0x85 0x82 0x8d 0x8c 0x8e 0x8f 0x8b
+0xd2 0xd3 0xd4 0xd5 0xc6 0xc8 0xc3 0xde
+0xdb 0xdd 0xdf 0xd9 0xd8 0xdc 0xc0 0xd1
+0xb3 0xa3 229 197 73 105 245 213
+0x9c 0x95 0x9e 0x96 78 210 0x94 0x9a
+
+0xc4 0xb3 0xda 0xbf 0xc0 0xd9 0xc3 0xb4
+0xc2 0xc1 0xc5 0xdf 0xdc 0xdb 0xdd 0xde
+0xb0 0xb1 0xb2 179 0xfe 0xf9 0xfb 61
+ 60 62 0xff 179 0xf8 50 0xfa 58
+0xcd 0xba 0xd5 0xf1 0xd6 0xc9 0xb8 0xb7
+0xbb 0xd4 0xd3 0xc8 0xbe 0xbd 0xbc 0xc6
+0xc7 0xcc 0xb5 0xf0 0xb6 0xb9 0xd1 0xd2
+0xcb 0xcf 0xd0 0xca 0xd8 0xd7 0xce 99
+0xee 0xa0 0xa1 0xe6 0xa4 0xa5 0xe4 0xa3
+0xe5 0xa8 0xa9 0xaa 0xab 0xac 0xad 0xae
+0xaf 0xef 0xe0 0xe1 0xe2 0xe3 0xa6 0xa2
+0xec 0xeb 0xa7 0xe8 0xed 0xe9 0xe7 0xea
+0x9e 0x80 0x81 0x96 0x84 0x85 0x94 0x83
+0x95 0x88 0x89 0x8a 0x8b 0x8c 0x8d 0x8e
+0x8f 0x9f 0x90 0x91 0x92 0x93 0x86 0x82
+0x9c 0x9b 0x87 0x98 0x9d 0x99 0x97 0x9a
diff --git a/sbin/mount_msdosfs/mount_msdosfs.8 b/sbin/mount_msdosfs/mount_msdosfs.8
index dc36d99..632eecb 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.8 1998/02/22 15:28:00 ache Exp $
+.\" $Id: mount_msdos.8,v 1.9 1998/02/23 09:41:01 ache Exp $
.\"
.Dd April 7, 1994
.Dt MOUNT_MSDOS 8
@@ -130,13 +130,22 @@ if deleting or renaming a file. This forces
.\"limited to the boot block. This option enforces
.\".Fl s .
.It Fl L Ar locale
-Specify locale name used for internal uppercase to lowercase conversion
+Specify locale name used for internal uppercase and lowercase conversions
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
-upper half of local character set.
+Specify text file with 3 conversion tables:
+.Bl -enum
+.It
+Local character set to Unicode conversion table (upper half) for Win'95 long
+names, 128 Unicode codes.
+.It
+DOS to local character set conversion table (upper half) for DOS names,
+128 character codes.
+.It
+Local character set to DOS conversion table (upper half) for DOS names,
+128 character codes.
+.El
+.Pp
If file path isn't absolute,
.Pa /usr/libdata/msdosfs/
prefix prepended.
diff --git a/sbin/mount_msdosfs/mount_msdosfs.c b/sbin/mount_msdosfs/mount_msdosfs.c
index c65a2f9..8d7e428 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.12 1998/02/22 15:28:06 ache Exp $";
+ "$Id: mount_msdos.c,v 1.13 1998/02/23 09:41:02 ache Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -66,8 +66,8 @@ 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 *));
-static void load_ultable __P((u_int8_t *, char *));
+static void load_u2wtable __P((struct msdosfs_args *, char *));
+static void load_ultable __P((struct msdosfs_args *, char *));
int
main(argc, argv)
@@ -113,11 +113,11 @@ main(argc, argv)
set_mask = 1;
break;
case 'L':
- load_ultable(args.ul, optarg);
+ load_ultable(&args, optarg);
args.flags |= MSDOSFSMNT_ULTABLE;
break;
case 'W':
- load_u2wtable(args.u2w, optarg);
+ load_u2wtable(&args, optarg);
args.flags |= MSDOSFSMNT_U2WTABLE;
break;
case 'o':
@@ -245,8 +245,8 @@ usage()
}
void
-load_u2wtable (table, name)
- u_int16_t *table;
+load_u2wtable (pargs, name)
+ struct msdosfs_args *pargs;
char *name;
{
FILE *f;
@@ -265,21 +265,33 @@ load_u2wtable (table, name)
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;
+ errx(EX_DATAERR, "u2w: missing item number %d", i);
+ pargs->u2w[i] = code;
+ }
+ for (i = 0; i < 128; i++) {
+ if (fscanf(f, "%i", &code) != 1)
+ errx(EX_DATAERR, "d2u: missing item number %d", i);
+ pargs->d2u[i] = code;
+ }
+ for (i = 0; i < 128; i++) {
+ if (fscanf(f, "%i", &code) != 1)
+ errx(EX_DATAERR, "u2d: missing item number %d", i);
+ pargs->u2d[i] = code;
}
fclose(f);
}
void
-load_ultable (table, name)
- u_int8_t *table;
+load_ultable (pargs, name)
+ struct msdosfs_args *pargs;
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);
+ for (i = 0; i < 128; i++) {
+ pargs->ul[i] = tolower(i | 0x80);
+ pargs->lu[i] = toupper(i | 0x80);
+ }
}
OpenPOWER on IntegriCloud