Dethinko.
[p5sagit/p5-mst-13.2.git] / epoc / epoc.c
CommitLineData
ae2d1787 1/*
2 * Copyright (c) 1999 Olaf Flebbe o.flebbe@gmx.de
3 *
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.
6 *
7 */
4d2c4e07 8
9#include <stdlib.h>
ae2d1787 10#include <string.h>
11#include <stdio.h>
12#include <sys/unistd.h>
13
14char *environ = NULL;
15void
16Perl_epoc_init(int *argcp, char ***argvp) {
17 int i;
18 int truecount=0;
19 char **lastcp = (*argvp);
20 char *ptr;
21 for (i=0; i< *argcp; i++) {
22 if ((*argvp)[i]) {
23 if (*((*argvp)[i]) == '<') {
24 if (strlen((*argvp)[i]) > 1) {
25 ptr =((*argvp)[i])+1;
26 } else {
27 i++;
28 ptr = ((*argvp)[i]);
29 }
30 freopen( ptr, "r", stdin);
31 } else if (*((*argvp)[i]) == '>') {
32 if (strlen((*argvp)[i]) > 1) {
33 ptr =((*argvp)[i])+1;
34 } else {
35 i++;
36 ptr = ((*argvp)[i]);
37 }
38 freopen( ptr, "w", stdout);
39 } else if ((*((*argvp)[i]) == '2') && (*(((*argvp)[i])+1) == '>')) {
40 if (strcmp( (*argvp)[i], "2>&1") == 0) {
41 dup2( fileno( stdout), fileno( stderr));
42 } else {
43 if (strlen((*argvp)[i]) > 2) {
44 ptr =((*argvp)[i])+2;
45 } else {
46 i++;
47 ptr = ((*argvp)[i]);
48 }
49 freopen( ptr, "w", stderr);
50 }
51 } else {
52 *lastcp++ = (*argvp)[i];
53 truecount++;
54 }
55 }
56 }
57 *argcp=truecount;
58
4d2c4e07 59
4d2c4e07 60}
61
4d2c4e07 62#ifdef __MARM__
63/* Symbian forgot to include __fixunsdfi into the MARM euser.lib */
64/* This is from libgcc2.c , gcc-2.7.2.3 */
65
66typedef unsigned int UQItype __attribute__ ((mode (QI)));
67typedef int SItype __attribute__ ((mode (SI)));
68typedef unsigned int USItype __attribute__ ((mode (SI)));
69typedef int DItype __attribute__ ((mode (DI)));
70typedef unsigned int UDItype __attribute__ ((mode (DI)));
71
72typedef float SFtype __attribute__ ((mode (SF)));
73typedef float DFtype __attribute__ ((mode (DF)));
74
75
76
77extern DItype __fixunssfdi (SFtype a);
78extern DItype __fixunsdfdi (DFtype a);
79
80
81USItype
82__fixunsdfsi (a)
83 DFtype a;
84{
85 if (a >= - (DFtype) (- 2147483647L -1) )
86 return (SItype) (a + (- 2147483647L -1) ) - (- 2147483647L -1) ;
87 return (SItype) a;
88}
89
90#endif