From f2af8dfdd76ea0c53f7e4a51ff23c4669a451a64 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sat, 27 Jul 2002 04:43:48 +0000 Subject: [PATCH] If HAVE_EBCDIC, translate dbname from ASCII to EBCDIC in ldbm_open. --- libraries/libldbm/ldbm.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/libraries/libldbm/ldbm.c b/libraries/libldbm/ldbm.c index 9a3a47825b..112a54a9b4 100644 --- a/libraries/libldbm/ldbm.c +++ b/libraries/libldbm/ldbm.c @@ -304,6 +304,9 @@ LDBM ldbm_open( DB_ENV *env, char *name, int rw, int mode, int dbcachesize ) { LDBM ret = NULL; +#ifdef HAVE_EBCDIC + char n2[2048]; +#endif #if DB_VERSION_MAJOR >= 3 int err; @@ -326,6 +329,12 @@ ldbm_open( DB_ENV *env, char *name, int rw, int mode, int dbcachesize ) /* likely should use ber_mem* routines */ +#ifdef HAVE_EBCDIC + strncpy(n2, name, sizeof(n2)-1); + n2[sizeof(n2)-1] = '\0'; + __atoe(n2); + name = n2; +#endif err = ret->open( ret, name, NULL, DB_TYPE, rw, mode); if ( err != 0 ) { @@ -604,6 +613,14 @@ ldbm_open( DB_ENV *env, char *name, int rw, int mode, int dbcachesize ) #ifdef HAVE_ST_BLKSIZE struct stat st; #endif +#ifdef HAVE_EBCDIC + char n2[2048]; + + strncpy(n2, name, sizeof(n2)-1); + n2[sizeof(n2)-1] = '\0'; + __atoe(n2); + name = n2; +#endif LDBM_WLOCK; -- 2.39.5