Implement loadable upper->lower local conversion table

Recently introduced -w renamed to -W
This commit is contained in:
Andrey A. Chernov 1998-02-23 09:41:02 +00:00
parent b998efa98d
commit 2183143825
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=33761
6 changed files with 90 additions and 21 deletions

View File

@ -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.7 1998/02/18 09:30:28 jkh Exp $
.\" $Id: mount_msdos.8,v 1.8 1998/02/22 15:28:00 ache Exp $
.\"
.Dd April 7, 1994
.Dt MOUNT_MSDOS 8
@ -46,7 +46,8 @@
.Op Fl l
.Op Fl 9
.\".Op Fl G
.Op Fl w Ar table
.Op Fl L Ar locale
.Op Fl W Ar table
.Pa special
.Pa node
.Sh DESCRIPTION
@ -128,7 +129,10 @@ 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
.It Fl L Ar locale
Specify locale name used for internal uppercase to lowercase conversion
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

View File

@ -32,7 +32,7 @@
#ifndef lint
static const char rcsid[] =
"$Id: mount_msdos.c,v 1.11 1998/02/18 09:30:31 jkh Exp $";
"$Id: mount_msdos.c,v 1.12 1998/02/22 15:28:06 ache Exp $";
#endif /* not lint */
#include <sys/param.h>
@ -44,6 +44,7 @@ static const char rcsid[] =
#include <ctype.h>
#include <err.h>
#include <grp.h>
#include <locale.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
@ -66,6 +67,7 @@ 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 *));
int
main(argc, argv)
@ -82,7 +84,7 @@ main(argc, argv)
(void)memset(&args, '\0', sizeof(args));
args.magic = MSDOSFS_ARGSMAGIC;
while ((c = getopt(argc, argv, "sl9u:g:m:o:w:")) != -1) {
while ((c = getopt(argc, argv, "sl9u:g:m:o:L:W:")) != -1) {
switch (c) {
#ifdef MSDOSFSMNT_GEMDOSFS
case 'G':
@ -110,7 +112,11 @@ main(argc, argv)
args.mask = a_mask(optarg);
set_mask = 1;
break;
case 'w':
case 'L':
load_ultable(args.ul, optarg);
args.flags |= MSDOSFSMNT_ULTABLE;
break;
case 'W':
load_u2wtable(args.u2w, optarg);
args.flags |= MSDOSFSMNT_U2WTABLE;
break;
@ -234,7 +240,7 @@ a_mask(s)
void
usage()
{
fprintf(stderr, "usage: mount_msdos [-o options] [-u user] [-g group] [-m mask] [-s] [-l] [-9] [-w table] bdev dir\n");
fprintf(stderr, "usage: mount_msdos [-o options] [-u user] [-g group] [-m mask] [-s] [-l] [-9] [-L locale] [-W table] bdev dir\n");
exit(EX_USAGE);
}
@ -264,3 +270,16 @@ load_u2wtable (table, name)
}
fclose(f);
}
void
load_ultable (table, name)
u_int8_t *table;
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);
}

View File

@ -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.7 1998/02/18 09:30:28 jkh Exp $
.\" $Id: mount_msdos.8,v 1.8 1998/02/22 15:28:00 ache Exp $
.\"
.Dd April 7, 1994
.Dt MOUNT_MSDOS 8
@ -46,7 +46,8 @@
.Op Fl l
.Op Fl 9
.\".Op Fl G
.Op Fl w Ar table
.Op Fl L Ar locale
.Op Fl W Ar table
.Pa special
.Pa node
.Sh DESCRIPTION
@ -128,7 +129,10 @@ 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
.It Fl L Ar locale
Specify locale name used for internal uppercase to lowercase conversion
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

View File

@ -32,7 +32,7 @@
#ifndef lint
static const char rcsid[] =
"$Id: mount_msdos.c,v 1.11 1998/02/18 09:30:31 jkh Exp $";
"$Id: mount_msdos.c,v 1.12 1998/02/22 15:28:06 ache Exp $";
#endif /* not lint */
#include <sys/param.h>
@ -44,6 +44,7 @@ static const char rcsid[] =
#include <ctype.h>
#include <err.h>
#include <grp.h>
#include <locale.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
@ -66,6 +67,7 @@ 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 *));
int
main(argc, argv)
@ -82,7 +84,7 @@ main(argc, argv)
(void)memset(&args, '\0', sizeof(args));
args.magic = MSDOSFS_ARGSMAGIC;
while ((c = getopt(argc, argv, "sl9u:g:m:o:w:")) != -1) {
while ((c = getopt(argc, argv, "sl9u:g:m:o:L:W:")) != -1) {
switch (c) {
#ifdef MSDOSFSMNT_GEMDOSFS
case 'G':
@ -110,7 +112,11 @@ main(argc, argv)
args.mask = a_mask(optarg);
set_mask = 1;
break;
case 'w':
case 'L':
load_ultable(args.ul, optarg);
args.flags |= MSDOSFSMNT_ULTABLE;
break;
case 'W':
load_u2wtable(args.u2w, optarg);
args.flags |= MSDOSFSMNT_U2WTABLE;
break;
@ -234,7 +240,7 @@ a_mask(s)
void
usage()
{
fprintf(stderr, "usage: mount_msdos [-o options] [-u user] [-g group] [-m mask] [-s] [-l] [-9] [-w table] bdev dir\n");
fprintf(stderr, "usage: mount_msdos [-o options] [-u user] [-g group] [-m mask] [-s] [-l] [-9] [-L locale] [-W table] bdev dir\n");
exit(EX_USAGE);
}
@ -264,3 +270,16 @@ load_u2wtable (table, name)
}
fclose(f);
}
void
load_ultable (table, name)
u_int8_t *table;
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);
}

View File

@ -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.7 1998/02/18 09:30:28 jkh Exp $
.\" $Id: mount_msdos.8,v 1.8 1998/02/22 15:28:00 ache Exp $
.\"
.Dd April 7, 1994
.Dt MOUNT_MSDOS 8
@ -46,7 +46,8 @@
.Op Fl l
.Op Fl 9
.\".Op Fl G
.Op Fl w Ar table
.Op Fl L Ar locale
.Op Fl W Ar table
.Pa special
.Pa node
.Sh DESCRIPTION
@ -128,7 +129,10 @@ 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
.It Fl L Ar locale
Specify locale name used for internal uppercase to lowercase conversion
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

View File

@ -32,7 +32,7 @@
#ifndef lint
static const char rcsid[] =
"$Id: mount_msdos.c,v 1.11 1998/02/18 09:30:31 jkh Exp $";
"$Id: mount_msdos.c,v 1.12 1998/02/22 15:28:06 ache Exp $";
#endif /* not lint */
#include <sys/param.h>
@ -44,6 +44,7 @@ static const char rcsid[] =
#include <ctype.h>
#include <err.h>
#include <grp.h>
#include <locale.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
@ -66,6 +67,7 @@ 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 *));
int
main(argc, argv)
@ -82,7 +84,7 @@ main(argc, argv)
(void)memset(&args, '\0', sizeof(args));
args.magic = MSDOSFS_ARGSMAGIC;
while ((c = getopt(argc, argv, "sl9u:g:m:o:w:")) != -1) {
while ((c = getopt(argc, argv, "sl9u:g:m:o:L:W:")) != -1) {
switch (c) {
#ifdef MSDOSFSMNT_GEMDOSFS
case 'G':
@ -110,7 +112,11 @@ main(argc, argv)
args.mask = a_mask(optarg);
set_mask = 1;
break;
case 'w':
case 'L':
load_ultable(args.ul, optarg);
args.flags |= MSDOSFSMNT_ULTABLE;
break;
case 'W':
load_u2wtable(args.u2w, optarg);
args.flags |= MSDOSFSMNT_U2WTABLE;
break;
@ -234,7 +240,7 @@ a_mask(s)
void
usage()
{
fprintf(stderr, "usage: mount_msdos [-o options] [-u user] [-g group] [-m mask] [-s] [-l] [-9] [-w table] bdev dir\n");
fprintf(stderr, "usage: mount_msdos [-o options] [-u user] [-g group] [-m mask] [-s] [-l] [-9] [-L locale] [-W table] bdev dir\n");
exit(EX_USAGE);
}
@ -264,3 +270,16 @@ load_u2wtable (table, name)
}
fclose(f);
}
void
load_ultable (table, name)
u_int8_t *table;
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);
}