Skip to content
Snippets Groups Projects
Commit cd60deb4 authored by Howard Chu's avatar Howard Chu
Browse files

OS/390 EBCDIC support

parent 3b9f4a82
No related branches found
No related tags found
No related merge requests found
......@@ -109,6 +109,9 @@ bdb_db_cache(
file = ch_malloc( strlen( name ) + sizeof(BDB_SUFFIX) );
sprintf( file, "%s" BDB_SUFFIX, name );
#ifdef HAVE_EBCDIC
__atoe( file );
#endif
rc = DB_OPEN( db->bdi_db,
file, name,
DB_HASH, bdb->bi_db_opflags | DB_CREATE | DB_THREAD,
......
......@@ -15,9 +15,28 @@
void bdb_errcall( const char *pfx, char * msg )
{
#ifdef HAVE_EBCDIC
if ( msg[0] > 0x7f )
__etoa( msg );
#endif
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, INFO, "bdb(%s): %s\n", pfx, msg, 0 );
#else
Debug( LDAP_DEBUG_ANY, "bdb(%s): %s\n", pfx, msg, 0 );
#endif
}
#ifdef HAVE_EBCDIC
#undef db_strerror
/* Not re-entrant! */
char *ebcdic_dberror( int rc )
{
static char msg[1024];
strcpy( msg, db_strerror( rc ) );
__etoa( msg );
return msg;
}
#endif
......@@ -173,6 +173,9 @@ bdb_db_open( BackendDB *be )
int rc, i;
struct bdb_info *bdb = (struct bdb_info *) be->be_private;
u_int32_t flags;
#ifdef HAVE_EBCDIC
char path[MAXPATHLEN];
#endif
#ifdef NEW_LOGGING
LDAP_LOG( BACK_BDB, ARGS,
......@@ -284,10 +287,19 @@ bdb_db_open( BackendDB *be )
bdb->bi_dbenv_home, 0, 0);
#endif
#ifdef HAVE_EBCDIC
strcpy( path, bdb->bi_dbenv_home );
__atoe( path );
rc = bdb->bi_dbenv->open( bdb->bi_dbenv,
path,
flags,
bdb->bi_dbenv_mode );
#else
rc = bdb->bi_dbenv->open( bdb->bi_dbenv,
bdb->bi_dbenv_home,
flags,
bdb->bi_dbenv_mode );
#endif
if( rc != 0 ) {
#ifdef NEW_LOGGING
LDAP_LOG( BACK_BDB, ERR,
......@@ -362,12 +374,23 @@ bdb_db_open( BackendDB *be )
BDB_PAGESIZE );
}
#ifdef HAVE_EBCDIC
strcpy( path, bdbi_databases[i].file );
__atoe( path );
rc = DB_OPEN( db->bdi_db,
path,
/* bdbi_databases[i].name, */ NULL,
bdbi_databases[i].type,
bdbi_databases[i].flags | flags,
bdb->bi_dbenv_mode );
#else
rc = DB_OPEN( db->bdi_db,
bdbi_databases[i].file,
/* bdbi_databases[i].name, */ NULL,
bdbi_databases[i].type,
bdbi_databases[i].flags | flags,
bdb->bi_dbenv_mode );
#endif
if( rc != 0 ) {
#ifdef NEW_LOGGING
......@@ -543,6 +566,17 @@ bdb_initialize(
{ /* version check */
int major, minor, patch;
char *version = db_version( &major, &minor, &patch );
#ifdef HAVE_EBCDIC
char v2[1024];
/* All our stdio does an ASCII to EBCDIC conversion on
* the output. Strings from the BDB library are already
* in EBCDIC; we have to go back and forth...
*/
strcpy( v2, version );
__etoa( v2 );
version = v2;
#endif
if( major != DB_VERSION_MAJOR ||
minor != DB_VERSION_MINOR ||
......
......@@ -343,6 +343,12 @@ int bdb_cache_delete_entry(
);
void bdb_cache_release_all( Cache *cache );
#ifdef HAVE_EBCDIC
char *ebcdic_dberror( int rc );
#define db_strerror(x) ebcdic_dberror(x)
#endif
LDAP_END_DECL
#endif /* _PROTO_BDB_H */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment