summaryrefslogtreecommitdiffstats
path: root/sbin/i386
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2000-01-08 16:47:55 +0000
committerache <ache@FreeBSD.org>2000-01-08 16:47:55 +0000
commit27629843b562745fcc1fe1d5d008fb30d613bb86 (patch)
treea4a50401a2e107930996f2772bcbc9401d2b2cd0 /sbin/i386
parent7aebc62b3368354bdd40f645c411e8dca4e8264e (diff)
downloadFreeBSD-src-27629843b562745fcc1fe1d5d008fb30d613bb86.zip
FreeBSD-src-27629843b562745fcc1fe1d5d008fb30d613bb86.tar.gz
Allow #-comments in conversion table file
Diffstat (limited to 'sbin/i386')
-rw-r--r--sbin/i386/mount_msdos/Makefile2
-rw-r--r--sbin/i386/mount_msdos/koi2dos12
-rw-r--r--sbin/i386/mount_msdos/mount_msdos.88
-rw-r--r--sbin/i386/mount_msdos/mount_msdos.c60
4 files changed, 63 insertions, 19 deletions
diff --git a/sbin/i386/mount_msdos/Makefile b/sbin/i386/mount_msdos/Makefile
index 700aaef..fdf9a9b 100644
--- a/sbin/i386/mount_msdos/Makefile
+++ b/sbin/i386/mount_msdos/Makefile
@@ -5,6 +5,8 @@
PROG= mount_msdos
SRCS= mount_msdos.c getmntopts.c
MAN8= mount_msdos.8
+DPADD= ${LIBUTIL}
+LDADD= -lutil
MOUNT= ${.CURDIR}/../../mount
CFLAGS+= -I${MOUNT}
diff --git a/sbin/i386/mount_msdos/koi2dos b/sbin/i386/mount_msdos/koi2dos
index 0db136b..4adb425 100644
--- a/sbin/i386/mount_msdos/koi2dos
+++ b/sbin/i386/mount_msdos/koi2dos
@@ -1,3 +1,7 @@
+# $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
@@ -14,7 +18,9 @@
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
@@ -31,7 +37,9 @@
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
diff --git a/sbin/i386/mount_msdos/mount_msdos.8 b/sbin/i386/mount_msdos/mount_msdos.8
index e3922c2..8e36e22 100644
--- a/sbin/i386/mount_msdos/mount_msdos.8
+++ b/sbin/i386/mount_msdos/mount_msdos.8
@@ -149,15 +149,17 @@ 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.
+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. Code 0x3F ('?') used for impossible translations.
+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. Some codes have special meaning:
+128 character codes separated by 8 per row.
+Some codes have special meaning:
.Bl -hang
.It 0x00
character disallowed in DOS file name;
diff --git a/sbin/i386/mount_msdos/mount_msdos.c b/sbin/i386/mount_msdos/mount_msdos.c
index ebb646a..d2bcb26 100644
--- a/sbin/i386/mount_msdos/mount_msdos.c
+++ b/sbin/i386/mount_msdos/mount_msdos.c
@@ -47,6 +47,8 @@ static const char rcsid[] =
#include <locale.h>
#include <pwd.h>
#include <stdio.h>
+/* must be after stdio to declare fparseln */
+#include <libutil.h>
#include <stdlib.h>
#include <string.h>
#include <sysexits.h>
@@ -260,9 +262,10 @@ load_u2wtable (pargs, name)
char *name;
{
FILE *f;
- int i, code;
+ int i, j, code[8];
+ size_t line = 0;
char buf[128];
- char *fn;
+ char *fn, *s, *p;
if (*name == '/')
fn = name;
@@ -273,21 +276,50 @@ load_u2wtable (pargs, name)
}
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, "u2w: missing item number %d", i);
- pargs->u2w[i] = code;
+ 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 < 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 < 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 < 128; i++) {
- if (fscanf(f, "%i", &code) != 1)
- errx(EX_DATAERR, "u2d: missing item number %d", i);
- pargs->u2d[i] = code;
+ 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);
}
OpenPOWER on IntegriCloud