diff options
author | Ilya Zakharevich <ilya@math.berkeley.edu> | 1999-10-23 23:24:28 -0400 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1999-10-24 11:11:02 +0000 |
commit | ed344e4f516e393bcdfd181ec61ffbb056bebd56 (patch) | |
tree | de14a1859e804586b669ccab1b5e1f97623c5e7e /os2/dl_os2.c | |
parent | 72b3d9b4e0eb3eb49735d998edaf49073f03375e (diff) | |
download | perl-ed344e4f516e393bcdfd181ec61ffbb056bebd56.tar.gz |
Re: [PATCH 5.005_62] OS/2 improvements
Message-Id: <199910240724.DAA12230@monk.mps.ohio-state.edu>
p4raw-id: //depot/perl@4432
Diffstat (limited to 'os2/dl_os2.c')
-rw-r--r-- | os2/dl_os2.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/os2/dl_os2.c b/os2/dl_os2.c index 19f36f6aa7..4a9688cb59 100644 --- a/os2/dl_os2.c +++ b/os2/dl_os2.c @@ -4,15 +4,16 @@ #include <os2.h> static ULONG retcode; +static char fail[300]; void * dlopen(char *path, int mode) { HMODULE handle; char tmp[260], *beg, *dot; - char fail[300]; ULONG rc; + fail[0] = 0; if ((rc = DosLoadModule(fail, sizeof fail, path, &handle)) == 0) return (void *)handle; @@ -42,6 +43,7 @@ dlsym(void *handle, char *symbol) ULONG rc, type; PFN addr; + fail[0] = 0; rc = DosQueryProcAddr((HMODULE)handle, 0, symbol, &addr); if (rc == 0) { rc = DosQueryProcType((HMODULE)handle, 0, symbol, &type); @@ -56,15 +58,31 @@ dlsym(void *handle, char *symbol) char * dlerror(void) { - static char buf[300]; + static char buf[700]; ULONG len; if (retcode == 0) return NULL; - if (DosGetMessage(NULL, 0, buf, sizeof buf - 1, retcode, "OSO001.MSG", &len)) - sprintf(buf, "OS/2 system error code %d", retcode); - else + if (DosGetMessage(NULL, 0, buf, sizeof buf - 1, retcode, + "OSO001.MSG", &len)) { + if (fail[0]) + sprintf(buf, +"OS/2 system error code %d, possible problematic module: '%s'", + retcode, fail); + else + sprintf(buf, "OS/2 system error code %d", retcode); + } else { buf[len] = '\0'; + if (len && buf[len - 1] == '\n') + buf[--len] = 0; + if (len && buf[len - 1] == '\r') + buf[--len] = 0; + if (len && buf[len - 1] == '.') + buf[--len] = 0; + if (fail[0] && len < 300) + sprintf(buf + len, ", possible problematic module: '%s'", + fail); + } retcode = 0; return buf; } |