Mail Archives: djgpp-workers/1996/12/06/17:40:23
a part of 3/3
---------- multibyte support ----------
*** src/libc/posix/sys/stat/fixpath.c-orig Sat Oct 5 20:40:28 1996
--- src/libc/posix/sys/stat/fixpath.c Fri Dec 6 01:14:30 1996
***************
*** 81,86 ****
--- 81,87 ----
char *op = out;
int preserve_case = _preserve_fncase();
char *name_start;
+ int mbsize;
use_lfn = _USE_LFN;
***************
*** 149,155 ****
--- 150,171 ----
/* Copy path component from in to out */
*op++ = '/';
+ #if 0
while (!is_term(*ip)) *op++ = *ip++;
+ #else
+ while (!is_term(*ip))
+ {
+ mbsize = mblen (ip, MB_CUR_MAX);
+ if (mbsize > 1)
+ {
+ /* copy multibyte character */
+ while (--mbsize >= 0)
+ *op++ = *ip++;
+ }
+ else
+ *op++ = *ip++;
+ }
+ #endif
}
/* If root directory, insert trailing slash */
***************
*** 163,168 ****
--- 179,193 ----
{
char long_name[FILENAME_MAX], short_name[13];
+ #if 1
+ /* skip multibyte character */
+ mbsize = mblen (op, MB_CUR_MAX);
+ if (mbsize > 1)
+ {
+ op += mbsize - 1;
+ continue;
+ }
+ #endif
if (*op == '\\')
*op = '/';
if (!preserve_case && (*op == '/' || *op == '\0'))
***************
*** 171,179 ****
--- 196,219 ----
long_name[op - name_start - 1] = '\0';
if (!strcmp(_lfn_gen_short_fname(long_name, short_name),
long_name))
{
+ #if 0
while (++name_start < op)
if (*name_start >= 'A' && *name_start <= 'Z')
*name_start += 'a' - 'A';
+ #else
+ while (++name_start < op)
+ {
+ mbsize = mblen (name_start, MB_CUR_MAX);
+ if (mbsize > 1)
+ {
+ /* skip multibyte character */
+ name_start += mbsize - 1;
+ continue;
+ }
+ else if (*name_start >= 'A' && *name_start <= 'Z')
+ *name_start += 'a' - 'A';
+ }
+ #endif
}
else
name_start = op;
*** src/libc/posix/dirent/readdir.c-orig Wed Sep 11 22:28:54 1996
--- src/libc/posix/dirent/readdir.c Thu Dec 5 19:15:10 1996
***************
*** 1,5 ****
--- 1,6 ----
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <libc/stubs.h>
+ #include <stdlib.h>
#include <string.h>
#include <dirent.h>
#include <fcntl.h>
***************
*** 12,17 ****
--- 13,19 ----
{
int done;
int oerrno = errno;
+ int mbsize;
if (dir->need_fake_dot_dotdot)
{
***************
*** 49,58 ****
--- 51,74 ----
if (!strcmp(_lfn_gen_short_fname(dir->ff.ff_name, fsh),
dir->ff.ff_name))
for (cp=dir->ff.ff_name; *cp; cp++)
+ #if 1
+ {
+ mbsize = mblen (cp, MB_CUR_MAX);
+ if (mbsize > 1)
+ {
+ cp += mbsize - 1;
+ continue;
+ }
+ else if (*cp >= 'A' && *cp <= 'Z')
+ *cp += 'a' - 'A';
+ }
+ #else
if (*cp >= 'A' && *cp <= 'Z')
*cp += 'a' - 'A';
+ #endif
}
strcpy(dir->de.d_name, dir->ff.ff_name);
dir->de.d_namlen = strlen(dir->de.d_name);
return &dir->de;
}
+
--------------------------------------------
Daisuke Aoyama
jack AT st DOT rim DOT or DOT jp
- Raw text -