summaryrefslogtreecommitdiffstats
path: root/sbin/mount_msdos
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1998-02-22 15:28:06 +0000
committerache <ache@FreeBSD.org>1998-02-22 15:28:06 +0000
commit95bf5e413f062cd563385e46551e7268ad66a3b1 (patch)
treeb4597abd789dace97e2d32dd4ad811c914ff4440 /sbin/mount_msdos
parent03f1005e8f24daa1542b00f3f6e31aaa89e54d51 (diff)
downloadFreeBSD-src-95bf5e413f062cd563385e46551e7268ad66a3b1.zip
FreeBSD-src-95bf5e413f062cd563385e46551e7268ad66a3b1.tar.gz
Add loadable local<->Unicode conversion support for Win95 names
Note: DOS names still not work and require similar changes
Diffstat (limited to 'sbin/mount_msdos')
-rw-r--r--sbin/mount_msdos/Makefile10
-rw-r--r--sbin/mount_msdos/mount_msdos.816
-rw-r--r--sbin/mount_msdos/mount_msdos.c38
3 files changed, 59 insertions, 5 deletions
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 <bsd.prog.mk>
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 <sys/param.h>
@@ -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);
+}
OpenPOWER on IntegriCloud