* sysdeps/posix/ttyname.c: Make name variable from getttyname function
	global (with file scope).  Add __libc_subfreeres function to free the
	string.
	* sysdeps/unix/sysv/linux/ttyname.c: Likewise.  Also for buf variable
	in ttyname function.

	* sysdeps/generic/strtok.c: Remove initializer for olds variable.

	* crypt/md5-crypt.c: Let destructor deallocate static buffer.

	* iconvdata/sjis.c (from_ucs4_lat1): Handle U005C and U007E by
	mapping them to /x5c and /x7e respectively.
This commit is contained in:
Ulrich Drepper 2000-08-15 06:12:25 +00:00
parent a6bd56c753
commit b8fd550293
7 changed files with 186 additions and 134 deletions

View File

@ -1,5 +1,18 @@
2000-08-14 Ulrich Drepper <drepper@redhat.com>
* sysdeps/posix/ttyname.c: Make name variable from getttyname function
global (with file scope). Add __libc_subfreeres function to free the
string.
* sysdeps/unix/sysv/linux/ttyname.c: Likewise. Also for buf variable
in ttyname function.
* sysdeps/generic/strtok.c: Remove initializer for olds variable.
* crypt/md5-crypt.c: Let destructor deallocate static buffer.
* iconvdata/sjis.c (from_ucs4_lat1): Handle U005C and U007E by
mapping them to /x5c and /x7e respectively.
* locale/programs/ld-ctype.c: Add support for more definitions after
copy statement.

View File

@ -234,14 +234,15 @@ __md5_crypt_r (key, salt, buffer, buflen)
}
static char *buffer;
char *
__md5_crypt (const char *key, const char *salt)
{
/* We don't want to have an arbitrary limit in the size of the
password. We can compute the size of the result in advance and
so we can prepare the buffer we pass to `md5_crypt_r'. */
static char *buffer = NULL;
static int buflen = 0;
static int buflen;
int needed = 3 + strlen (salt) + 1 + 26 + 1;
if (buflen < needed)
@ -253,3 +254,11 @@ __md5_crypt (const char *key, const char *salt)
return __md5_crypt_r (key, salt, buffer, buflen);
}
static void
__attribute__ ((__constructor__))
free_mem (void)
{
free (buffer);
}

View File

@ -1891,6 +1891,11 @@ static const uint16_t cjk_block4[2021] =
The only problem is that the shiftjis.txt file does not contain the
mapping for the characters 0x00 to 0x1f. We add them ourself.
A much bigger problem is that mapping of the tilde and the backslash
character. There are no such characters in SJIS. The proposed
handling is to simply map the two input values to the corresponding
byte values of ASCII. Things fall more or less in place this way.
*/
static const char from_ucs4_lat1[0xf8][2] =
{
@ -1924,7 +1929,7 @@ static const char from_ucs4_lat1[0xf8][2] =
[0x0051] = "\x51\x00", [0x0052] = "\x52\x00", [0x0053] = "\x53\x00",
[0x0054] = "\x54\x00", [0x0055] = "\x55\x00", [0x0056] = "\x56\x00",
[0x0057] = "\x57\x00", [0x0058] = "\x58\x00", [0x0059] = "\x59\x00",
[0x005a] = "\x5a\x00", [0x005b] = "\x5b\x00", [0x005c] = "\x81\x5c",
[0x005a] = "\x5a\x00", [0x005b] = "\x5b\x00", [0x005c] = "\x5c\x00",
[0x005d] = "\x5d\x00", [0x005e] = "\x5e\x00", [0x005f] = "\x5f\x00",
[0x0060] = "\x60\x00", [0x0061] = "\x61\x00", [0x0062] = "\x62\x00",
[0x0063] = "\x63\x00", [0x0064] = "\x64\x00", [0x0065] = "\x65\x00",
@ -1936,7 +1941,7 @@ static const char from_ucs4_lat1[0xf8][2] =
[0x0075] = "\x75\x00", [0x0076] = "\x76\x00", [0x0077] = "\x77\x00",
[0x0078] = "\x78\x00", [0x0079] = "\x79\x00", [0x007a] = "\x7a\x00",
[0x007b] = "\x7b\x00", [0x007c] = "\x7c\x00", [0x007d] = "\x7d\x00",
[0x007e] = "\x00\x00",
[0x007e] = "\x7e\x00",
[0x00a2] = "\x81\x91", [0x00a3] = "\x81\x92", [0x00a5] = "\x5c\x00",
[0x00a7] = "\x81\x98", [0x00a8] = "\x81\x4e", [0x00ac] = "\x81\xca",
[0x00b0] = "\x81\x8b", [0x00b1] = "\x81\x7d", [0x00b4] = "\x81\x4c",
@ -4388,8 +4393,7 @@ static const char from_ucs4_extra[0x100][2] =
\
ch2 = inptr[1]; \
idx = ch * 256 + ch2; \
if (__builtin_expect (ch < 0x81, 0) \
|| __builtin_expect (ch2 < 0x40, 0) \
if (__builtin_expect (ch2 < 0x40, 0) \
|| (__builtin_expect (idx, 0x8140) > 0x84be && idx < 0x889f) \
|| (__builtin_expect (idx, 0x8140) > 0x88fc && idx < 0x8940) \
|| (__builtin_expect (idx, 0x8140) > 0x9ffc && idx < 0xe040) \

View File

@ -1276,196 +1276,196 @@ order_start <HEBREU>;forward;forward;forward;forward,position
order_start <GREC>;forward;backward;forward;forward,position
<U0391> <ALPHA>;<BAS>;<CAP>;IGNORE
<U03B1> <ALPHA>;<BAS>;<AMI>;IGNORE
<U0386> <ALPHA>;<TNS>;<CAP>;IGNORE
<U03AC> <ALPHA>;<TNS>;<AMI>;IGNORE
<U0392> <BETA>;<BAS>;<CAP>;IGNORE
<U03B2> <BETA>;<BAS>;<AMI>;IGNORE
<U03D0> <BETA>;<PCL>;<AMI>;IGNORE
<U0393> <GAMMA>;<BAS>;<CAP>;IGNORE
<U03B3> <GAMMA>;<BAS>;<AMI>;IGNORE
<U03DC> <GAMMA>;<PCL>;<CAP>;IGNORE # digamma copte
<U0394> <DELTA>;<BAS>;<CAP>;IGNORE
<U03B4> <DELTA>;<BAS>;<AMI>;IGNORE
<U03EA> <DELTA>;<PCL>;<CAP>;IGNORE # GANGIA COPTE
<U03EB> <DELTA>;<BAS>;<AMI>;IGNORE # gangia copte
<U0395> <EPSILON>;<BAS>;<CAP>;IGNORE
<U03B5> <EPSILON>;<BAS>;<AMI>;IGNORE
<U0388> <EPSILON>;<TNS>;<CAP>;IGNORE
<U03AD> <EPSILON>;<TNS>;<AMI>;IGNORE
<U0396> <ZETA>;<BAS>;<CAP>;IGNORE
<U03B6> <ZETA>;<BAS>;<AMI>;IGNORE
<U03E8> <ZETA>;<PCL>;<CAP>;IGNORE # HORI COPTE
<U03E9> <ZETA>;<PCL>;<AMI>;IGNORE # hori copte
<U0397> <ETA>;<BAS>;<CAP>;IGNORE
<U03B7> <ETA>;<BAS>;<AMI>;IGNORE
<U0389> <ETA>;<TNS>;<CAP>;IGNORE
<U03AE> <ETA>;<TNS>;<AMI>;IGNORE
<U0398> <THETA>;<BAS>;<CAP>;IGNORE
<U03B8> <THETA>;<BAS>;<AMI>;IGNORE
<U03D1> <THETA>;<PCL>;<AMI>;IGNORE
<U0399> <IOTA>;<BAS>;<CAP>;IGNORE
<U03B9> <IOTA>;<BAS>;<AMI>;IGNORE
<U038A> <IOTA>;<TNS>;<CAP>;IGNORE
<U03AF> <IOTA>;<TNS>;<AMI>;IGNORE
<U03AA> <IOTA>;<DLT>;<CAP>;IGNORE
<U03CA> <IOTA>;<DLT>;<AMI>;IGNORE
<U0390> <IOTA>;<DTT>;<AMI>;IGNORE
<U03F3> <IOTA>;<OGO>;<AMI>;IGNORE # yot
<U039A> <KAPPA>;<BAS>;<CAP>;IGNORE
<U03BA> <KAPPA>;<BAS>;<AMI>;IGNORE
<U03DE> <KAPPA>;<PCL>;<CAP>;IGNORE # koppa copte
<U03F0> <KAPPA>;<PCL>;<AMI>;IGNORE
<U03E6> <KAPPA>;<LIG>;<CAP>;IGNORE # KHEI COPTE
<U03E7> <KAPPA>;<LIG>;<AMI>;IGNORE # khei copte
<U039B> <LAMBDA>;<BAS>;<CAP>;IGNORE
<U03BB> <LAMBDA>;<BAS>;<CAP>;IGNORE
<U039C> <MU>;<BAS>;<CAP>;IGNORE
<U03BC> <MU>;<BAS>;<AMI>;IGNORE
<U039D> <NU>;<BAS>;<CAP>;IGNORE
<U03BD> <NU>;<BAS>;<AMI>;IGNORE
<U039E> <XI>;<BAS>;<CAP>;IGNORE
<U03BE> <XI>;<BAS>;<AMI>;IGNORE
<U039F> <OMICRON>;<BAS>;<CAP>;IGNORE
<U03BF> <OMICRON>;<BAS>;<AMI>;IGNORE
<U038C> <OMICRON>;<TNS>;<CAP>;IGNORE
<U03CC> <OMICRON>;<TNS>;<AMI>;IGNORE
<U03A0> <PI>;<BAS>;<CAP>;IGNORE
<U03C0> <PI>;<BAS>;<AMI>;IGNORE
<U03D6> <PI>;<PCL>;<AMI>;IGNORE
<U03A1> <RHO>;<BAS>;<CAP>;IGNORE
<U03C1> <RHO>;<BAS>;<CAP>;IGNORE
<U03F1> <RHO>;<PCL>;<AMI>;IGNORE
<U03A3> <SIGMA>;<BAS>;<CAP>;IGNORE
<U03C3> <SIGMA>;<BAS>;<AMI>;IGNORE
<U03C2> <SIGMA>;<PCL>;<AMI>;IGNORE
<U03DA> <SIGMA>;<PCL>;<CAP>;IGNORE # STIGMA ARCH.
<U03EC> <SIGMA>;<LIG>;<CAP>;IGNORE # SHIMA COPTE
<U03ED> <SIGMA>;<LIG>;<AMI>;IGNORE # shima copte
<U03F2> <SIGMA>;<OGO>;<AMI>;IGNORE
<U03A4> <TAU>;<BAS>;<CAP>;IGNORE
<U03C4> <TAU>;<BAS>;<AMI>;IGNORE
<U03EE> <TAU>;<PCL>;<CAP>;IGNORE # DEI COPTE
<U03EF> <TAU>;<PCL>;<AMI>;IGNORE # dei copte
<U03A5> <UPSILON>;<BAS>;<CAP>;IGNORE
<U03C5> <UPSILON>;<BAS>;<AMI>;IGNORE
<U038E> <UPSILON>;<TNS>;<CAP>;IGNORE
<U03CD> <UPSILON>;<TNS>;<AMI>;IGNORE
<U03AB> <UPSILON>;<DLT>;<CAP>;IGNORE
<U03CB> <UPSILON>;<DLT>;<AMI>;IGNORE
<U03B0> <UPSILON>;<DTT>;<AMI>;IGNORE
<U03D4> <UPSILON>;<DTT>;<CAP>;IGNORE
<U03D2> <UPSILON>;<OGO>;<CAP>;IGNORE
<U03D3> <UPSILON>;<MAC>;<CAP>;IGNORE
<U03A6> <PHI>;<BAS>;<CAP>;IGNORE
<U03C6> <PHI>;<BAS>;<AMI>;IGNORE
<U03D5> <PHI>;<PCL>;<AMI>;IGNORE
<U03E4> <PHI>;<LIG>;<CAP>;IGNORE # FEI COPTE
<U03E5> <PHI>;<LIG>;<AMI>;IGNORE # fei copte
<U03A7> <CHI>;<BAS>;<CAP>;IGNORE
<U03C7> <CHI>;<BAS>;<AMI>;IGNORE
<U03E0> <CHI>;<PCL>;<CAP>;IGNORE # sampi copte
<U03A8> <PSI>;<BAS>;<CAP>;IGNORE
<U03C8> <PSI>;<BAS>;<AMI>;IGNORE
<U03E2> <PSI>;<PCL>;<CAP>;IGNORE # SHEI COPTE
<U03E3> <PSI>;<PCL>;<AMI>;IGNORE # shei copte
<U03A9> <OMEGA>;<BAS>;<CAP>;IGNORE
<U03C9> <OMEGA>;<BAS>;<AMI>;IGNORE
<U038F> <OMEGA>;<TNS>;<CAP>;IGNORE
<U03B1> <ALPHA>;<BAS>;<AMI>;IGNORE
<U03AC> <ALPHA>;<TNS>;<AMI>;IGNORE
<U03B2> <BETA>;<BAS>;<AMI>;IGNORE
<U03D0> <BETA>;<PCL>;<AMI>;IGNORE
<U03B3> <GAMMA>;<BAS>;<AMI>;IGNORE
<U03B4> <DELTA>;<BAS>;<AMI>;IGNORE
<U03EB> <DELTA>;<BAS>;<AMI>;IGNORE # gangia copte
<U03B5> <EPSILON>;<BAS>;<AMI>;IGNORE
<U03AD> <EPSILON>;<TNS>;<AMI>;IGNORE
<U03B6> <ZETA>;<BAS>;<AMI>;IGNORE
<U03E9> <ZETA>;<PCL>;<AMI>;IGNORE # hori copte
<U03B7> <ETA>;<BAS>;<AMI>;IGNORE
<U03AE> <ETA>;<TNS>;<AMI>;IGNORE
<U03B8> <THETA>;<BAS>;<AMI>;IGNORE
<U03D1> <THETA>;<PCL>;<AMI>;IGNORE
<U03B9> <IOTA>;<BAS>;<AMI>;IGNORE
<U03AF> <IOTA>;<TNS>;<AMI>;IGNORE
<U03CA> <IOTA>;<DLT>;<AMI>;IGNORE
<U0390> <IOTA>;<DTT>;<AMI>;IGNORE
<U03F3> <IOTA>;<OGO>;<AMI>;IGNORE # yot
<U03BA> <KAPPA>;<BAS>;<AMI>;IGNORE
<U03F0> <KAPPA>;<PCL>;<AMI>;IGNORE
<U03E7> <KAPPA>;<LIG>;<AMI>;IGNORE # khei copte
<U03BB> <LAMBDA>;<BAS>;<AMI>;IGNORE
<U03BC> <MU>;<BAS>;<AMI>;IGNORE
<U03BD> <NU>;<BAS>;<AMI>;IGNORE
<U03BE> <XI>;<BAS>;<AMI>;IGNORE
<U03BF> <OMICRON>;<BAS>;<AMI>;IGNORE
<U03CC> <OMICRON>;<TNS>;<AMI>;IGNORE
<U03C0> <PI>;<BAS>;<AMI>;IGNORE
<U03D6> <PI>;<PCL>;<AMI>;IGNORE
<U03F1> <RHO>;<PCL>;<AMI>;IGNORE
<U03C3> <SIGMA>;<BAS>;<AMI>;IGNORE
<U03C2> <SIGMA>;<PCL>;<AMI>;IGNORE
<U03ED> <SIGMA>;<LIG>;<AMI>;IGNORE # shima copte
<U03F2> <SIGMA>;<OGO>;<AMI>;IGNORE
<U03C4> <TAU>;<BAS>;<AMI>;IGNORE
<U03EF> <TAU>;<PCL>;<AMI>;IGNORE # dei copte
<U03C5> <UPSILON>;<BAS>;<AMI>;IGNORE
<U03CD> <UPSILON>;<TNS>;<AMI>;IGNORE
<U03CB> <UPSILON>;<DLT>;<AMI>;IGNORE
<U03B0> <UPSILON>;<DTT>;<AMI>;IGNORE
<U03C6> <PHI>;<BAS>;<AMI>;IGNORE
<U03D5> <PHI>;<PCL>;<AMI>;IGNORE
<U03E5> <PHI>;<LIG>;<AMI>;IGNORE # fei copte
<U03C7> <CHI>;<BAS>;<AMI>;IGNORE
<U03C8> <PSI>;<BAS>;<AMI>;IGNORE
<U03E3> <PSI>;<PCL>;<AMI>;IGNORE # shei copte
<U03C9> <OMEGA>;<BAS>;<AMI>;IGNORE
<U03CE> <OMEGA>;<TNS>;<AMI>;IGNORE
order_start <CYRIL>;forward;forward;forward;forward,position
<U0430> <CYR-A>;<BAS>;<MIN>;IGNORE
<U0410> <CYR-A>;<BAS>;<CAP>;IGNORE
<U0431> <CYR-BE>;<BAS>;<MIN>;IGNORE
<U0411> <CYR-BE>;<BAS>;<CAP>;IGNORE
<U0432> <CYR-VE>;<BAS>;<MIN>;IGNORE
<U0412> <CYR-VE>;<BAS>;<CAP>;IGNORE
<U0433> <CYR-GHE>;<BAS>;<MIN>;IGNORE
<U0413> <CYR-GHE>;<BAS>;<CAP>;IGNORE
<U0434> <CYR-DE>;<BAS>;<MIN>;IGNORE
<U0414> <CYR-DE>;<BAS>;<CAP>;IGNORE
<U0453> <CYR-GZHE>;<BAS>;<MIN>;IGNORE
<U0403> <CYR-GZHE>;<BAS>;<CAP>;IGNORE
<U0452> <CYR-DJE>;<BAS>;<MIN>;IGNORE
<U0402> <CYR-DJE>;<BAS>;<CAP>;IGNORE
<U0435> <CYR-IE>;<BAS>;<MIN>;IGNORE
<U0415> <CYR-IE>;<BAS>;<CAP>;IGNORE
<U0452> <CYR-DJE>;<BAS>;<MIN>;IGNORE
<U0454> <UKR-IE>;<BAS>;<MIN>;IGNORE
<U0404> <UKR-IE>;<BAS>;<CAP>;IGNORE
<U0451> <CYR-IO>;<BAS>;<MIN>;IGNORE
<U0401> <CYR-IO>;<BAS>;<CAP>;IGNORE
<U0436> <CYR-ZHE>;<BAS>;<MIN>;IGNORE
<U0416> <CYR-ZHE>;<BAS>;<CAP>;IGNORE
<U0437> <CYR-ZE>;<BAS>;<MIN>;IGNORE
<U0417> <CYR-ZE>;<BAS>;<CAP>;IGNORE
<U0455> <CYR-DZE>;<BAS>;<MIN>;IGNORE
<U0405> <CYR-DZE>;<BAS>;<CAP>;IGNORE
<U0438> <CYR-I>;<BAS>;<MIN>;IGNORE
<U0418> <CYR-I>;<BAS>;<CAP>;IGNORE
<U0456> <UKR-I>;<BAS>;<MIN>;IGNORE
<U0406> <UKR-I>;<BAS>;<MIN>;IGNORE
<U0457> <UKR-YI>;<BAS>;<MIN>;IGNORE
<U0407> <UKR-YI>;<BAS>;<CAP>;IGNORE
<U0439> <CYR-IBRE>;<BAS>;<MIN>;IGNORE
<U0419> <CYR-IBRE>;<BAS>;<CAP>;IGNORE
<U0458> <CYR-JE>;<BAS>;<MIN>;IGNORE
<U0408> <CYR-JE>;<BAS>;<CAP>;IGNORE
<U043A> <CYR-KA>;<BAS>;<MIN>;IGNORE
<U041A> <CYR-KA>;<BAS>;<CAP>;IGNORE
<U043B> <CYR-EL>;<BAS>;<MIN>;IGNORE
<U041B> <CYR-EL>;<BAS>;<CAP>;IGNORE
<U0459> <CYR-LJE>;<BAS>;<MIN>;IGNORE
<U0409> <CYR-LJE>;<BAS>;<CAP>;IGNORE
<U043C> <CYR-EM>;<BAS>;<MIN>;IGNORE
<U041C> <CYR-EM>;<BAS>;<CAP>;IGNORE
<U043D> <CYR-EN>;<BAS>;<MIN>;IGNORE
<U041D> <CYR-EN>;<BAS>;<CAP>;IGNORE
<U045A> <CYR-NJE>;<BAS>;<MIN>;IGNORE
<U040A> <CYR-NJE>;<BAS>;<CAP>;IGNORE
<U043E> <CYR-O>;<BAS>;<MIN>;IGNORE
<U041E> <CYR-O>;<BAS>;<CAP>;IGNORE
<U043F> <CYR-PE>;<BAS>;<MIN>;IGNORE
<U041F> <CYR-PE>;<BAS>;<CAP>;IGNORE
<U0440> <CYR-ER>;<BAS>;<MIN>;IGNORE
<U0420> <CYR-ER>;<BAS>;<CAP>;IGNORE
<U0441> <CYR-ES>;<BAS>;<MIN>;IGNORE
<U0421> <CYR-ES>;<BAS>;<CAP>;IGNORE
<U0442> <CYR-TE>;<BAS>;<MIN>;IGNORE
<U0422> <CYR-TE>;<BAS>;<CAP>;IGNORE
<U045C> <CYR-KJE>;<BAS>;<MIN>;IGNORE
<U040C> <CYR-KJE>;<BAS>;<CAP>;IGNORE
<U045B> <CYR-TSHE>;<BAS>;<MIN>;IGNORE
<U040B> <CYR-TSHE>;<BAS>;<CAP>;IGNORE
<U0443> <CYR-OU>;<BAS>;<MIN>;IGNORE
<U0423> <CYR-OU>;<BAS>;<CAP>;IGNORE
<U045E> <CYR-OUBRE>;<BAS>;<MIN>;IGNORE
<U040E> <CYR-OUBRE>;<BAS>;<CAP>;IGNORE
<U0444> <CYR-EF>;<BAS>;<MIN>;IGNORE
<U0424> <CYR-EF>;<BAS>;<CAP>;IGNORE
<U0445> <CYR-HA>;<BAS>;<MIN>;IGNORE
<U0425> <CYR-HA>;<BAS>;<CAP>;IGNORE
<U0446> <CYR-TSE>;<BAS>;<MIN>;IGNORE
<U0426> <CYR-TSE>;<BAS>;<CAP>;IGNORE
<U0447> <CYR-TSHE>;<BAS>;<MIN>;IGNORE
<U0427> <CYR-TSHE>;<BAS>;<CAP>;IGNORE
<U045F> <CYR-DCHE>;<BAS>;<MIN>;IGNORE
<U040F> <CYR-DCHE>;<BAS>;<CAP>;IGNORE
<U0448> <CYR-SHA>;<BAS>;<MIN>;IGNORE
<U0428> <CYR-SHA>;<BAS>;<CAP>;IGNORE
<U0449> <CYR-SHTSHA>;<BAS>;<MIN>;IGNORE
<U0429> <CYR-SHTSHA>;<BAS>;<CAP>;IGNORE
<U044A> <CYR-SIGDUR>;<BAS>;<MIN>;IGNORE
<U042A> <CYR-SIGDUR>;<BAS>;<CAP>;IGNORE
<U044B> <CYR-YEROU>;<BAS>;<MIN>;IGNORE
<U042B> <CYR-YEROU>;<BAS>;<CAP>;IGNORE
<U044C> <CYR-SIGMOUIL>;<BAS>;<MIN>;IGNORE
<U042C> <CYR-SIGMOUIL>;<BAS>;<CAP>;IGNORE
<U044D> <CYR-E>;<BAS>;<MIN>;IGNORE
<U042D> <CYR-E>;<BAS>;<CAP>;IGNORE
<U044E> <CYR-YOU>;<BAS>;<MIN>;IGNORE
<U042E> <CYR-YOU>;<BAS>;<CAP>;IGNORE
<U044F> <CYR-YA>;<BAS>;<MIN>;IGNORE
<U0410> <CYR-A>;<BAS>;<CAP>;IGNORE
<U0411> <CYR-BE>;<BAS>;<CAP>;IGNORE
<U0412> <CYR-VE>;<BAS>;<CAP>;IGNORE
<U0413> <CYR-GHE>;<BAS>;<CAP>;IGNORE
<U0414> <CYR-DE>;<BAS>;<CAP>;IGNORE
<U0403> <CYR-GZHE>;<BAS>;<CAP>;IGNORE
<U0402> <CYR-DJE>;<BAS>;<CAP>;IGNORE
<U0415> <CYR-IE>;<BAS>;<CAP>;IGNORE
<U0404> <UKR-IE>;<BAS>;<CAP>;IGNORE
<U0401> <CYR-IO>;<BAS>;<CAP>;IGNORE
<U0416> <CYR-ZHE>;<BAS>;<CAP>;IGNORE
<U0417> <CYR-ZE>;<BAS>;<CAP>;IGNORE
<U0405> <CYR-DZE>;<BAS>;<CAP>;IGNORE
<U0418> <CYR-I>;<BAS>;<CAP>;IGNORE
<U0407> <UKR-YI>;<BAS>;<CAP>;IGNORE
<U0419> <CYR-IBRE>;<BAS>;<CAP>;IGNORE
<U0408> <CYR-JE>;<BAS>;<CAP>;IGNORE
<U041A> <CYR-KA>;<BAS>;<CAP>;IGNORE
<U041B> <CYR-EL>;<BAS>;<CAP>;IGNORE
<U0409> <CYR-LJE>;<BAS>;<CAP>;IGNORE
<U041C> <CYR-EM>;<BAS>;<CAP>;IGNORE
<U041D> <CYR-EN>;<BAS>;<CAP>;IGNORE
<U040A> <CYR-NJE>;<BAS>;<CAP>;IGNORE
<U041E> <CYR-O>;<BAS>;<CAP>;IGNORE
<U041F> <CYR-PE>;<BAS>;<CAP>;IGNORE
<U0420> <CYR-ER>;<BAS>;<CAP>;IGNORE
<U0421> <CYR-ES>;<BAS>;<CAP>;IGNORE
<U0422> <CYR-TE>;<BAS>;<CAP>;IGNORE
<U040C> <CYR-KJE>;<BAS>;<CAP>;IGNORE
<U040B> <CYR-TSHE>;<BAS>;<CAP>;IGNORE
<U0423> <CYR-OU>;<BAS>;<CAP>;IGNORE
<U040E> <CYR-OUBRE>;<BAS>;<CAP>;IGNORE
<U0424> <CYR-EF>;<BAS>;<CAP>;IGNORE
<U0425> <CYR-HA>;<BAS>;<CAP>;IGNORE
<U0426> <CYR-TSE>;<BAS>;<CAP>;IGNORE
<U0427> <CYR-TSHE>;<BAS>;<CAP>;IGNORE
<U040F> <CYR-DCHE>;<BAS>;<CAP>;IGNORE
<U0428> <CYR-SHA>;<BAS>;<CAP>;IGNORE
<U0429> <CYR-SHTSHA>;<BAS>;<CAP>;IGNORE
<U042A> <CYR-SIGDUR>;<BAS>;<CAP>;IGNORE
<U042B> <CYR-YEROU>;<BAS>;<CAP>;IGNORE
<U042C> <CYR-SIGMOUIL>;<BAS>;<CAP>;IGNORE
<U042D> <CYR-E>;<BAS>;<CAP>;IGNORE
<U042E> <CYR-YOU>;<BAS>;<CAP>;IGNORE
<U042F> <CYR-YA>;<BAS>;<CAP>;IGNORE
# order_start <HAN>;forward;forward;forward;forward,position

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1996, 1997, 1999 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -19,7 +19,7 @@
#include <string.h>
static char *olds = NULL;
static char *olds;
#undef strtok

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 92, 93, 96, 97, 98 Free Software Foundation, Inc.
/* Copyright (C) 1991, 92, 93, 96, 97, 98, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -26,10 +26,13 @@
#include <string.h>
#include <stdlib.h>
char *__ttyname = NULL;
char *__ttyname;
static char * getttyname __P ((int fd, dev_t mydev, ino_t myino,
int save, int *dostat)) internal_function;
static char *getttyname (int fd, dev_t mydev, ino_t myino,
int save, int *dostat) internal_function;
static char *getttyname_name;
static char *
internal_function
@ -41,8 +44,7 @@ getttyname (fd, mydev, myino, save, dostat)
int *dostat;
{
static const char dev[] = "/dev";
static char *name;
static size_t namelen = 0;
static size_t namelen;
struct stat st;
DIR *dirstream;
struct dirent *d;
@ -63,20 +65,21 @@ getttyname (fd, mydev, myino, save, dostat)
size_t dlen = _D_ALLOC_NAMLEN (d);
if (sizeof (dev) + dlen > namelen)
{
free (name);
free (getttyname_name);
namelen = 2 * (sizeof (dev) + dlen); /* Big enough. */
name = malloc (namelen);
if (! name)
getttyname_name = malloc (namelen);
if (! getttyname_name)
{
*dostat = -1;
/* Perhaps it helps to free the directory stream buffer. */
(void) __closedir (dirstream);
return NULL;
}
*((char *) __mempcpy (name, dev, sizeof (dev) - 1)) = '/';
*((char *) __mempcpy (getttyname_name, dev, sizeof (dev) - 1))
= '/';
}
(void) __mempcpy (&name[sizeof (dev)], d->d_name, dlen);
if (stat (name, &st) == 0
(void) __mempcpy (&getttyname_name[sizeof (dev)], d->d_name, dlen);
if (stat (getttyname_name, &st) == 0
#ifdef _STATBUF_ST_RDEV
&& S_ISCHR (st.st_mode) && st.st_rdev == mydev
#else
@ -85,9 +88,9 @@ getttyname (fd, mydev, myino, save, dostat)
)
{
(void) __closedir (dirstream);
__ttyname = name;
__ttyname = getttyname_name;
__set_errno (save);
return name;
return getttyname_name;
}
}
@ -131,3 +134,11 @@ ttyname (fd)
return name;
}
static void
free_mem (void)
{
free (getttyname_name);
}
text_set_element (__libc_subfreeres, free_mem);

View File

@ -30,15 +30,17 @@
char *__ttyname;
static char * getttyname (const char *dev, dev_t mydev,
ino_t myino, int save, int *dostat)
static char *getttyname (const char *dev, dev_t mydev,
ino_t myino, int save, int *dostat)
internal_function;
static char *getttyname_name;
static char *
internal_function
getttyname (const char *dev, dev_t mydev, ino_t myino, int save, int *dostat)
{
static char *name;
static size_t namelen;
struct stat st;
DIR *dirstream;
@ -61,20 +63,20 @@ getttyname (const char *dev, dev_t mydev, ino_t myino, int save, int *dostat)
size_t dlen = _D_ALLOC_NAMLEN (d);
if (devlen + dlen > namelen)
{
free (name);
free (getttyname_name);
namelen = 2 * (devlen + dlen); /* Big enough. */
name = malloc (namelen);
if (! name)
getttyname_name = malloc (namelen);
if (! getttyname_name)
{
*dostat = -1;
/* Perhaps it helps to free the directory stream buffer. */
(void) __closedir (dirstream);
return NULL;
}
*((char *) __mempcpy (name, dev, devlen - 1)) = '/';
*((char *) __mempcpy (getttyname_name, dev, devlen - 1)) = '/';
}
memcpy (&name[devlen], d->d_name, dlen);
if (__xstat (_STAT_VER, name, &st) == 0
memcpy (&getttyname_name[devlen], d->d_name, dlen);
if (__xstat (_STAT_VER, getttyname_name, &st) == 0
#ifdef _STATBUF_ST_RDEV
&& S_ISCHR (st.st_mode) && st.st_rdev == mydev
#else
@ -83,9 +85,9 @@ getttyname (const char *dev, dev_t mydev, ino_t myino, int save, int *dostat)
)
{
(void) __closedir (dirstream);
__ttyname = name;
__ttyname = getttyname_name;
__set_errno (save);
return name;
return getttyname_name;
}
}
@ -94,12 +96,16 @@ getttyname (const char *dev, dev_t mydev, ino_t myino, int save, int *dostat)
return NULL;
}
/* Static buffer in `ttyname'. */
static char *ttyname_buf;
/* Return the pathname of the terminal FD is open on, or NULL on errors.
The returned storage is good only until the next call to this function. */
char *
ttyname (int fd)
{
static char *buf;
static size_t buflen;
char procname[30];
struct stat st, st1;
@ -117,24 +123,24 @@ ttyname (int fd)
if (buflen == 0)
{
buflen = 4095;
buf = (char *) malloc (buflen + 1);
if (buf == NULL)
ttyname_buf = (char *) malloc (buflen + 1);
if (ttyname_buf == NULL)
{
buflen = 0;
return NULL;
}
}
len = __readlink (procname, buf, buflen);
len = __readlink (procname, ttyname_buf, buflen);
if (len != -1
/* This is for Linux 2.0. */
&& buf[0] != '[')
&& ttyname_buf[0] != '[')
{
if (len >= buflen)
return NULL;
/* readlink need not terminate the string. */
buf[len] = '\0';
return buf;
ttyname_buf[len] = '\0';
return ttyname_buf;
}
if (__fxstat (_STAT_VER, fd, &st) < 0)
@ -175,3 +181,12 @@ ttyname (int fd)
return name;
}
static void
free_mem (void)
{
free (ttyname_buf);
free (getttyname_name);
}
text_set_element (__libc_subfreeres, free_mem);