summaryrefslogtreecommitdiff
path: root/os2
diff options
context:
space:
mode:
Diffstat (limited to 'os2')
-rw-r--r--os2/OS2/REXX/REXX.xs22
1 files changed, 21 insertions, 1 deletions
diff --git a/os2/OS2/REXX/REXX.xs b/os2/OS2/REXX/REXX.xs
index c3ddcb4dbd..10ee7ece2b 100644
--- a/os2/OS2/REXX/REXX.xs
+++ b/os2/OS2/REXX/REXX.xs
@@ -72,7 +72,8 @@ exec_in_REXX_with(pTHX_ char *cmd, int c, char **handlerNames, RexxFunctionHandl
LONG rc;
SV *res;
char *subs = 0;
- int n = c;
+ int n = c, have_nl = 0;
+ char *ocmd = cmd, *s, *t;
incompartment++;
@@ -84,6 +85,23 @@ exec_in_REXX_with(pTHX_ char *cmd, int c, char **handlerNames, RexxFunctionHandl
subs[n] = 1;
}
+ s = cmd;
+ while (*s) {
+ if (*s == '\n') { /* Is not preceeded by \r! */
+ New(728, cmd, 2*strlen(cmd)+1, char);
+ s = ocmd;
+ t = cmd;
+ while (*s) {
+ if (*s == '\n')
+ *t++ = '\r';
+ *t++ = *s++;
+ }
+ *t = 0;
+ break;
+ } else if (*s == '\r')
+ s++;
+ s++;
+ }
MAKERXSTRING(args[0], NULL, 0);
MAKERXSTRING(inst[0], cmd, strlen(cmd));
MAKERXSTRING(inst[1], NULL, 0);
@@ -105,6 +123,8 @@ exec_in_REXX_with(pTHX_ char *cmd, int c, char **handlerNames, RexxFunctionHandl
pRexxDeregisterFunction(handlerNames[n]);
if (c)
Safefree(subs);
+ if (cmd != ocmd)
+ Safefree(cmd);
#if 0 /* Do we want to restore these? */
DosFreeModule(hRexxAPI);
DosFreeModule(hRexx);