This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Sender: owner-perl5-porters@perl.org
[perl5.git] / epoc / epoc.c
index a7c7e10..d0fae23 100644 (file)
@@ -1,35 +1,64 @@
-/* Epoc helper Routines */
+/*
+ *    Copyright (c) 1999 Olaf Flebbe o.flebbe@gmx.de
+ *    
+ *    You may distribute under the terms of either the GNU General Public
+ *    License or the Artistic License, as specified in the README file.
+ *
+ */
 
 #include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <sys/unistd.h>
+
+char *environ = NULL;
+void
+Perl_epoc_init(int *argcp, char ***argvp) {
+  int i;
+  int truecount=0;
+  char **lastcp = (*argvp);
+  char *ptr;
+  for (i=0; i< *argcp; i++) {
+    if ((*argvp)[i]) {
+      if (*((*argvp)[i]) == '<') {
+       if (strlen((*argvp)[i]) > 1) {
+         ptr =((*argvp)[i])+1;
+       } else {
+         i++;
+         ptr = ((*argvp)[i]);
+       }
+       freopen(  ptr, "r", stdin);
+      } else if (*((*argvp)[i]) == '>') {
+       if (strlen((*argvp)[i]) > 1) {
+         ptr =((*argvp)[i])+1;
+       } else {
+         i++;
+         ptr = ((*argvp)[i]);
+       }
+       freopen(  ptr, "w", stdout);
+      } else if ((*((*argvp)[i]) == '2') && (*(((*argvp)[i])+1) == '>')) {
+       if (strcmp( (*argvp)[i], "2>&1") == 0) {
+         dup2( fileno( stdout), fileno( stderr));
+       } else {
+          if (strlen((*argvp)[i]) > 2) {
+            ptr =((*argvp)[i])+2;
+         } else {
+           i++;
+           ptr = ((*argvp)[i]);
+         }
+         freopen(  ptr, "w", stderr);
+       }
+      } else {
+       *lastcp++ = (*argvp)[i];
+       truecount++;
+      }
+    } 
+  }
+  *argcp=truecount;
+      
 
-int getgid() {return 0;}
-int getegid() {return 0;}
-int geteuid() {return 0;}
-int getuid() {return 0;}
-int setgid() {return -1;}
-int setuid() {return -1;}
-
-
-char *environ;
-
-int Perl_my_popen( int a, int b) {
-        return 0;
-}
-int Perl_my_pclose( int a) {
-        return 0;
 }
 
-kill() {}
-signal() {}
-
-void execv() {}
-void execvp() {}
-
-
-void do_spawn() {}
-void do_aspawn() {}
-void Perl_do_exec() {}
-
 #ifdef __MARM__
 /* Symbian forgot to include __fixunsdfi into the MARM euser.lib */
 /* This is from libgcc2.c , gcc-2.7.2.3                          */