diff options
author | Olaf Flebbe <o.flebbe@science-computing.de> | 2000-09-21 01:16:26 +0200 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2000-10-03 00:34:59 +0000 |
commit | ed79a026b5aec9cc3f786c2971aa15a4b21f396c (patch) | |
tree | b0e2bf3556083784ba28cbb74402f950712d81d9 /epoc/epoc.c | |
parent | 444155da6cc74bc317db82ecaa4272f5cf6d3c9b (diff) | |
download | perl-ed79a026b5aec9cc3f786c2971aa15a4b21f396c.tar.gz |
Epoc update
Message-ID: <26423.969484586@www10.gmx.net>
p4raw-id: //depot/perl@7124
Diffstat (limited to 'epoc/epoc.c')
-rw-r--r-- | epoc/epoc.c | 66 |
1 files changed, 64 insertions, 2 deletions
diff --git a/epoc/epoc.c b/epoc/epoc.c index 498036dbc0..a2691f3d38 100644 --- a/epoc/epoc.c +++ b/epoc/epoc.c @@ -58,6 +58,7 @@ Perl_epoc_init(int *argcp, char ***argvp) { } + #ifdef __MARM__ /* Symbian forgot to include __fixunsdfi into the MARM euser.lib */ /* This is from libgcc2.c , gcc-2.7.2.3 */ @@ -86,6 +87,8 @@ __fixunsdfsi (a) return (SItype) a; } +#endif + #include "EXTERN.h" #include "perl.h" #include "XSUB.h" @@ -143,5 +146,64 @@ do_spawn (pTHX_ SV *really,SV **mark,SV **sp) return rc; } - -#endif +static +XS(epoc_getcwd) /* more or less stolen from win32.c */ +{ + dXSARGS; + /* Make the host for current directory */ + char *buffer; + int buflen = 256; + + char *ptr; + buffer = (char *) malloc( buflen); + if (buffer == NULL) { + XSRETURN_UNDEF; + } + while ((NULL == ( ptr = getcwd( buffer, buflen))) && (errno == ERANGE)) { + buflen *= 2; + if (NULL == realloc( buffer, buflen)) { + XSRETURN_UNDEF; + } + + } + + /* + * If ptr != Nullch + * then it worked, set PV valid, + * else return 'undef' + */ + + if (ptr) { + SV *sv = sv_newmortal(); + char *tptr; + + for (tptr = ptr; *tptr != '\0'; tptr++) { + if (*tptr == '\\') { + *tptr = '/'; + } + } + sv_setpv(sv, ptr); + free( buffer); + + EXTEND(SP,1); + SvPOK_on(sv); + ST(0) = sv; + XSRETURN(1); + } + free( buffer); + XSRETURN_UNDEF; +} + + +void +Perl_init_os_extras(void) +{ + dTHXo; + char *file = __FILE__; + newXS("EPOC::getcwd", epoc_getcwd, file); +} + +void +Perl_my_setenv(pTHX_ char *nam,char *val) { + setenv( nam, val, 1); +} |