diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1998-01-30 08:54:19 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-01-30 08:54:19 +0000 |
commit | 6ad3d225cec2692b410002582f5558652eea32c8 (patch) | |
tree | a75531c0d01d25dcc35d8b3eca5857b3fc4e34fd /util.c | |
parent | e7152ba2733b9227708ca768b222144415c13c66 (diff) | |
download | perl-6ad3d225cec2692b410002582f5558652eea32c8.tar.gz |
[asperl] Created new branch from win32@396, added AS patch#1
p4raw-link: @396 on //depot/win32/perl: e7152ba2733b9227708ca768b222144415c13c66
p4raw-id: //depot/asperl@441
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 72 |
1 files changed, 36 insertions, 36 deletions
@@ -84,7 +84,7 @@ safemalloc(MEM_SIZE size) if ((long)size < 0) croak("panic: malloc"); #endif - ptr = malloc(size?size:1); /* malloc(0) is NASTY on our system */ + ptr = PerlMem_malloc(size?size:1); /* malloc(0) is NASTY on our system */ #if !(defined(I286) || defined(atarist)) DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%x: (%05d) malloc %ld bytes\n",ptr,an++,(long)size)); #else @@ -109,7 +109,7 @@ saferealloc(Malloc_t where,MEM_SIZE size) { Malloc_t ptr; #if !defined(STANDARD_C) && !defined(HAS_REALLOC_PROTOTYPE) - Malloc_t realloc(); + Malloc_t PerlMem_realloc(); #endif /* !defined(STANDARD_C) && !defined(HAS_REALLOC_PROTOTYPE) */ #ifdef HAS_64K_LIMIT @@ -125,7 +125,7 @@ saferealloc(Malloc_t where,MEM_SIZE size) if ((long)size < 0) croak("panic: realloc"); #endif - ptr = realloc(where,size?size:1); /* realloc(0) is NASTY on our system */ + ptr = PerlMem_realloc(where,size?size:1); /* realloc(0) is NASTY on our system */ #if !(defined(I286) || defined(atarist)) DEBUG_m( { @@ -163,7 +163,7 @@ safefree(Malloc_t where) #endif if (where) { /*SUPPRESS 701*/ - free(where); + PerlMem_free(where); } } @@ -186,7 +186,7 @@ safecalloc(MEM_SIZE count, MEM_SIZE size) croak("panic: calloc"); #endif size *= count; - ptr = malloc(size?size:1); /* malloc(0) is NASTY on our system */ + ptr = PerlMem_malloc(size?size:1); /* malloc(0) is NASTY on our system */ #if !(defined(I286) || defined(atarist)) DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%x: (%05d) calloc %ld x %ld bytes\n",ptr,an++,(long)count,(long)size)); #else @@ -536,8 +536,8 @@ perl_init_i18nl10n(int printwarn) #ifdef USE_LOCALE_NUMERIC char *curnum = NULL; #endif /* USE_LOCALE_NUMERIC */ - char *lc_all = getenv("LC_ALL"); - char *lang = getenv("LANG"); + char *lc_all = PerlENV_getenv("LC_ALL"); + char *lang = PerlENV_getenv("LANG"); bool setlocale_failure = FALSE; #ifdef LOCALE_ENVIRON_REQUIRED @@ -561,19 +561,19 @@ perl_init_i18nl10n(int printwarn) { #ifdef USE_LOCALE_CTYPE if (! (curctype = setlocale(LC_CTYPE, - (!done && (lang || getenv("LC_CTYPE"))) + (!done && (lang || PerlENV_getenv("LC_CTYPE"))) ? "" : Nullch))) setlocale_failure = TRUE; #endif /* USE_LOCALE_CTYPE */ #ifdef USE_LOCALE_COLLATE if (! (curcoll = setlocale(LC_COLLATE, - (!done && (lang || getenv("LC_COLLATE"))) + (!done && (lang || PerlENV_getenv("LC_COLLATE"))) ? "" : Nullch))) setlocale_failure = TRUE; #endif /* USE_LOCALE_COLLATE */ #ifdef USE_LOCALE_NUMERIC if (! (curnum = setlocale(LC_NUMERIC, - (!done && (lang || getenv("LC_NUMERIC"))) + (!done && (lang || PerlENV_getenv("LC_NUMERIC"))) ? "" : Nullch))) setlocale_failure = TRUE; #endif /* USE_LOCALE_NUMERIC */ @@ -620,7 +620,7 @@ perl_init_i18nl10n(int printwarn) char *p; bool locwarn = (printwarn > 1 || printwarn && - (!(p = getenv("PERL_BADLANG")) || atoi(p))); + (!(p = PerlENV_getenv("PERL_BADLANG")) || atoi(p))); if (locwarn) { #ifdef LC_ALL @@ -1455,7 +1455,7 @@ my_setenv(char *nam,char *val) vallen = strlen(val); New(904, envstr, namlen + vallen + 3, char); (void)sprintf(envstr,"%s=%s",nam,val); - (void)putenv(envstr); + (void)PerlENV_putenv(envstr); if (oldstr) Safefree(oldstr); #ifdef _MSC_VER @@ -1512,7 +1512,7 @@ char *f; { I32 i; - for (i = 0; unlink(f) >= 0; i++) ; + for (i = 0; PerlLIO_unlink(f) >= 0; i++) ; return i ? 0 : -1; } #endif @@ -1784,7 +1784,7 @@ my_popen(char *cmd, char *mode) return my_syspopen(cmd,mode); } #endif - if (pipe(p) < 0) + if (PerlProc_pipe(p) < 0) return Nullfp; This = (*mode == 'w'); that = !This; @@ -1794,7 +1794,7 @@ my_popen(char *cmd, char *mode) } while ((pid = (doexec?vfork():fork())) < 0) { if (errno != EAGAIN) { - close(p[This]); + PerlLIO_close(p[This]); if (!doexec) croak("Can't fork"); return Nullfp; @@ -1806,10 +1806,10 @@ my_popen(char *cmd, char *mode) #define THIS that #define THAT This - close(p[THAT]); + PerlLIO_close(p[THAT]); if (p[THIS] != (*mode == 'r')) { - dup2(p[THIS], *mode == 'r'); - close(p[THIS]); + PerlLIO_dup2(p[THIS], *mode == 'r'); + PerlLIO_close(p[THIS]); } if (doexec) { #if !defined(HAS_FCNTL) || !defined(F_SETFD) @@ -1819,10 +1819,10 @@ my_popen(char *cmd, char *mode) #define NOFILE 20 #endif for (fd = maxsysfd + 1; fd < NOFILE; fd++) - close(fd); + PerlLIO_close(fd); #endif do_exec(cmd); /* may or may not use the shell */ - _exit(1); + PerlProc__exit(1); } /*SUPPRESS 560*/ if (tmpgv = gv_fetchpv("$",TRUE, SVt_PV)) @@ -1834,10 +1834,10 @@ my_popen(char *cmd, char *mode) #undef THAT } do_execfree(); /* free any memory malloced by child on vfork */ - close(p[that]); + PerlLIO_close(p[that]); if (p[that] < p[This]) { - dup2(p[This], p[that]); - close(p[This]); + PerlLIO_dup2(p[This], p[that]); + PerlLIO_close(p[This]); p[This] = p[that]; } sv = *av_fetch(fdpid,p[This],TRUE); @@ -1871,7 +1871,7 @@ char *s; PerlIO_printf(PerlIO_stderr(),"%s", s); for (fd = 0; fd < 32; fd++) { - if (Fstat(fd,&tmpstatbuf) >= 0) + if (PerlLIO_fstat(fd,&tmpstatbuf) >= 0) PerlIO_printf(PerlIO_stderr()," %d",fd); } PerlIO_printf(PerlIO_stderr(),"\n"); @@ -1887,7 +1887,7 @@ int newfd; #if defined(HAS_FCNTL) && defined(F_DUPFD) if (oldfd == newfd) return oldfd; - close(newfd); + PerlLIO_close(newfd); return fcntl(oldfd, F_DUPFD, newfd); #else #define DUP2_MAX_FDS 256 @@ -1897,18 +1897,18 @@ int newfd; if (oldfd == newfd) return oldfd; - close(newfd); + PerlLIO_close(newfd); /* good enough for low fd's... */ - while ((fd = dup(oldfd)) != newfd && fd >= 0) { + while ((fd = PerlLIO_dup(oldfd)) != newfd && fd >= 0) { if (fdx >= DUP2_MAX_FDS) { - close(fd); + PerlLIO_close(fd); fd = -1; break; } fdtmp[fdx++] = fd; } while (fdx > 0) - close(fdtmp[--fdx]); + PerlLIO_close(fdtmp[--fdx]); return fd; #endif } @@ -1970,7 +1970,7 @@ rsignal_restore(int signo, Sigsave_t *save) Sighandler_t rsignal(int signo, Sighandler_t handler) { - return signal(signo, handler); + return PerlProc_signal(signo, handler); } static int sig_trapped; @@ -1988,24 +1988,24 @@ rsignal_state(int signo) Sighandler_t oldsig; sig_trapped = 0; - oldsig = signal(signo, sig_trap); - signal(signo, oldsig); + oldsig = PerlProc_signal(signo, sig_trap); + PerlProc_signal(signo, oldsig); if (sig_trapped) - kill(getpid(), signo); + PerlProc_kill(getpid(), signo); return oldsig; } int rsignal_save(int signo, Sighandler_t handler, Sigsave_t *save) { - *save = signal(signo, handler); + *save = PerlProc_signal(signo, handler); return (*save == SIG_ERR) ? -1 : 0; } int rsignal_restore(int signo, Sigsave_t *save) { - return (signal(signo, *save) == SIG_ERR) ? -1 : 0; + return (PerlProc_signal(signo, *save) == SIG_ERR) ? -1 : 0; } #endif /* !HAS_SIGACTION */ @@ -2047,7 +2047,7 @@ my_pclose(FILE *ptr) #endif } #ifdef UTS - if(kill(pid, 0) < 0) { return(pid); } /* HOM 12/23/91 */ + if(PerlProc_kill(pid, 0) < 0) { return(pid); } /* HOM 12/23/91 */ #endif rsignal_save(SIGHUP, SIG_IGN, &hstat); rsignal_save(SIGINT, SIG_IGN, &istat); |