2 * Copyright (c) 1999 Olaf Flebbe o.flebbe@gmx.de
4 * You may distribute under the terms of either the GNU General Public
5 * License or the Artistic License, as specified in the README file.
12 #include <sys/unistd.h>
15 Perl_epoc_init(int *argcp, char ***argvp) {
18 char **lastcp = (*argvp);
20 for (i=0; i< *argcp; i++) {
22 if (*((*argvp)[i]) == '<') {
23 if (strlen((*argvp)[i]) > 1) {
29 freopen( ptr, "r", stdin);
30 } else if (*((*argvp)[i]) == '>') {
31 if (strlen((*argvp)[i]) > 1) {
37 freopen( ptr, "w", stdout);
38 } else if ((*((*argvp)[i]) == '2') && (*(((*argvp)[i])+1) == '>')) {
39 if (strcmp( (*argvp)[i], "2>&1") == 0) {
40 dup2( fileno( stdout), fileno( stderr));
42 if (strlen((*argvp)[i]) > 2) {
48 freopen( ptr, "w", stderr);
51 *lastcp++ = (*argvp)[i];
62 /* Symbian forgot to include __fixunsdfi into the MARM euser.lib */
63 /* This is from libgcc2.c , gcc-2.7.2.3 */
65 typedef unsigned int UQItype __attribute__ ((mode (QI)));
66 typedef int SItype __attribute__ ((mode (SI)));
67 typedef unsigned int USItype __attribute__ ((mode (SI)));
68 typedef int DItype __attribute__ ((mode (DI)));
69 typedef unsigned int UDItype __attribute__ ((mode (DI)));
71 typedef float SFtype __attribute__ ((mode (SF)));
72 typedef float DFtype __attribute__ ((mode (DF)));
76 extern DItype __fixunssfdi (SFtype a);
77 extern DItype __fixunsdfdi (DFtype a);
84 if (a >= - (DFtype) (- 2147483647L -1) )
85 return (SItype) (a + (- 2147483647L -1) ) - (- 2147483647L -1) ;
94 do_aspawn( pTHX_ SV *really,SV **mark,SV **sp) {
95 return do_spawn( really, mark, sp);
99 do_spawn (pTHX_ SV *really,SV **mark,SV **sp)
103 char **a,*cmd,**ptr, *cmdline, **argv, *p2;
110 a=argv=ptr=(char**) malloc ((sp-mark+3)*sizeof (char*));
112 while (++mark <= sp) {
114 *a = SvPVx(*mark, n_a);
117 len += strlen( *a) + 1;
122 if (!(really && *(cmd = SvPV(really, n_a)))) {
127 cmdline = (char * ) malloc( len + 1);
129 while (*argv != NULL) {
130 strcat( cmdline, *argv++);
131 strcat( cmdline, " ");
134 for (p2=cmd; *p2 != '\0'; p2++) {
139 rc = epoc_spawn( cmd, cmdline);