From: Ilya Zakharevich Date: Fri, 13 Dec 2002 14:08:00 +0000 (-0800) Subject: OS/2 REXX interface assuming Object REXX X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ae2efb68622a795e5d137b8fd8181b67e74a58b9;p=p5sagit%2Fp5-mst-13.2.git OS/2 REXX interface assuming Object REXX Message-ID: <20021213220800.GA2625@math.berkeley.edu> p4raw-id: //depot/perl@18313 --- diff --git a/os2/OS2/REXX/REXX.xs b/os2/OS2/REXX/REXX.xs index c3ddcb4..10ee7ec 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);