summaryrefslogtreecommitdiff
path: root/os2/dl_os2.c
diff options
context:
space:
mode:
authorIlya Zakharevich <ilya@math.berkeley.edu>2001-06-25 01:02:36 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2001-06-25 13:44:14 +0000
commit9fed8b87f0e66c26a1acaf42431d99e8f98aed9b (patch)
tree0e2217b9b1b47b8bbe645e1146f1d52ec742c0fb /os2/dl_os2.c
parent65850d1188a11c32e29d02481824ef0f35fbacee (diff)
downloadperl-9fed8b87f0e66c26a1acaf42431d99e8f98aed9b.tar.gz
Re: [PATCH 5.6.1] $^E on OS/2
Message-ID: <20010625050235.A24046@math.ohio-state.edu> p4raw-id: //depot/perl@10917
Diffstat (limited to 'os2/dl_os2.c')
-rw-r--r--os2/dl_os2.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/os2/dl_os2.c b/os2/dl_os2.c
index 02ca2efd46..aaeeb580f4 100644
--- a/os2/dl_os2.c
+++ b/os2/dl_os2.c
@@ -8,6 +8,8 @@
static ULONG retcode;
static char fail[300];
+char *os2error(int rc);
+
void *
dlopen(char *path, int mode)
{
@@ -62,29 +64,17 @@ dlerror(void)
{
static char buf[700];
ULONG len;
+ char *err;
if (retcode == 0)
return NULL;
- if (DosGetMessage(NULL, 0, buf, sizeof buf - 1, retcode,
- "OSO001.MSG", &len)) {
- if (fail[0])
- sprintf(buf,
-"OS/2 system error code %lu, possible problematic module: '%s'",
- retcode, fail);
- else
- sprintf(buf, "OS/2 system error code %lu", 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);
- }
+ err = os2error(retcode);
+ len = strlen(err);
+ if (len > sizeof(buf) - 1)
+ len = sizeof(buf) - 1;
+ strncpy(buf, err, len+1);
+ if (fail[0] && len < 300)
+ sprintf(buf + len, ", possible problematic module: '%s'", fail);
retcode = 0;
return buf;
}