summaryrefslogtreecommitdiffstats
path: root/sbin/mount_msdosfs
diff options
context:
space:
mode:
authorfjoe <fjoe@FreeBSD.org>2003-09-26 20:26:25 +0000
committerfjoe <fjoe@FreeBSD.org>2003-09-26 20:26:25 +0000
commit571ef024e3f3a472116a55a8489d77eb4f5f933e (patch)
tree5e4dbdee80eebe5477ad9c5637bb6b0ee47993d5 /sbin/mount_msdosfs
parent0c8bfb6d004a87cd501c13516a69b3ef59ed6c7c (diff)
downloadFreeBSD-src-571ef024e3f3a472116a55a8489d77eb4f5f933e.zip
FreeBSD-src-571ef024e3f3a472116a55a8489d77eb4f5f933e.tar.gz
- Support for multibyte charsets in LIBICONV.
- CD9660_ICONV, NTFS_ICONV and MSDOSFS_ICONV kernel options (with corresponding modules). - kiconv(3) for loadable charset conversion tables support. Submitted by: Ryuichiro Imura <imura@ryu16.org>
Diffstat (limited to 'sbin/mount_msdosfs')
-rw-r--r--sbin/mount_msdosfs/Makefile16
-rw-r--r--sbin/mount_msdosfs/iso22dos58
-rw-r--r--sbin/mount_msdosfs/iso72dos60
-rw-r--r--sbin/mount_msdosfs/koi2dos58
-rw-r--r--sbin/mount_msdosfs/koi8u2dos60
-rw-r--r--sbin/mount_msdosfs/mount_msdosfs.859
-rw-r--r--sbin/mount_msdosfs/mount_msdosfs.c196
7 files changed, 141 insertions, 366 deletions
diff --git a/sbin/mount_msdosfs/Makefile b/sbin/mount_msdosfs/Makefile
index d49e76c..109da85 100644
--- a/sbin/mount_msdosfs/Makefile
+++ b/sbin/mount_msdosfs/Makefile
@@ -5,21 +5,17 @@
PROG= mount_msdosfs
SRCS= mount_msdosfs.c getmntopts.c
MAN= mount_msdosfs.8
-DPADD= ${LIBUTIL}
-LDADD= -lutil
+DPADD= ${LIBKICONV}
+LDADD= -lkiconv
MOUNT= ${.CURDIR}/../mount
CFLAGS+= -I${MOUNT}
WARNS= 0
-.PATH: ${MOUNT}
-
-TABDIR= ${DESTDIR}${LIBDATADIR}/msdosfs
-TABLES= iso22dos iso72dos koi2dos koi8u2dos
+# Needs to be dynamically linked for optional dlopen() access to
+# userland libiconv
+NOSHARED?= NO
-afterinstall:
- cd ${.CURDIR} && \
- ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${SHAREMODE} \
- ${TABLES} ${TABDIR}
+.PATH: ${MOUNT}
.include <bsd.prog.mk>
diff --git a/sbin/mount_msdosfs/iso22dos b/sbin/mount_msdosfs/iso22dos
deleted file mode 100644
index 1f48193..0000000
--- a/sbin/mount_msdosfs/iso22dos
+++ /dev/null
@@ -1,58 +0,0 @@
-# $FreeBSD$
-#
-# u2w: 16 rows of Latin2 -> Unicode conversion table (upper half)
-#
-0x0080 0x0081 0x0082 0x0083 0x0084 0x0085 0x0086 0x0087
-0x0088 0x0089 0x008a 0x008b 0x008c 0x008d 0x008e 0x008f
-0x0090 0x0091 0x0092 0x0093 0x0094 0x0095 0x0096 0x0097
-0x0098 0x0099 0x009a 0x009b 0x009c 0x009d 0x009e 0x009f
-0x00a0 0x0104 0x02d8 0x0141 0x00a4 0x013d 0x015a 0x00a7
-0x00a8 0x0160 0x015e 0x0164 0x0179 0x00ad 0x017d 0x017b
-0x00b0 0x0105 0x02db 0x0142 0x00b4 0x013e 0x015b 0x02c7
-0x00b8 0x0161 0x015f 0x0165 0x017a 0x02dd 0x017e 0x017c
-0x0154 0x00c1 0x00c2 0x0102 0x00c4 0x0139 0x0106 0x00c7
-0x010c 0x00c9 0x0118 0x00cb 0x011a 0x00cd 0x00ce 0x010e
-0x0110 0x0143 0x0147 0x00d3 0x00d4 0x0150 0x00d6 0x00d7
-0x0158 0x016e 0x00da 0x0170 0x00dc 0x00dd 0x0162 0x00df
-0x0155 0x00e1 0x00e2 0x0103 0x00e4 0x013a 0x0107 0x00e7
-0x010d 0x00e9 0x0119 0x00eb 0x011b 0x00ed 0x00ee 0x010f
-0x0111 0x0144 0x0148 0x00f3 0x00f4 0x0151 0x00f6 0x00f7
-0x0159 0x016f 0x00fa 0x0171 0x00fc 0x00fd 0x0163 0x02d9
-#
-# d2u: 16 rows of CP852 -> Latin2 conversion table (upper half)
-#
-0xc7 0xfc 0xe9 0xe2 0xe4 0xf9 0xe6 0xe7
-0xb3 0xeb 0xd5 0xf5 0xee 0xac 0xc4 0xc6
-0xc9 0xc5 0xe5 0xf4 0xf6 0xa5 0xb5 0xa6
-0xb6 0xd6 0xdc 0xab 0xbb 0xa3 0xd7 0xe8
-0xe1 0xed 0xf3 0xfa 0xa1 0xb1 0xae 0xbe
-0xca 0xea 0x3f 0xbc 0xc8 0xba 0x3f 0x3f
-0x3f 0x3f 0x3f 0x3f 0x3f 0xc1 0xc2 0xcc
-0xaa 0x3f 0x3f 0x3f 0x3f 0xaf 0xbf 0x3f
-0x3f 0x3f 0x3f 0x3f 0x3f 0x3f 0xc3 0xe3
-0x3f 0x3f 0x3f 0x3f 0x3f 0x3f 0x3f 0xa4
-0xf0 0xd0 0xcf 0xcb 0xef 0xd2 0xcd 0xce
-0xec 0x3f 0x3f 0x3f 0x3f 0xde 0xd9 0x3f
-0xd3 0xdf 0xd4 0xd1 0xf1 0xf2 0xa9 0xb9
-0xc0 0xda 0xe0 0xdb 0xfd 0xdd 0xfe 0xb4
-0xad 0xbd 0xb2 0xb7 0xa2 0xa7 0xf7 0xb8
-0xb0 0xa8 0xff 0xfb 0xd8 0xf8 0x3f 0xa0
-#
-# u2d: 16 rows of Latin2 -> CP852 conversion table (upper half)
-#
-0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0
-0xff 0xa4 0xf4 0x9d 0xcf 0x95 0x97 0xf5
-0xf9 0xe6 0xb8 0x9b 0x8d 0xf0 0xa6 0xbd
-0xf8 0xa5 0xf2 0x88 0xef 0x96 0x98 0xf3
-0xf7 0xe7 0xad 0x9c 0xab 0xf1 0xa7 0xbe
-0xe8 0xb5 0xb6 0xc6 0x8e 0x91 0x8f 0x80
-0xac 0x90 0xa8 0xd3 0xb7 0xd6 0xd7 0xd2
-0xd1 0xe3 0xd5 0xe0 0xe2 0x8a 0x99 0x9e
-0xfc 0xde 0xe9 0xeb 0x9a 0xed 0xdd 0xe1
-0xea 0xa0 0x83 0xc7 0x84 0x92 0x86 0x87
-0x9f 0x82 0xa9 0x89 0xd8 0xa1 0x8c 0xd4
-0xd0 0xe4 0xe5 0xa2 0x93 0x8b 0x94 0xf6
-0xfd 0x85 0xa3 0xfb 0x81 0xec 0xee 0xfa
diff --git a/sbin/mount_msdosfs/iso72dos b/sbin/mount_msdosfs/iso72dos
deleted file mode 100644
index 9abb820..0000000
--- a/sbin/mount_msdosfs/iso72dos
+++ /dev/null
@@ -1,60 +0,0 @@
-# $FreeBSD$
-#
-# usr/libdata/msdosfs/iso72dos
-#
-# u2w: 16 rows of Latin7 -> Unicode conversion table (upper half)
-#
-0x0080 0x0081 0x0082 0x0083 0x0084 0x0085 0x0086 0x0087
-0x0088 0x0089 0x008a 0x008b 0x008c 0x008d 0x008e 0x008f
-0x0090 0x0091 0x0092 0x0093 0x0094 0x0095 0x0096 0x0097
-0x0098 0x0099 0x009a 0x009b 0x009c 0x009d 0x009e 0x009f
-0x00a0 0x201b 0x2019 0x00a3 0x003f 0x003f 0x00a6 0x00a7
-0x00a8 0x00a9 0x003f 0x00ab 0x00ac 0x00ad 0x003f 0x2015
-0x00b0 0x00b1 0x00b2 0x00b3 0x00b4 0x0385 0x0386 0x00b7
-0x0388 0x0389 0x038a 0x00bb 0x038c 0x00bd 0x038e 0x038f
-0x0390 0x0391 0x0392 0x0393 0x0394 0x0395 0x0396 0x0397
-0x0398 0x0399 0x039a 0x039b 0x039c 0x039d 0x039e 0x039f
-0x03a0 0x03a1 0x003f 0x03a3 0x03a4 0x03a5 0x03a6 0x03a7
-0x03a8 0x03a9 0x03aa 0x03ab 0x03ac 0x03ad 0x03ae 0x03af
-0x03b0 0x03b1 0x03b2 0x03b3 0x03b4 0x03b5 0x03b6 0x03b7
-0x03b8 0x03b9 0x03ba 0x03bb 0x03bc 0x03bd 0x03be 0x03bf
-0x03c0 0x03c1 0x03c2 0x03c3 0x03c4 0x03c5 0x03c6 0x03c7
-0x03c8 0x03c9 0x03ca 0x03cb 0x03cc 0x03cd 0x03ce 0x003f
-#
-# d2u: 16 rows of CP737 -> Latin7 conversion table (upper half)
-#
-0xc1 0xc2 0xc3 0xc4 0xc5 0xc6 0xc7 0xc8
-0xc9 0xca 0xcb 0xcc 0xcd 0xce 0xcf 0xd0
-0xd1 0xd3 0xd4 0xd5 0xd6 0xd7 0xd8 0xd9
-0xe1 0xe2 0xe3 0xe4 0xe5 0xe6 0xe7 0xe8
-0xe9 0xea 0xeb 0xec 0xed 0xee 0xef 0xf0
-0xf1 0xf3 0xf2 0xf4 0xf5 0xf6 0xf7 0xf8
-0x3f 0x3f 0x3f 0x3f 0x3f 0x3f 0x3f 0x3f
-0x3f 0x3f 0x3f 0x3f 0x3f 0x3f 0x3f 0x3f
-0x3f 0x3f 0x3f 0x3f 0x3f 0x3f 0x3f 0x3f
-0x3f 0x3f 0x3f 0x3f 0x3f 0x3f 0x3f 0x3f
-0x3f 0x3f 0x3f 0x3f 0x3f 0x3f 0x3f 0x3f
-0x3f 0x3f 0x3f 0x3f 0x3f 0x3f 0x3f 0x3f
-0xf9 0xdc 0xdd 0xde 0xfa 0xdf 0xfc 0xfd
-0xfb 0xfe 0xb6 0xb8 0xb9 0xba 0xbc 0xbe
-0xbf 0xb1 0x3f 0x3f 0xda 0xdb 0x3f 0x3f
-0xb0 0x3f 0xb7 0x3f 0x3f 0xb2 0x3f 0xa0
-#
-# u2d: 16 rows of Latin7 -> CP737 conversion table (upper half)
-#
-0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
-0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
-0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
-0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
-0xff 0x00 0x00 0x00 0x00 0x00 0x00 0x00
-0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
-0xf8 0xf1 0xfd 0x00 0x00 0x00 0xea 0xfa
-0xeb 0xec 0xed 0x00 0xee 0x00 0xef 0xf0
-0x00 0x80 0x81 0x82 0x83 0x84 0x85 0x86
-0x87 0x88 0x89 0x8a 0x8b 0x8c 0x8d 0x8e
-0x8f 0x90 0x00 0x91 0x92 0x93 0x94 0x95
-0x96 0x97 0xf4 0xf5 0xe1 0xe2 0xe3 0xe5
-0x00 0x98 0x99 0x9a 0x9b 0x9c 0x9d 0x9e
-0x9f 0xa0 0xa1 0xa2 0xa3 0xa4 0xa5 0xa6
-0xa7 0xa8 0xaa 0xa9 0xab 0xac 0xad 0xae
-0xaf 0xe0 0xe4 0xe8 0xe6 0xe7 0xe9 0x00
diff --git a/sbin/mount_msdosfs/koi2dos b/sbin/mount_msdosfs/koi2dos
deleted file mode 100644
index 4adb425..0000000
--- a/sbin/mount_msdosfs/koi2dos
+++ /dev/null
@@ -1,58 +0,0 @@
-# $FreeBSD$
-#
-# u2w: 16 rows of KOI8-R -> Unicode conversion table (upper half)
-#
-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
-#
-# d2u: 16 rows of CP866 -> KOI8-R conversion table (upper half)
-#
-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
-#
-# u2d: 16 rows of KOI8-R -> CP866 conversion table (upper half)
-#
-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/koi8u2dos b/sbin/mount_msdosfs/koi8u2dos
deleted file mode 100644
index b3c0340..0000000
--- a/sbin/mount_msdosfs/koi8u2dos
+++ /dev/null
@@ -1,60 +0,0 @@
-# $FreeBSD$
-#
-# Translation table for ukrainian filenames support by <kunia@istc.kiev.ua>
-#
-# u2w: 16 rows of KOI8-U -> Unicode conversion table (upper half)
-#
-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 0x0454 0x2554 0x0456 0x0457
-0x2557 0x2558 0x2559 0x255a 0x255b 0x0491 0x255d 0x255e
-0x255f 0x2560 0x2561 0x0401 0x0404 0x2563 0x0406 0x0407
-0x2566 0x2567 0x2568 0x2569 0x256a 0x0490 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
-#
-# d2u: 16 rows of CP866 -> KOI8-U conversion table (upper half)
-#
-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 0xb4 0xa4 0xb7 0xa7 245 213
-0x9c 0x95 0x9e 0x96 78 210 0x94 0x9a
-#
-# u2d: 16 rows of KOI8-U -> CP866 conversion table (upper half)
-#
-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 0xf3 0xc9 0x01 0xf5
-0xbb 0xd4 0xd3 0xc8 0xbe 0x01 0xbc 0xc6
-0xc7 0xcc 0xb5 0xf0 0xf2 0xb9 0x01 0xf4
-0xcb 0xcf 0xd0 0xca 0xd8 0x01 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 8eee35c..1503b09 100644
--- a/sbin/mount_msdosfs/mount_msdosfs.8
+++ b/sbin/mount_msdosfs/mount_msdosfs.8
@@ -48,6 +48,7 @@
.Op Fl 9
.\".Op Fl G
.Op Fl L Ar locale
+.Op Fl D Ar dos-codepage
.Op Fl W Ar table
.Pa special
.Pa node
@@ -160,50 +161,38 @@ This forces
.\"limited to the boot block. This option enforces
.\".Fl s .
.It Fl L Ar locale
-Specify locale name used for internal uppercase and lowercase conversions
+Specify locale name used for file name conversions
for DOS and Win'95 names.
By default ISO 8859-1 assumed as local character set.
+.It Fl D Ar dos-codepage
+Specify the MS-DOS code page (aka IBM/OEM code page) name used for
+file name conversions for DOS names.
.It Fl W Ar table
-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 separated by 8 per row.
-If some code not present in Unicode, use
-0x003F code ('?') as replacement.
-.It
-DOS to local character set conversion table (upper half) for DOS names,
-128 character codes separated by 8 per row.
-Code 0x3F ('?') used for impossible translations.
-.It
-Local character set to DOS conversion table (upper half) for DOS names,
-128 character codes separated by 8 per row.
-Some codes have special meaning:
-.Bl -hang
-.It 0x00
-character disallowed in DOS file name;
-.It 0x01
-character should be replaced by '_' in DOS file name;
-.It 0x02
-character should be skipped in DOS file name;
-.El
-.El
+This option is remained for backward compatibility purpose, and will be
+removed in the future. Please do not use this option.
.Pp
-By default ISO 8859-1 assumed as local character set.
-If file path isn't absolute,
-.Pa /usr/libdata/msdosfs/
-prefix prepended.
+Specify text file name with conversion table: iso22dos, iso72dos, koi2dos,
+koi8u2dos.
.El
-.Sh FILES
-.Bl -tag -width /usr/libdata/msdosfs -compact
-.It Pa /usr/libdata/msdosfs
-default place for character sets conversion tables
+.Sh EXAMPLES
+To mount a Russian msdos file system located in /dev/ad1s1:
+.Bd -literal -offset indent
+# mount_msdosfs -L ru_RU.KOI8-R -D CP866 /dev/ad1s1 /mnt
+.Ed
+.Pp
+To mount a Japanese msdos file system located in /dev/ad1s1:
+.Bd -literal -offset indent
+# mount_msdosfs -L ja_JP.eucJP -D CP932 /dev/ad1s1 /mnt
+.Ed
.El
.Sh SEE ALSO
.Xr mount 2 ,
.Xr unmount 2 ,
.Xr fstab 5 ,
.Xr mount 8
+.Pp
+List of Localized MS Operating Systems:
+.Pa http://www.microsoft.com/globaldev/reference/oslocversion.mspx .
.Sh CAVEATS
The use of the
.Fl 9
@@ -230,3 +219,7 @@ utility appeared in
and was abandoned in favor
of the more aptly-named
.Nm .
+.Pp
+The character code conversion routine was added by
+.An Ryuichiro Imura Aq imura@ryu16.org
+at 2003.
diff --git a/sbin/mount_msdosfs/mount_msdosfs.c b/sbin/mount_msdosfs/mount_msdosfs.c
index 061e3cb..a50dd15 100644
--- a/sbin/mount_msdosfs/mount_msdosfs.c
+++ b/sbin/mount_msdosfs/mount_msdosfs.c
@@ -38,6 +38,8 @@ static const char rcsid[] =
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/stat.h>
+#include <sys/module.h>
+#include <sys/iconv.h>
#include <fs/msdosfs/msdosfsmount.h>
@@ -56,9 +58,11 @@ static const char rcsid[] =
#include "mntopts.h"
+#define TRANSITION_PERIOD_HACK
+
/*
* XXX - no way to specify "foo=<bar>"-type options; that's what we'd
- * want for "-u", "-g", "-m", "-L", and "-W".
+ * want for "-u", "-g", "-m", "-L", "-D", and "-W".
*/
static struct mntopt mopts[] = {
MOPT_STDOPTS,
@@ -78,8 +82,7 @@ static gid_t a_gid(char *);
static uid_t a_uid(char *);
static mode_t a_mask(char *);
static void usage(void) __dead2;
-static void load_u2wtable(struct msdosfs_args *, char *);
-static void load_ultable(struct msdosfs_args *, char *);
+static int set_charset(struct msdosfs_args *);
int
main(argc, argv)
@@ -89,13 +92,20 @@ main(argc, argv)
struct msdosfs_args args;
struct stat sb;
int c, mntflags, set_gid, set_uid, set_mask, set_dirmask;
- char *dev, *dir, mntpath[MAXPATHLEN];
+ char *dev, *dir, mntpath[MAXPATHLEN], *csp;
mntflags = set_gid = set_uid = set_mask = set_dirmask = 0;
(void)memset(&args, '\0', sizeof(args));
args.magic = MSDOSFS_ARGSMAGIC;
- while ((c = getopt(argc, argv, "sl9u:g:m:M:o:L:W:")) != -1) {
+ args.cs_win = NULL;
+ args.cs_dos = NULL;
+ args.cs_local = NULL;
+#ifdef TRANSITION_PERIOD_HACK
+ while ((c = getopt(argc, argv, "sl9u:g:m:M:o:L:D:W:")) != -1) {
+#else
+ while ((c = getopt(argc, argv, "sl9u:g:m:M:o:L:D:")) != -1) {
+#endif
switch (c) {
#ifdef MSDOSFSMNT_GEMDOSFS
case 'G':
@@ -128,16 +138,52 @@ main(argc, argv)
set_dirmask = 1;
break;
case 'L':
- load_ultable(&args, optarg);
- args.flags |= MSDOSFSMNT_ULTABLE;
+ if (setlocale(LC_CTYPE, optarg) == NULL)
+ err(EX_CONFIG, "%s", optarg);
+ csp = strchr(optarg,'.');
+ if (!csp)
+ err(EX_CONFIG, "%s", optarg);
+ args.cs_local = malloc(ICONV_CSNMAXLEN);
+ if (args.cs_local == NULL)
+ err(EX_OSERR, "malloc()");
+ strncpy(args.cs_local,
+ kiconv_quirkcs(csp + 1, KICONV_VENDOR_MICSFT),
+ ICONV_CSNMAXLEN);
break;
- case 'W':
- load_u2wtable(&args, optarg);
- args.flags |= MSDOSFSMNT_U2WTABLE;
+ case 'D':
+ args.cs_dos = malloc(ICONV_CSNMAXLEN);
+ if (args.cs_dos == NULL)
+ err(EX_OSERR, "malloc()");
+ strncpy(args.cs_dos, optarg, ICONV_CSNMAXLEN);
break;
case 'o':
getmntopts(optarg, mopts, &mntflags, &args.flags);
break;
+#ifdef TRANSITION_PERIOD_HACK
+ case 'W':
+ args.cs_local = malloc(ICONV_CSNMAXLEN);
+ if (args.cs_local == NULL)
+ err(EX_OSERR, "malloc()");
+ args.cs_dos = malloc(ICONV_CSNMAXLEN);
+ if (args.cs_dos == NULL)
+ err(EX_OSERR, "malloc()");
+ if (strcmp(optarg, "iso22dos") == 0) {
+ strcpy(args.cs_local, "ISO8859-2");
+ strcpy(args.cs_dos, "CP852");
+ } else if (strcmp(optarg, "iso72dos") == 0) {
+ strcpy(args.cs_local, "ISO8859-7");
+ strcpy(args.cs_dos, "CP737");
+ } else if (strcmp(optarg, "koi2dos") == 0) {
+ strcpy(args.cs_local, "KOI8-R");
+ strcpy(args.cs_dos, "CP866");
+ } else if (strcmp(optarg, "koi8u2dos") == 0) {
+ strcpy(args.cs_local, "KOI8-U");
+ strcpy(args.cs_dos, "CP866");
+ } else {
+ err(EX_NOINPUT, "%s", optarg);
+ }
+ break;
+#endif /* TRANSITION_PERIOD_HACK */
case '?':
default:
usage();
@@ -160,6 +206,19 @@ main(argc, argv)
dev = argv[optind];
dir = argv[optind + 1];
+ if (args.cs_local) {
+ if (set_charset(&args) == -1)
+ err(EX_OSERR, "msdosfs_iconv");
+ args.flags |= MSDOSFSMNT_KICONV;
+ } else if (args.cs_dos) {
+ if ((args.cs_local = malloc(ICONV_CSNMAXLEN)) == NULL)
+ err(EX_OSERR, "malloc()");
+ strcpy(args.cs_local, "ISO8859-1");
+ if (set_charset(&args) == -1)
+ err(EX_OSERR, "msdosfs_iconv");
+ args.flags |= MSDOSFSMNT_KICONV;
+ }
+
/*
* Resolve the mountpoint with realpath(3) and remove unnecessary
* slashes from the devicename if there are any.
@@ -254,89 +313,52 @@ void
usage()
{
fprintf(stderr, "%s\n%s\n",
+#ifdef TRANSITION_PERIOD_HACK
+ "usage: mount_msdosfs [-o options] [-u user] [-g group] [-m mask] [-s] [-l]",
+ " [-9] [-L locale] [-D dos-codepage] [-W table] bdev dir");
+#else
"usage: mount_msdosfs [-o options] [-u user] [-g group] [-m mask]",
- " [-s] [-l] [-9] [-L locale] [-W table] bdev dir");
+ " [-s] [-l] [-9] [-L locale] [-D dos-codepage] bdev dir");
+#endif
exit(EX_USAGE);
}
-void
-load_u2wtable (pargs, name)
- struct msdosfs_args *pargs;
- char *name;
+int
+set_charset(struct msdosfs_args *args)
{
- FILE *f;
- int i, j, code[8];
- size_t line = 0;
- char buf[128];
- char *fn, *s, *p;
-
- 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);
- p = NULL;
- for (i = 0; i < 16; i++) {
- do {
- if (p != NULL) free(p);
- if ((p = s = fparseln(f, NULL, &line, NULL, 0)) == NULL)
- errx(EX_DATAERR, "can't read u2w table row %d near line %d", i, line);
- while (isspace((unsigned char)*s))
- s++;
- } while (*s == '\0');
- if (sscanf(s, "%i%i%i%i%i%i%i%i",
-code, code + 1, code + 2, code + 3, code + 4, code + 5, code + 6, code + 7) != 8)
- errx(EX_DATAERR, "u2w table: missing item(s) in row %d, line %d", i, line);
- for (j = 0; j < 8; j++)
- pargs->u2w[i * 8 + j] = code[j];
- }
- for (i = 0; i < 16; i++) {
- do {
- free(p);
- if ((p = s = fparseln(f, NULL, &line, NULL, 0)) == NULL)
- errx(EX_DATAERR, "can't read d2u table row %d near line %d", i, line);
- while (isspace((unsigned char)*s))
- s++;
- } while (*s == '\0');
- if (sscanf(s, "%i%i%i%i%i%i%i%i",
-code, code + 1, code + 2, code + 3, code + 4, code + 5, code + 6, code + 7) != 8)
- errx(EX_DATAERR, "d2u table: missing item(s) in row %d, line %d", i, line);
- for (j = 0; j < 8; j++)
- pargs->d2u[i * 8 + j] = code[j];
- }
- for (i = 0; i < 16; i++) {
- do {
- free(p);
- if ((p = s = fparseln(f, NULL, &line, NULL, 0)) == NULL)
- errx(EX_DATAERR, "can't read u2d table row %d near line %d", i, line);
- while (isspace((unsigned char)*s))
- s++;
- } while (*s == '\0');
- if (sscanf(s, "%i%i%i%i%i%i%i%i",
-code, code + 1, code + 2, code + 3, code + 4, code + 5, code + 6, code + 7) != 8)
- errx(EX_DATAERR, "u2d table: missing item(s) in row %d, line %d", i, line);
- for (j = 0; j < 8; j++)
- pargs->u2d[i * 8 + j] = code[j];
- }
- free(p);
- fclose(f);
-}
+ int error;
-void
-load_ultable (pargs, name)
- struct msdosfs_args *pargs;
- char *name;
-{
- int i;
+ if (modfind("msdosfs_iconv") < 0)
+ if (kldload("msdosfs_iconv") < 0 || modfind("msdosfs_iconv") < 0) {
+ warnx( "cannot find or load \"msdosfs_iconv\" kernel module");
+ return (-1);
+ }
- if (setlocale(LC_CTYPE, name) == NULL)
- err(EX_CONFIG, "%s", name);
- for (i = 0; i < 128; i++) {
- pargs->ul[i] = tolower(i | 0x80);
- pargs->lu[i] = toupper(i | 0x80);
+ if ((args->cs_win = malloc(ICONV_CSNMAXLEN)) == NULL)
+ return (-1);
+ strncpy(args->cs_win, ENCODING_UNICODE, ICONV_CSNMAXLEN);
+ error = kiconv_add_xlat16_cspair(args->cs_win, args->cs_local, 0);
+ if (error)
+ return (-1);
+ error = kiconv_add_xlat16_cspair(args->cs_local, args->cs_win, 0);
+ if (error)
+ return (-1);
+ if (args->cs_dos) {
+ error = kiconv_add_xlat16_cspair(args->cs_dos, args->cs_local, KICONV_FROM_UPPER);
+ if (error)
+ return (-1);
+ error = kiconv_add_xlat16_cspair(args->cs_local, args->cs_dos, KICONV_LOWER);
+ if (error)
+ return (-1);
+ } else {
+ if ((args->cs_dos = malloc(ICONV_CSNMAXLEN)) == NULL)
+ return (-1);
+ strcpy(args->cs_dos, args->cs_local);
+ error = kiconv_add_xlat16_cspair(args->cs_local, args->cs_local,
+ KICONV_FROM_UPPER | KICONV_LOWER);
+ if (error)
+ return (-1);
}
+
+ return (0);
}
OpenPOWER on IntegriCloud