mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-09 12:54:23 +01:00
Fix for toupper('I') != 'i'
This commit is contained in:
parent
ff170c94f1
commit
01fe1dd2a9
@ -1,3 +1,8 @@
|
|||||||
|
2001-06-08 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
|
* configure.in (DYNLINK_MOD_CFLAGS): Use -shared with dec-osf.
|
||||||
|
Reported by Chris Adams. Merged some cases.
|
||||||
|
|
||||||
2001-05-29 Werner Koch <wk@gnupg.org>
|
2001-05-29 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
Released version 1.0.6.
|
Released version 1.0.6.
|
||||||
|
1
THANKS
1
THANKS
@ -21,6 +21,7 @@ Caskey L. Dickson caskey@technocage.com
|
|||||||
Cees van de Griend cees-list@griend.xs4all.nl
|
Cees van de Griend cees-list@griend.xs4all.nl
|
||||||
Charles Levert charles@comm.polymtl.ca
|
Charles Levert charles@comm.polymtl.ca
|
||||||
Chip Salzenberg chip@valinux.com
|
Chip Salzenberg chip@valinux.com
|
||||||
|
Chris Adams cmadams@hiwaay.net
|
||||||
Christian Kurz shorty@debian.org
|
Christian Kurz shorty@debian.org
|
||||||
Christian von Roques roques@pond.sub.org
|
Christian von Roques roques@pond.sub.org
|
||||||
Christopher Oliver oliver@fritz.traverse.net
|
Christopher Oliver oliver@fritz.traverse.net
|
||||||
|
2
TODO
2
TODO
@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
* replace all isfoo() by ascii_usfoo() ?
|
||||||
|
|
||||||
* set default charset from nl_langinfo.
|
* set default charset from nl_langinfo.
|
||||||
|
|
||||||
* check all mpi_read() for error returns.
|
* check all mpi_read() for error returns.
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
2001-06-12 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
|
* rndw32.c (slow_gatherer_windowsNT): Ditto. Not really needed here but anyway.
|
||||||
|
|
||||||
|
* cipher.c (string_to_cipher_algo): Use ascii_strcasecmp().
|
||||||
|
* md.c (string_to_digest_algo): Ditto.
|
||||||
|
* pubkey.c (string_to_pubkey_algo): Ditto.
|
||||||
|
|
||||||
2001-04-29 Werner Koch <wk@gnupg.org>
|
2001-04-29 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
* random.c (fast_random_poll): Do not check the return code of
|
* random.c (fast_random_poll): Do not check the return code of
|
||||||
|
@ -258,7 +258,7 @@ string_to_cipher_algo( const char *string )
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
for(i=0; (s=cipher_table[i].name); i++ )
|
for(i=0; (s=cipher_table[i].name); i++ )
|
||||||
if( !stricmp( s, string ) )
|
if( !ascii_strcasecmp( s, string ) )
|
||||||
return cipher_table[i].algo;
|
return cipher_table[i].algo;
|
||||||
} while( load_cipher_modules() );
|
} while( load_cipher_modules() );
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -152,7 +152,7 @@ string_to_digest_algo( const char *string )
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
for(r = digest_list; r; r = r->next )
|
for(r = digest_list; r; r = r->next )
|
||||||
if( !stricmp( r->name, string ) )
|
if( !ascii_strcasecmp( r->name, string ) )
|
||||||
return r->algo;
|
return r->algo;
|
||||||
} while( !r && load_digest_module(-1) );
|
} while( !r && load_digest_module(-1) );
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -296,7 +296,7 @@ string_to_pubkey_algo( const char *string )
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
for(i=0; (s=pubkey_table[i].name); i++ )
|
for(i=0; (s=pubkey_table[i].name); i++ )
|
||||||
if( !stricmp( s, string ) )
|
if( !ascii_strcasecmp( s, string ) )
|
||||||
return pubkey_table[i].algo;
|
return pubkey_table[i].algo;
|
||||||
} while( load_pubkey_modules() );
|
} while( load_pubkey_modules() );
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -561,7 +561,8 @@ slow_gatherer_windowsNT( void (*add)(const void*, size_t, int), int requester )
|
|||||||
log_debug ("rndw32#slow_gatherer_nt: check product options\n" );
|
log_debug ("rndw32#slow_gatherer_nt: check product options\n" );
|
||||||
status = RegQueryValueEx (hKey, "ProductType", 0, NULL,
|
status = RegQueryValueEx (hKey, "ProductType", 0, NULL,
|
||||||
szValue, &dwSize);
|
szValue, &dwSize);
|
||||||
if (status == ERROR_SUCCESS && stricmp (szValue, "WinNT")) {
|
if (status == ERROR_SUCCESS
|
||||||
|
&& ascii_strcasecmp (szValue, "WinNT")) {
|
||||||
/* Note: There are (at least) three cases for ProductType:
|
/* Note: There are (at least) three cases for ProductType:
|
||||||
* WinNT = NT Workstation, ServerNT = NT Server, LanmanNT =
|
* WinNT = NT Workstation, ServerNT = NT Server, LanmanNT =
|
||||||
* NT Server acting as a Domain Controller */
|
* NT Server acting as a Domain Controller */
|
||||||
|
16
configure.in
16
configure.in
@ -256,25 +256,13 @@ AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME")
|
|||||||
|
|
||||||
dnl Fixme: Are these the best flags for OpenBSD????
|
dnl Fixme: Are these the best flags for OpenBSD????
|
||||||
case "${target}" in
|
case "${target}" in
|
||||||
*-openbsd*)
|
*-openbsd* | *-netbsd*)
|
||||||
NAME_OF_DEV_RANDOM="/dev/srandom"
|
NAME_OF_DEV_RANDOM="/dev/srandom"
|
||||||
NAME_OF_DEV_URANDOM="/dev/urandom"
|
NAME_OF_DEV_URANDOM="/dev/urandom"
|
||||||
DYNLINK_MOD_CFLAGS="-shared -rdynamic $CFLAGS_PIC -Wl,-Bshareable -Wl,-x"
|
DYNLINK_MOD_CFLAGS="-shared -rdynamic $CFLAGS_PIC -Wl,-Bshareable -Wl,-x"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*-netbsd*)
|
*-solaris* | *-irix* | *-dec-osf* )
|
||||||
NAME_OF_DEV_RANDOM="/dev/random"
|
|
||||||
NAME_OF_DEV_URANDOM="/dev/urandom"
|
|
||||||
DYNLINK_MOD_CFLAGS="-shared -rdynamic $CFLAGS_PIC -Wl,-Bshareable -Wl,-x"
|
|
||||||
;;
|
|
||||||
|
|
||||||
*-solaris*)
|
|
||||||
NAME_OF_DEV_RANDOM="/dev/random"
|
|
||||||
NAME_OF_DEV_URANDOM="/dev/random"
|
|
||||||
DYNLINK_MOD_CFLAGS="-shared $CFLAGS_PIC"
|
|
||||||
;;
|
|
||||||
|
|
||||||
*-irix*)
|
|
||||||
NAME_OF_DEV_RANDOM="/dev/random"
|
NAME_OF_DEV_RANDOM="/dev/random"
|
||||||
NAME_OF_DEV_URANDOM="/dev/urandom"
|
NAME_OF_DEV_URANDOM="/dev/urandom"
|
||||||
DYNLINK_MOD_CFLAGS="-shared $CFLAGS_PIC"
|
DYNLINK_MOD_CFLAGS="-shared $CFLAGS_PIC"
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
2001-06-12 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
|
* getkey.c (compare_name): Use ascii_memistr(), ascii_memcasecmp()
|
||||||
|
* keyedit.c (keyedit_menu): Use ascii_strcasecmp().
|
||||||
|
* armor.c (radix64_read): Use ascii_toupper().
|
||||||
|
* ringedit.c (do_bm_search): Ditto.
|
||||||
|
* keygen.c (read_parameter_file): Ditto.
|
||||||
|
* openfile.c (CMP_FILENAME): Ditto.
|
||||||
|
* g10.c (i18n_init): We can now use just LC_ALL.
|
||||||
|
|
||||||
2001-05-29 Werner Koch <wk@gnupg.org>
|
2001-05-29 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
* keygen.c (generate_subkeypair): Print a warning if a subkey is
|
* keygen.c (generate_subkeypair): Print a warning if a subkey is
|
||||||
|
@ -649,9 +649,9 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn,
|
|||||||
if( isxdigit(cc1) && isxdigit(cc2)
|
if( isxdigit(cc1) && isxdigit(cc2)
|
||||||
&& strchr( "=\n\r\t ", cc3 )) {
|
&& strchr( "=\n\r\t ", cc3 )) {
|
||||||
/* well it seems to be the case - adjust */
|
/* well it seems to be the case - adjust */
|
||||||
c = isdigit(cc1)? (cc1 - '0'): (toupper(cc1)-'A'+10);
|
c = isdigit(cc1)? (cc1 - '0'): (ascii_toupper(cc1)-'A'+10);
|
||||||
c <<= 4;
|
c <<= 4;
|
||||||
c |= isdigit(cc2)? (cc2 - '0'): (toupper(cc2)-'A'+10);
|
c |= isdigit(cc2)? (cc2 - '0'): (ascii_toupper(cc2)-'A'+10);
|
||||||
afx->buffer_pos += 2;
|
afx->buffer_pos += 2;
|
||||||
afx->qp_detected = 1;
|
afx->qp_detected = 1;
|
||||||
goto again;
|
goto again;
|
||||||
|
@ -513,12 +513,7 @@ i18n_init(void)
|
|||||||
set_gettext_file( PACKAGE );
|
set_gettext_file( PACKAGE );
|
||||||
#else
|
#else
|
||||||
#ifdef ENABLE_NLS
|
#ifdef ENABLE_NLS
|
||||||
#ifdef HAVE_LC_MESSAGES
|
setlocale( LC_ALL, "" );
|
||||||
setlocale( LC_TIME, "" );
|
|
||||||
setlocale( LC_MESSAGES, "" );
|
|
||||||
#else
|
|
||||||
setlocale( LC_ALL, "" );
|
|
||||||
#endif
|
|
||||||
bindtextdomain( PACKAGE, G10_LOCALEDIR );
|
bindtextdomain( PACKAGE, G10_LOCALEDIR );
|
||||||
textdomain( PACKAGE );
|
textdomain( PACKAGE );
|
||||||
#endif
|
#endif
|
||||||
|
@ -1273,7 +1273,7 @@ compare_name( const char *uid, size_t uidlen, const char *name, int mode )
|
|||||||
return 0; /* found */
|
return 0; /* found */
|
||||||
}
|
}
|
||||||
else if( mode == 2 ) { /* case insensitive substring */
|
else if( mode == 2 ) { /* case insensitive substring */
|
||||||
if( memistr( uid, uidlen, name ) )
|
if( ascii_memistr( uid, uidlen, name ) )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if( mode >= 3 && mode <= 5 ) { /* look at the email address */
|
else if( mode >= 3 && mode <= 5 ) { /* look at the email address */
|
||||||
@ -1287,11 +1287,12 @@ compare_name( const char *uid, size_t uidlen, const char *name, int mode )
|
|||||||
if( i < uidlen ) {
|
if( i < uidlen ) {
|
||||||
i = se - s;
|
i = se - s;
|
||||||
if( mode == 3 ) { /* exact email address */
|
if( mode == 3 ) { /* exact email address */
|
||||||
if( strlen(name)-2 == i && !memicmp( s, name+1, i) )
|
if( strlen(name)-2 == i
|
||||||
|
&& !ascii_memcasecmp( s, name+1, i) )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if( mode == 4 ) { /* email substring */
|
else if( mode == 4 ) { /* email substring */
|
||||||
if( memistr( s, i, name ) )
|
if( ascii_memistr( s, i, name ) )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else { /* email from end */
|
else { /* email from end */
|
||||||
|
@ -721,7 +721,7 @@ keyedit_menu( const char *username, STRLIST locusr, STRLIST commands,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(i=0; cmds[i].name; i++ ) {
|
for(i=0; cmds[i].name; i++ ) {
|
||||||
if( !stricmp( answer, cmds[i].name ) )
|
if( !ascii_strcasecmp( answer, cmds[i].name ) )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if( sign_mode && !cmds[i].signmode )
|
if( sign_mode && !cmds[i].signmode )
|
||||||
|
12
g10/keygen.c
12
g10/keygen.c
@ -1292,17 +1292,17 @@ read_parameter_file( const char *fname )
|
|||||||
;
|
;
|
||||||
value = p;
|
value = p;
|
||||||
trim_trailing_ws( value, strlen(value) );
|
trim_trailing_ws( value, strlen(value) );
|
||||||
if( !stricmp( keyword, "%echo" ) )
|
if( !ascii_strcasecmp( keyword, "%echo" ) )
|
||||||
log_info("%s\n", value );
|
log_info("%s\n", value );
|
||||||
else if( !stricmp( keyword, "%dry-run" ) )
|
else if( !ascii_strcasecmp( keyword, "%dry-run" ) )
|
||||||
outctrl.dryrun = 1;
|
outctrl.dryrun = 1;
|
||||||
else if( !stricmp( keyword, "%commit" ) ) {
|
else if( !ascii_strcasecmp( keyword, "%commit" ) ) {
|
||||||
outctrl.lnr = lnr;
|
outctrl.lnr = lnr;
|
||||||
proc_parameter_file( para, fname, &outctrl );
|
proc_parameter_file( para, fname, &outctrl );
|
||||||
release_parameter_list( para );
|
release_parameter_list( para );
|
||||||
para = NULL;
|
para = NULL;
|
||||||
}
|
}
|
||||||
else if( !stricmp( keyword, "%pubring" ) ) {
|
else if( !ascii_strcasecmp( keyword, "%pubring" ) ) {
|
||||||
if( outctrl.pub.fname && !strcmp( outctrl.pub.fname, value ) )
|
if( outctrl.pub.fname && !strcmp( outctrl.pub.fname, value ) )
|
||||||
; /* still the same file - ignore it */
|
; /* still the same file - ignore it */
|
||||||
else {
|
else {
|
||||||
@ -1311,7 +1311,7 @@ read_parameter_file( const char *fname )
|
|||||||
outctrl.use_files = 1;
|
outctrl.use_files = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( !stricmp( keyword, "%secring" ) ) {
|
else if( !ascii_strcasecmp( keyword, "%secring" ) ) {
|
||||||
if( outctrl.sec.fname && !strcmp( outctrl.sec.fname, value ) )
|
if( outctrl.sec.fname && !strcmp( outctrl.sec.fname, value ) )
|
||||||
; /* still the same file - ignore it */
|
; /* still the same file - ignore it */
|
||||||
else {
|
else {
|
||||||
@ -1344,7 +1344,7 @@ read_parameter_file( const char *fname )
|
|||||||
trim_trailing_ws( value, strlen(value) );
|
trim_trailing_ws( value, strlen(value) );
|
||||||
|
|
||||||
for(i=0; keywords[i].name; i++ ) {
|
for(i=0; keywords[i].name; i++ ) {
|
||||||
if( !stricmp( keywords[i].name, keyword ) )
|
if( !ascii_strcasecmp( keywords[i].name, keyword ) )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if( !keywords[i].name ) {
|
if( !keywords[i].name ) {
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_DRIVE_LETTERS
|
#ifdef HAVE_DRIVE_LETTERS
|
||||||
#define CMP_FILENAME(a,b) stricmp( (a), (b) )
|
#define CMP_FILENAME(a,b) ascii_strcasecmp( (a), (b) )
|
||||||
#else
|
#else
|
||||||
#define CMP_FILENAME(a,b) strcmp( (a), (b) )
|
#define CMP_FILENAME(a,b) strcmp( (a), (b) )
|
||||||
#endif
|
#endif
|
||||||
|
@ -1000,8 +1000,8 @@ do_bm_search( const byte *buf, size_t buflen,
|
|||||||
int c, c1;
|
int c, c1;
|
||||||
|
|
||||||
for( i = --patlen; i < buflen; i += dist[c1] )
|
for( i = --patlen; i < buflen; i += dist[c1] )
|
||||||
for( j=patlen, k=i, c1=c=toupper(buf[k]); c == pat[j];
|
for( j=patlen, k=i, c1=c=ascii_toupper(buf[k]); c == pat[j];
|
||||||
j--, k--, c=toupper(buf[k]) ) {
|
j--, k--, c=ascii_toupper(buf[k]) ) {
|
||||||
if( !j )
|
if( !j )
|
||||||
return buf+k;
|
return buf+k;
|
||||||
}
|
}
|
||||||
|
@ -170,6 +170,7 @@ STRLIST append_to_strlist2( STRLIST *list, const char *string, int is_utf8 );
|
|||||||
STRLIST strlist_prev( STRLIST head, STRLIST node );
|
STRLIST strlist_prev( STRLIST head, STRLIST node );
|
||||||
STRLIST strlist_last( STRLIST node );
|
STRLIST strlist_last( STRLIST node );
|
||||||
const char *memistr( const char *buf, size_t buflen, const char *sub );
|
const char *memistr( const char *buf, size_t buflen, const char *sub );
|
||||||
|
const char *ascii_memistr( const char *buf, size_t buflen, const char *sub );
|
||||||
char *mem2str( char *, const void *, size_t);
|
char *mem2str( char *, const void *, size_t);
|
||||||
char *trim_spaces( char *string );
|
char *trim_spaces( char *string );
|
||||||
unsigned int trim_trailing_chars( byte *line, unsigned int len,
|
unsigned int trim_trailing_chars( byte *line, unsigned int len,
|
||||||
@ -185,6 +186,13 @@ char *native_to_utf8( const char *string );
|
|||||||
char *utf8_to_native( const char *string, size_t length );
|
char *utf8_to_native( const char *string, size_t length );
|
||||||
int check_utf8_string( const char *string );
|
int check_utf8_string( const char *string );
|
||||||
|
|
||||||
|
int ascii_isupper (int c);
|
||||||
|
int ascii_islower (int c);
|
||||||
|
int ascii_toupper (int c);
|
||||||
|
int ascii_tolower (int c);
|
||||||
|
int ascii_strcasecmp( const char *a, const char *b );
|
||||||
|
int ascii_memcasecmp( const char *a, const char *b, size_t n );
|
||||||
|
|
||||||
#ifndef HAVE_MEMICMP
|
#ifndef HAVE_MEMICMP
|
||||||
int memicmp( const char *a, const char *b, size_t n );
|
int memicmp( const char *a, const char *b, size_t n );
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
2001-06-12 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
|
* strgutil.c (ascii_memistr,ascii_isupper,ascii_islower,
|
||||||
|
ascii_toupper,ascii_tolower, ascii_strcasecmp, ascii_memcasecmp): New.
|
||||||
|
(set_native_charset): Use ascii_strcasecmp()
|
||||||
|
* fileutil.c (compare_filenames): Ditto
|
||||||
|
* miscutil.c (answer_is_yes): Ditto.
|
||||||
|
(answer_is_yes_no_quit): Ditto.
|
||||||
|
|
||||||
2001-06-06 Werner Koch <wk@gnupg.org>
|
2001-06-06 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
* strgutil.c (vasprintf) [__MINGW32__]: New. Taken from libiberty.
|
* strgutil.c (vasprintf) [__MINGW32__]: New. Taken from libiberty.
|
||||||
|
@ -127,7 +127,7 @@ compare_filenames( const char *a, const char *b )
|
|||||||
* resolve symlinks?
|
* resolve symlinks?
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_DRIVE_LETTERS
|
#ifdef HAVE_DRIVE_LETTERS
|
||||||
return stricmp(a,b);
|
return ascii_strcasecmp(a,b);
|
||||||
#else
|
#else
|
||||||
return strcmp(a,b);
|
return strcmp(a,b);
|
||||||
#endif
|
#endif
|
||||||
|
@ -289,6 +289,7 @@ answer_is_yes( const char *s )
|
|||||||
const char *long_no = _("no");
|
const char *long_no = _("no");
|
||||||
const char *short_no = _("nN");
|
const char *short_no = _("nN");
|
||||||
|
|
||||||
|
/* Note: we have to use the local dependent strcasecmp here */
|
||||||
if( !stricmp(s, long_yes ) )
|
if( !stricmp(s, long_yes ) )
|
||||||
return 1;
|
return 1;
|
||||||
if( *s && strchr( short_yes, *s ) && !s[1] )
|
if( *s && strchr( short_yes, *s ) && !s[1] )
|
||||||
@ -299,7 +300,7 @@ answer_is_yes( const char *s )
|
|||||||
if( *s && strchr( short_no, *s ) && !s[1] )
|
if( *s && strchr( short_no, *s ) && !s[1] )
|
||||||
return 0;
|
return 0;
|
||||||
/* test for the english version (for those who are used to type yes) */
|
/* test for the english version (for those who are used to type yes) */
|
||||||
if( !stricmp(s, "yes" ) )
|
if( !ascii_strcasecmp(s, "yes" ) )
|
||||||
return 1;
|
return 1;
|
||||||
if( *s && strchr( "yY", *s ) && !s[1] )
|
if( *s && strchr( "yY", *s ) && !s[1] )
|
||||||
return 1;
|
return 1;
|
||||||
@ -320,6 +321,7 @@ answer_is_yes_no_quit( const char *s )
|
|||||||
const char *short_no = _("nN");
|
const char *short_no = _("nN");
|
||||||
const char *short_quit = _("qQ");
|
const char *short_quit = _("qQ");
|
||||||
|
|
||||||
|
/* Note: We have to use the locale dependent strcasecmp */
|
||||||
if( !stricmp(s, long_no ) )
|
if( !stricmp(s, long_no ) )
|
||||||
return 0;
|
return 0;
|
||||||
if( !stricmp(s, long_yes ) )
|
if( !stricmp(s, long_yes ) )
|
||||||
@ -332,9 +334,10 @@ answer_is_yes_no_quit( const char *s )
|
|||||||
return 1;
|
return 1;
|
||||||
if( *s && strchr( short_quit, *s ) && !s[1] )
|
if( *s && strchr( short_quit, *s ) && !s[1] )
|
||||||
return -1;
|
return -1;
|
||||||
if( !stricmp(s, "yes" ) )
|
/* but not here */
|
||||||
|
if( !ascii_strcasecmp(s, "yes" ) )
|
||||||
return 1;
|
return 1;
|
||||||
if( !stricmp(s, "quit" ) )
|
if( !ascii_strcasecmp(s, "quit" ) )
|
||||||
return -1;
|
return -1;
|
||||||
if( *s && strchr( "yY", *s ) && !s[1] )
|
if( *s && strchr( "yY", *s ) && !s[1] )
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -65,6 +65,7 @@ static ushort latin2_unicode[128] = {
|
|||||||
0x0159,0x016F,0x00FA,0x0171,0x00FC,0x00FD,0x0163,0x02D9
|
0x0159,0x016F,0x00FA,0x0171,0x00FC,0x00FD,0x0163,0x02D9
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static const char *active_charset_name = "iso-8859-1";
|
static const char *active_charset_name = "iso-8859-1";
|
||||||
static ushort *active_charset = NULL;
|
static ushort *active_charset = NULL;
|
||||||
static int no_translation = 0;
|
static int no_translation = 0;
|
||||||
@ -193,6 +194,25 @@ memistr( const char *buf, size_t buflen, const char *sub )
|
|||||||
return NULL ;
|
return NULL ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
ascii_memistr( const char *buf, size_t buflen, const char *sub )
|
||||||
|
{
|
||||||
|
const byte *t, *s ;
|
||||||
|
size_t n;
|
||||||
|
|
||||||
|
for( t=buf, n=buflen, s=sub ; n ; t++, n-- )
|
||||||
|
if( ascii_toupper(*t) == ascii_toupper(*s) ) {
|
||||||
|
for( buf=t++, buflen = n--, s++;
|
||||||
|
n && ascii_toupper(*t) == ascii_toupper(*s); t++, s++, n-- )
|
||||||
|
;
|
||||||
|
if( !*s )
|
||||||
|
return buf;
|
||||||
|
t = buf; n = buflen; s = sub ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL ;
|
||||||
|
}
|
||||||
|
|
||||||
/****************
|
/****************
|
||||||
* Wie strncpy(), aber es werden maximal n-1 zeichen kopiert und ein
|
* Wie strncpy(), aber es werden maximal n-1 zeichen kopiert und ein
|
||||||
* '\0' angehängt. Ist n = 0, so geschieht nichts, ist Destination
|
* '\0' angehängt. Ist n = 0, so geschieht nichts, ist Destination
|
||||||
@ -325,22 +345,23 @@ string_count_chr( const char *string, int c )
|
|||||||
int
|
int
|
||||||
set_native_charset( const char *newset )
|
set_native_charset( const char *newset )
|
||||||
{
|
{
|
||||||
if( !stricmp( newset, "iso-8859-1" ) ) {
|
if( !ascii_strcasecmp( newset, "iso-8859-1" ) ) {
|
||||||
active_charset_name = "iso-8859-1";
|
active_charset_name = "iso-8859-1";
|
||||||
no_translation = 0;
|
no_translation = 0;
|
||||||
active_charset = NULL;
|
active_charset = NULL;
|
||||||
}
|
}
|
||||||
else if( !stricmp( newset, "iso-8859-2" ) ) {
|
else if( !ascii_strcasecmp( newset, "iso-8859-2" ) ) {
|
||||||
active_charset_name = "iso-8859-2";
|
active_charset_name = "iso-8859-2";
|
||||||
no_translation = 0;
|
no_translation = 0;
|
||||||
active_charset = latin2_unicode;
|
active_charset = latin2_unicode;
|
||||||
}
|
}
|
||||||
else if( !stricmp( newset, "koi8-r" ) ) {
|
else if( !ascii_strcasecmp( newset, "koi8-r" ) ) {
|
||||||
active_charset_name = "koi8-r";
|
active_charset_name = "koi8-r";
|
||||||
no_translation = 0;
|
no_translation = 0;
|
||||||
active_charset = koi8_unicode;
|
active_charset = koi8_unicode;
|
||||||
}
|
}
|
||||||
else if( !stricmp (newset, "utf8" ) || !stricmp(newset, "utf-8") ) {
|
else if( !ascii_strcasecmp (newset, "utf8" )
|
||||||
|
|| !ascii_strcasecmp(newset, "utf-8") ) {
|
||||||
active_charset_name = "utf-8";
|
active_charset_name = "utf-8";
|
||||||
no_translation = 1;
|
no_translation = 1;
|
||||||
active_charset = NULL;
|
active_charset = NULL;
|
||||||
@ -582,6 +603,63 @@ utf8_to_native( const char *string, size_t length )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************
|
||||||
|
******** locale insensitive ctype functions ********
|
||||||
|
****************************************************/
|
||||||
|
/* FIXME: replace them by a table lookup and macros */
|
||||||
|
int
|
||||||
|
ascii_isupper (int c)
|
||||||
|
{
|
||||||
|
return c >= 'A' && c <= 'Z';
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
ascii_islower (int c)
|
||||||
|
{
|
||||||
|
return c >= 'a' && c <= 'z';
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
ascii_toupper (int c)
|
||||||
|
{
|
||||||
|
if (c >= 'a' && c <= 'z')
|
||||||
|
c &= ~0x20;
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
ascii_tolower (int c)
|
||||||
|
{
|
||||||
|
if (c >= 'A' && c <= 'Z')
|
||||||
|
c |= 0x20;
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
ascii_strcasecmp( const char *a, const char *b )
|
||||||
|
{
|
||||||
|
if (a == b)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
for (; *a && *b; a++, b++) {
|
||||||
|
if (*a != *b && ascii_toupper(*a) != ascii_toupper(*b))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return *a == *b? 0 : (ascii_toupper (*a) - ascii_toupper (*b));
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
ascii_memcasecmp( const char *a, const char *b, size_t n )
|
||||||
|
{
|
||||||
|
if (a == b)
|
||||||
|
return 0;
|
||||||
|
for ( ; n; n--, a++, b++ ) {
|
||||||
|
if( *a != *b && ascii_toupper (*a) != ascii_toupper (*b) )
|
||||||
|
return *a == *b? 0 : (ascii_toupper (*a) - ascii_toupper (*b));
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************
|
/*********************************************
|
||||||
|
Loading…
x
Reference in New Issue
Block a user