summaryrefslogtreecommitdiff
path: root/NetWare/nw5.c
diff options
context:
space:
mode:
Diffstat (limited to 'NetWare/nw5.c')
-rw-r--r--NetWare/nw5.c65
1 files changed, 64 insertions, 1 deletions
diff --git a/NetWare/nw5.c b/NetWare/nw5.c
index 44bb853802..5dd8927649 100644
--- a/NetWare/nw5.c
+++ b/NetWare/nw5.c
@@ -879,7 +879,70 @@ do_aspawn(void *vreally, void **vmark, void **vsp)
// This feature needs to be implemented.
// _asm is commented out since it goes into the internal debugger.
// _asm {int 3};
- return(0);
+//// return(0);
+
+
+ // This below code is required for system() call.
+ // Otherwise system() does not work on NetWare.
+ // Ananth, 3 Sept 2001
+
+ dTHX;
+ SV *really = (SV*)vreally;
+ SV **mark = (SV**)vmark;
+ SV **sp = (SV**)vsp;
+ char **argv;
+ char *str;
+ int status;
+ int flag = P_WAIT;
+ int index = 0;
+
+
+ if (sp <= mark)
+ return -1;
+
+ nw_perlshell_items = 0; // No Shell
+ New(1306, argv, (sp - mark) + nw_perlshell_items + 3, char*);
+
+ if (SvNIOKp(*(mark+1)) && !SvPOKp(*(mark+1))) {
+ ++mark;
+ flag = SvIVx(*mark);
+ }
+
+ while (++mark <= sp) {
+ if (*mark && (str = (char *)SvPV_nolen(*mark)))
+ {
+ argv[index] = str;
+ index++;
+ }
+ else
+ {
+ argv[index] = "";
+// argv[index] = '\0';
+ index++;
+ }
+ }
+ argv[index] = '\0';
+ index++;
+
+ status = nw_spawnvp(flag,
+ (char*)(really ? SvPV_nolen(really) : argv[0]),
+ (char**)argv);
+
+
+ if (flag != P_NOWAIT) {
+ if (status < 0) {
+ dTHR;
+ if (ckWARN(WARN_EXEC))
+ Perl_warner(aTHX_ WARN_EXEC, "Can't spawn \"%s\": %s", argv[0], strerror(errno));
+ status = 255 * 256;
+ }
+ else
+ status *= 256;
+ PL_statusvalue = status;
+ }
+
+ Safefree(argv);
+ return (status);
}
int