+ * Revision 1.2 2002/01/30 09:22:48 mdw
+ * Use memory-allocation functions provided by the REXX interpreter.
+ * Now that configuration can be applied after initialization, allow
+ * @txconf@ to set parameters. Make @txsend@ add a newline to its output,
+ * unless forbidden.
+ *
-static APIRET APIENTRY rxfn_test(unsigned char *fn, ULONG ac, RXSTRING *av,
- char *sn, RXSTRING *r)
+static APIRET APIENTRY rxfn_test(const char *fn, ULONG ac, RXSTRING *av,
+ const char *sn, RXSTRING *r)
- printf("tx = `%s'; f = `%s'; c = `%s'.", txname, txfile, txconf);
+ printf("tx = `%s'; f = `%s'; c = `%s'.\n", txname, txfile, txconf);
-static APIRET APIENTRY rxfn_txname(unsigned char *fn, ULONG ac, RXSTRING *av,
- char *sn, RXSTRING *r)
+static APIRET APIENTRY rxfn_txname(const char *fn, ULONG ac, RXSTRING *av,
+ const char *sn, RXSTRING *r)
-static APIRET APIENTRY rxfn_txfile(unsigned char *fn, ULONG ac, RXSTRING *av,
- char *sn, RXSTRING *r)
+static APIRET APIENTRY rxfn_txfile(const char *fn, ULONG ac, RXSTRING *av,
+ const char *sn, RXSTRING *r)
-static APIRET APIENTRY rxfn_txconf(unsigned char *fn, ULONG ac, RXSTRING *av,
- char *sn, RXSTRING *r)
+static APIRET APIENTRY rxfn_txconf(const char *fn, ULONG ac, RXSTRING *av,
+ const char *sn, RXSTRING *r)
-static APIRET APIENTRY rxfn_txinit(unsigned char *fn, ULONG ac, RXSTRING *av,
- char *sn, RXSTRING *r)
+static APIRET APIENTRY rxfn_txinit(const char *fn, ULONG ac, RXSTRING *av,
+ const char *sn, RXSTRING *r)
{
const char *n = txname, *f = txfile, *c = txconf;
dstr dn = DSTR_INIT, df = DSTR_INIT, dc = DSTR_INIT;
{
const char *n = txname, *f = txfile, *c = txconf;
dstr dn = DSTR_INIT, df = DSTR_INIT, dc = DSTR_INIT;
-static APIRET APIENTRY rxfn_txsend(unsigned char *fn, ULONG ac, RXSTRING *av,
- char *sn, RXSTRING *r)
+static APIRET APIENTRY rxfn_txsend(const char *fn, ULONG ac, RXSTRING *av,
+ const char *sn, RXSTRING *r)
-static APIRET APIENTRY rxfn_txrecv(unsigned char *fn, ULONG ac, RXSTRING *av,
- char *sn, RXSTRING *r)
+static APIRET APIENTRY rxfn_txrecv(const char *fn, ULONG ac, RXSTRING *av,
+ const char *sn, RXSTRING *r)
-static APIRET APIENTRY rxfn_txeof(unsigned char *fn, ULONG ac,
- RXSTRING *av, char *sn, RXSTRING *r)
+static APIRET APIENTRY rxfn_txeof(const char *fn, ULONG ac, RXSTRING *av,
+ const char *sn, RXSTRING *r)
-static APIRET APIENTRY rxfn_txready(unsigned char *fn, ULONG ac,
- RXSTRING *av, char *sn, RXSTRING *r)
+static APIRET APIENTRY rxfn_txready(const char *fn, ULONG ac, RXSTRING *av,
+ const char *sn, RXSTRING *r)
-static APIRET APIENTRY rxfn_milliwait(unsigned char *fn, ULONG ac,
- RXSTRING *av, char *sn, RXSTRING *r)
+static APIRET APIENTRY rxfn_milliwait(const char *fn, ULONG ac, RXSTRING *av,
+ const char *sn, RXSTRING *r)
- { "test", rxfn_test },
- { "txname", rxfn_txname },
- { "txfile", rxfn_txfile },
- { "txconf", rxfn_txconf },
- { "txinit", rxfn_txinit },
- { "txsend", rxfn_txsend },
- { "txrecv", rxfn_txrecv },
- { "txeof", rxfn_txeof },
- { "txready", rxfn_txready },
- { "milliwait", rxfn_milliwait },
+ { "test", rxfn_test },
+ { "txname", rxfn_txname },
+ { "txfile", rxfn_txfile },
+ { "txconf", rxfn_txconf },
+ { "txinit", rxfn_txinit },
+ { "txsend", rxfn_txsend },
+ { "txrecv", rxfn_txrecv },
+ { "txeof", rxfn_txeof },
+ { "txready", rxfn_txready },
+ { "milliwait", rxfn_milliwait },
name = "incore";
MAKERXSTRING(prog[0], (void *)p, sz);
MAKERXSTRING(prog[1], 0, 0);
name = "incore";
MAKERXSTRING(prog[0], (void *)p, sz);
MAKERXSTRING(prog[1], 0, 0);
for (i = 0; i < ac; i++)
MAKERXSTRING(argv[i], (char *)av[i], strlen(av[i]));
/* --- Run the script --- */
MAKERXSTRING(res, 0, 0);
for (i = 0; i < ac; i++)
MAKERXSTRING(argv[i], (char *)av[i], strlen(av[i]));
/* --- Run the script --- */
MAKERXSTRING(res, 0, 0);
- rc = RexxStart(ac, argv, (char *)name, prog,
- "CMD", RXCOMMAND, 0, &badrc, &res);
+ rc = RexxStart(ac, argv, name, prog,
+ "SYSTEM", RXSUBROUTINE, 0, &badrc, &res);
if (rc < 0)
err_report(ERR_RXERR, 0, -rc, "rexx error from script `%s'", name);
else
if (rc < 0)
err_report(ERR_RXERR, 0, -rc, "rexx error from script `%s'", name);
else
/* --- Pick apart the results --- */
dstr_putm(&d, RXSTRPTR(res), RXSTRLEN(res));
/* --- Pick apart the results --- */
dstr_putm(&d, RXSTRPTR(res), RXSTRLEN(res));