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];
63 /* Symbian forgot to include __fixunsdfi into the MARM euser.lib */
64 /* This is from libgcc2.c , gcc-2.7.2.3 */
66 typedef unsigned int UQItype __attribute__ ((mode (QI)));
67 typedef int SItype __attribute__ ((mode (SI)));
68 typedef unsigned int USItype __attribute__ ((mode (SI)));
69 typedef int DItype __attribute__ ((mode (DI)));
70 typedef unsigned int UDItype __attribute__ ((mode (DI)));
72 typedef float SFtype __attribute__ ((mode (SF)));
73 typedef float DFtype __attribute__ ((mode (DF)));
77 extern DItype __fixunssfdi (SFtype a);
78 extern DItype __fixunsdfdi (DFtype a);
85 if (a >= - (DFtype) (- 2147483647L -1) )
86 return (SItype) (a + (- 2147483647L -1) ) - (- 2147483647L -1) ;
97 do_aspawn( pTHX_ SV *really,SV **mark,SV **sp) {
98 return do_spawn( really, mark, sp);
102 do_spawn (pTHX_ SV *really,SV **mark,SV **sp)
105 char **a,*cmd,**ptr, *cmdline, **argv, *p2;
112 a=argv=ptr=(char**) malloc ((sp-mark+3)*sizeof (char*));
114 while (++mark <= sp) {
116 *a = SvPVx(*mark, n_a);
119 len += strlen( *a) + 1;
124 if (!(really && *(cmd = SvPV(really, n_a)))) {
129 cmdline = (char * ) malloc( len + 1);
131 while (*argv != NULL) {
132 strcat( cmdline, *argv++);
133 strcat( cmdline, " ");
136 for (p2=cmd; *p2 != '\0'; p2++) {
141 rc = epoc_spawn( cmd, cmdline);
149 XS(epoc_getcwd) /* more or less stolen from win32.c */
152 /* Make the host for current directory */
157 buffer = (char *) malloc( buflen);
158 if (buffer == NULL) {
161 while ((NULL == ( ptr = getcwd( buffer, buflen))) && (errno == ERANGE)) {
163 if (NULL == realloc( buffer, buflen)) {
171 * then it worked, set PV valid,
172 * else return 'undef'
176 SV *sv = sv_newmortal();
179 for (tptr = ptr; *tptr != '\0'; tptr++) {
198 Perl_init_os_extras(void)
201 char *file = __FILE__;
202 newXS("EPOC::getcwd", epoc_getcwd, file);
206 Perl_my_setenv(pTHX_ char *nam,char *val) {
207 setenv( nam, val, 1);