diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1998-03-07 07:51:28 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-03-07 07:51:28 +0000 |
commit | 3bd495df69b982704c59fc1ecbed71e5112e7da0 (patch) | |
tree | 47303adb4596ab4c7c0b981f50c0a72d52092338 /win32 | |
parent | fe9f1ed50ae7ad31787549184f98f0a71eda0191 (diff) | |
parent | 1d16519d77cbada019f865cb923236cd48a23c72 (diff) | |
download | perl-3bd495df69b982704c59fc1ecbed71e5112e7da0.tar.gz |
[win32] integrate mainline changes
p4raw-id: //depot/asperl@799
Diffstat (limited to 'win32')
-rw-r--r-- | win32/Makefile | 6 | ||||
-rw-r--r-- | win32/config.bc | 107 | ||||
-rw-r--r-- | win32/config.gc | 109 | ||||
-rw-r--r-- | win32/config.vc | 107 | ||||
-rw-r--r-- | win32/config_H.bc | 85 | ||||
-rw-r--r-- | win32/config_H.gc | 85 | ||||
-rw-r--r-- | win32/config_H.vc | 85 | ||||
-rw-r--r-- | win32/config_h.PL | 1 | ||||
-rw-r--r-- | win32/makefile.mk | 2 | ||||
-rw-r--r-- | win32/win32.c | 165 |
10 files changed, 563 insertions, 189 deletions
diff --git a/win32/Makefile b/win32/Makefile index 9431745331..9acbb5493a 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -22,11 +22,11 @@ INST_TOP=$(INST_DRV)\perl5004.5x # # uncomment next line if you want to use the perl object -#OBJECT=-DPERL_OBJECT +OBJECT=-DPERL_OBJECT # # uncomment next line if you want debug version of perl (big,slow) -#CFG=Debug +CFG=Debug # # if you have the source for des_fcrypt(), uncomment this and make sure the @@ -43,7 +43,7 @@ INST_TOP=$(INST_DRV)\perl5004.5x # WARNING: Turning this on/off WILL break binary compatibility with extensions # you may have compiled with/without it. Be prepared to recompile all extensions # if you change the default. -PERL_MALLOC *= define +PERL_MALLOC = define # # set the install locations of the compiler include/libraries diff --git a/win32/config.bc b/win32/config.bc index de7a337a33..365c5dea45 100644 --- a/win32/config.bc +++ b/win32/config.bc @@ -1,31 +1,5 @@ -# -## This file was hand coded and a lot of information is invalid -# ## Configured by: ~cf_email~ ## Target system: WIN32 -# - -archlibexp='~INST_TOP~\lib\~archname~' -archname='MSWin32' -cc='bcc32' -ccflags='-DWIN32' -cppflags='-DWIN32' -dlsrc='dl_win32.xs' -dynamic_ext='Socket IO Fcntl Opcode SDBM_File attrs Thread' -extensions='~static_ext~ ~dynamic_ext~' -installarchlib='~INST_TOP~\lib\~archname~' -installprivlib='~INST_TOP~\lib' -libpth='' -libs='' -osname='MSWin32' -osvers='4.0' -prefix='~INST_DRV~' -privlibexp='~INST_TOP~\lib' -sharpbang='#!' -shsharp='true' -so='dll' -startsh='#!/bin/sh' -static_ext='DynaLoader' Author='' CONFIG='true' Date='$Date' @@ -35,22 +9,27 @@ Locker='' Log='$Log' Mcc='Mcc' PATCHLEVEL='~PATCHLEVEL~' -POSIX_cflags='ccflags="$ccflags -DSTRUCT_TM_HASZONE"' RCSfile='$RCSfile' Revision='$Revision' SUBVERSION='~SUBVERSION~' Source='' State='' +_a='.lib' +_exe='.exe' +_o='.obj' afs='false' alignbytes='8' aphostname='' ar='tlib /P128' archlib='~INST_TOP~\lib\~archname~' +archlibexp='~INST_TOP~\lib\~archname~' +archname='MSWin32' archobjs='' awk='awk' baserev='5.0' bash='' bin='~INST_TOP~\bin' +bincompat3='' binexp='~INST_TOP~\bin' bison='' byacc='byacc' @@ -58,8 +37,10 @@ byteorder='1234' c='' castflags='0' cat='type' +cc='bcc32' cccdlflags=' ' ccdlflags='-tWD' +ccflags='-DWIN32' cf_by='nobody' cf_email='nobody@no.where.net' cf_time='' @@ -74,6 +55,7 @@ cp='copy' cpio='' cpp='cpp32' cpp_stuff='42' +cppflags='-DWIN32' cpplast='' cppminus='' cpprun='' @@ -90,7 +72,6 @@ d_bcopy='undef' d_bincompat3='undef' d_bsd='define' d_bsdgetpgrp='undef' -d_bsdpgrp='undef' d_bsdsetpgrp='undef' d_bzero='undef' d_casti32='define' @@ -126,24 +107,26 @@ d_flock='define' d_fork='undef' d_fpathconf='undef' d_fsetpos='define' +d_ftime='define' d_getgrps='undef' -d_setgrps='undef' -d_gethent='undef' d_gethbyaddr='define' d_gethbyname='define' +d_gethent='undef' +d_gethname='define' +d_getlogin='define' d_getnbyaddr='undef' d_getnbyname='undef' d_getpbyname='define' d_getpbynumber='define' -d_getsbyname='define' -d_getsbyport='define' -d_getlogin='define' +d_getpgid='undef' d_getpgrp2='undef' d_getpgrp='undef' -d_getpgid='undef' d_getppid='undef' d_getprior='undef' +d_getsbyname='define' +d_getsbyport='define' d_gettimeod='undef' +d_gnulibc='undef' d_htonl='define' d_index='undef' d_inetaton='undef' @@ -170,7 +153,7 @@ d_msgrcv='define' d_msgsnd='define' d_mymalloc='define' d_nice='undef' -d_oldarchlib='undef' +d_oldpthreads='undef' d_oldsock='undef' d_open3='undef' d_pathconf='undef' @@ -179,6 +162,8 @@ d_phostname='undef' d_pipe='define' d_poll='undef' d_portable='define' +d_pthread_yield='undef' +d_pthreads_created_joinable='undef' d_pwage='undef' d_pwchange='undef' d_pwclass='undef' @@ -193,6 +178,7 @@ d_rmdir='define' d_safebcpy='undef' d_safemcpy='undef' d_sanemcmp='define' +d_sched_yield='undef' d_seekdir='define' d_select='define' d_sem='undef' @@ -201,6 +187,8 @@ d_semget='define' d_semop='define' d_setegid='undef' d_seteuid='undef' +d_setgrps='undef' +d_sethent='undef' d_setlinebuf='undef' d_setlocale='define' d_setpgid='undef' @@ -221,12 +209,8 @@ d_shmatprototype='undef' d_shmctl='define' d_shmdt='define' d_shmget='define' -d_shrplib='undef' d_sigaction='undef' -d_sigintrp='' d_sigsetjmp='undef' -d_sigvec='define' -d_sigvectr='undef' d_socket='define' d_sockpair='undef' d_statblks='undef' @@ -276,6 +260,9 @@ db_prefixtype='int' defvoidused='15' direntrytype='struct direct' dlext='dll' +dlsrc='dl_win32.xs' +doublesize='8' +dynamic_ext='Socket IO Fcntl Opcode SDBM_File attrs Thread' eagain='EAGAIN' echo='echo' egrep='egrep' @@ -283,6 +270,7 @@ emacs='' eunicefix=':' exe_ext='.exe' expr='expr' +extensions='~static_ext~ ~dynamic_ext~' find='find' firstmakefile='makefile' flex='' @@ -292,15 +280,12 @@ full_csh='' full_sed='' gcc='' gccversion='' -netdb_host_type='char *' -netdb_hlen_type='int' -netdb_name_type='char *' -netdb_net_type='long' gidtype='gid_t' glibpth='/usr/shlib /lib/pa1.1 /usr/lib/large /lib /usr/lib /usr/lib/386 /lib/386 /lib/large /usr/lib/small /lib/small /usr/ccs/lib /usr/ucblib /usr/shlib ' grep='grep' groupcat='' groupstype='gid_t' +gzip='gzip' h_fcntl='false' h_sysfile='true' hint='recommended' @@ -322,6 +307,7 @@ i_malloc='define' i_math='define' i_memory='undef' i_ndbm='undef' +i_netdb='undef' i_neterrno='undef' i_niin='undef' i_pwd='undef' @@ -360,9 +346,11 @@ i_varhdr='varargs.h' i_vfork='undef' incpath='' inews='' +installarchlib='~INST_TOP~\lib\~archname~' installbin='~INST_TOP~\bin' installman1dir='~INST_TOP~\man\man1' installman3dir='~INST_TOP~\man\man3' +installprivlib='~INST_TOP~\lib' installscript='~INST_TOP~\bin' installsitearch='~INST_TOP~\lib\site\~archname~' installsitelib='~INST_TOP~\lib\site' @@ -377,6 +365,8 @@ less='less' lib_ext='.lib' libc='cw32mti.lib' libperl='perl.lib' +libpth='' +libs='' libswanted='net socket inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun m c cposix posix ndir dir crypt ucb bsd BSD PW x' line='line' lint='' @@ -393,6 +383,7 @@ lseektype='off_t' mail='' mailx='' make='dmake' +make_set_make='#' mallocobj='malloc.o' mallocsrc='malloc.c' malloctype='void *' @@ -415,15 +406,20 @@ mydomain='' myhostname='' myuname='' n='-n' +netdb_hlen_type='int' +netdb_host_type='char *' +netdb_name_type='char *' +netdb_net_type='long' +nm='' nm_opt='' nm_so_opt='' nroff='' o_nonblock='O_NONBLOCK' obj_ext='.obj' -oldarchlib='' -oldarchlibexp='' optimize='-O2' orderlib='false' +osname='MSWin32' +osvers='4.0' package='perl5' pager='more /e' passcat='' @@ -438,9 +434,12 @@ pidtype='int' plibpth='' pmake='' pr='' +prefix='~INST_DRV~' prefixexp='~INST_DRV~' privlib='~INST_TOP~\lib' +privlibexp='~INST_TOP~\lib' prototype='define' +ptrsize='4' randbits='15' ranlib='rem' rd_nodata='-1' @@ -454,9 +453,11 @@ selecttype='Perl_fd_set *' sendmail='blat' sh='cmd /x /c' shar='' +sharpbang='#!' shmattype='void *' shortsize='2' -shrpdir='none' +shrpenv='' +shsharp='true' sig_name='ZERO INT ILL FPE SEGV TERM USR1 USR2 USR3 BREAK ABRT' sig_name_init='"ZERO", "INT", "ILL", "FPE", "SEGV", "TERM", "USR1", "USR2", "USR3", "BREAK", "ABRT", 0' sig_num='0, 2, 4, 8, 11, 15, 16, 17, 20, 21, 22, 0' @@ -469,25 +470,32 @@ sizetype='size_t' sleep='' smail='' small='' +so='dll' sockethdr='' socketlib='' sort='sort' spackage='Perl5' spitshell='' split='' +src='' ssizetype='int' startperl='#!perl' +startsh='#!/bin/sh' +static_ext='DynaLoader' stdchar='unsigned char' stdio_base='((fp)->buffer)' stdio_bufsiz='((fp)->level + (fp)->curp - (fp)->buffer)' stdio_cnt='((fp)->level)' +stdio_filbuf='' stdio_ptr='((fp)->curp)' strings='/usr/include/string.h' submit='' +subversion='~SUBVERSION~' sysman='/usr/man/man1' tail='' tar='' tbl='' +tee='' test='' timeincl='/usr/include/sys/time.h ' timetype='time_t' @@ -500,9 +508,11 @@ uniq='uniq' usedl='define' usemymalloc='n' usenm='false' +useopcode='true' useperlio='undef' -useposix='true' -usesafe='true' +useposix='false' +usesfio='false' +useshrplib='yes' usethreads='undef' usevfork='false' usrinc='/usr/include' @@ -511,3 +521,4 @@ vi='' voidflags='15' xlibpth='/usr/lib/386 /lib/386' zcat='' +zip='zip' diff --git a/win32/config.gc b/win32/config.gc index 310586f432..0bf2718e1a 100644 --- a/win32/config.gc +++ b/win32/config.gc @@ -1,31 +1,5 @@ -# -## This file was hand coded and a lot of information is invalid -# ## Configured by: ~cf_email~ ## Target system: WIN32 -# - -archlibexp='~INST_TOP~\lib\~archname~' -archname='MSWin32' -cc='gcc' -ccflags='-DWIN32' -cppflags='-DWIN32' -dlsrc='dl_win32.xs' -dynamic_ext='Socket IO Fcntl Opcode SDBM_File attrs Thread' -extensions='~static_ext~ ~dynamic_ext~' -installarchlib='~INST_TOP~\lib\~archname~' -installprivlib='~INST_TOP~\lib' -libpth='' -libs=' ' -osname='MSWin32' -osvers='4.0' -prefix='~INST_DRV~' -privlibexp='~INST_TOP~\lib' -sharpbang='#!' -shsharp='true' -so='dll' -startsh='#!/bin/sh' -static_ext='DynaLoader' Author='' CONFIG='true' Date='$Date' @@ -35,22 +9,27 @@ Locker='' Log='$Log' Mcc='Mcc' PATCHLEVEL='~PATCHLEVEL~' -POSIX_cflags='ccflags="$ccflags -DSTRUCT_TM_HASZONE"' RCSfile='$RCSfile' Revision='$Revision' SUBVERSION='~SUBVERSION~' Source='' State='' +_a='.lib' +_exe='.exe' +_o='.obj' afs='false' alignbytes='8' aphostname='' ar='ar' archlib='~INST_TOP~\lib\~archname~' +archlibexp='~INST_TOP~\lib\~archname~' +archname='MSWin32' archobjs='' awk='awk' baserev='5.0' bash='' bin='~INST_TOP~\bin' +bincompat3='' binexp='~INST_TOP~\bin' bison='' byacc='byacc' @@ -58,8 +37,10 @@ byteorder='1234' c='' castflags='0' cat='type' +cc='gcc' cccdlflags=' ' ccdlflags=' ' +ccflags='-MD -DWIN32' cf_by='nobody' cf_email='nobody@no.where.net' cf_time='' @@ -74,6 +55,7 @@ cp='copy' cpio='' cpp='cpp' cpp_stuff='42' +cppflags='-DWIN32' cpplast='' cppminus='-' cpprun='gcc -E' @@ -90,7 +72,6 @@ d_bcopy='undef' d_bincompat3='undef' d_bsd='define' d_bsdgetpgrp='undef' -d_bsdpgrp='undef' d_bsdsetpgrp='undef' d_bzero='undef' d_casti32='define' @@ -126,24 +107,26 @@ d_flock='define' d_fork='undef' d_fpathconf='undef' d_fsetpos='define' +d_ftime='define' d_getgrps='undef' -d_setgrps='undef' -d_gethent='undef' d_gethbyaddr='define' d_gethbyname='define' +d_gethent='undef' +d_gethname='define' +d_getlogin='define' d_getnbyaddr='undef' d_getnbyname='undef' d_getpbyname='define' d_getpbynumber='define' -d_getsbyname='define' -d_getsbyport='define' -d_getlogin='define' +d_getpgid='undef' d_getpgrp2='undef' d_getpgrp='undef' -d_getpgid='undef' d_getppid='undef' d_getprior='undef' +d_getsbyname='define' +d_getsbyport='define' d_gettimeod='undef' +d_gnulibc='undef' d_htonl='define' d_index='undef' d_inetaton='undef' @@ -170,7 +153,7 @@ d_msgrcv='define' d_msgsnd='define' d_mymalloc='define' d_nice='undef' -d_oldarchlib='undef' +d_oldpthreads='undef' d_oldsock='undef' d_open3='undef' d_pathconf='undef' @@ -179,6 +162,8 @@ d_phostname='undef' d_pipe='define' d_poll='undef' d_portable='define' +d_pthread_yield='undef' +d_pthreads_created_joinable='undef' d_pwage='undef' d_pwchange='undef' d_pwclass='undef' @@ -193,6 +178,7 @@ d_rmdir='define' d_safebcpy='undef' d_safemcpy='undef' d_sanemcmp='define' +d_sched_yield='undef' d_seekdir='define' d_select='define' d_sem='undef' @@ -201,6 +187,8 @@ d_semget='define' d_semop='define' d_setegid='undef' d_seteuid='undef' +d_setgrps='undef' +d_sethent='undef' d_setlinebuf='undef' d_setlocale='define' d_setpgid='undef' @@ -221,12 +209,8 @@ d_shmatprototype='undef' d_shmctl='define' d_shmdt='define' d_shmget='define' -d_shrplib='undef' d_sigaction='undef' -d_sigintrp='' d_sigsetjmp='undef' -d_sigvec='define' -d_sigvectr='undef' d_socket='define' d_sockpair='undef' d_statblks='undef' @@ -276,6 +260,9 @@ db_prefixtype='int' defvoidused='15' direntrytype='struct direct' dlext='dll' +dlsrc='dl_win32.xs' +doublesize='8' +dynamic_ext='Socket IO Fcntl Opcode SDBM_File attrs Thread' eagain='EAGAIN' echo='echo' egrep='egrep' @@ -283,6 +270,7 @@ emacs='' eunicefix=':' exe_ext='.exe' expr='expr' +extensions='~static_ext~ ~dynamic_ext~' find='find' firstmakefile='makefile' flex='' @@ -292,15 +280,12 @@ full_csh='' full_sed='' gcc='' gccversion='' -netdb_host_type='char *' -netdb_hlen_type='int' -netdb_name_type='char *' -netdb_net_type='long' gidtype='gid_t' glibpth='/usr/shlib /lib/pa1.1 /usr/lib/large /lib /usr/lib /usr/lib/386 /lib/386 /lib/large /usr/lib/small /lib/small /usr/ccs/lib /usr/ucblib /usr/shlib ' grep='grep' groupcat='' groupstype='gid_t' +gzip='gzip' h_fcntl='false' h_sysfile='true' hint='recommended' @@ -322,6 +307,7 @@ i_malloc='define' i_math='define' i_memory='undef' i_ndbm='undef' +i_netdb='undef' i_neterrno='undef' i_niin='undef' i_pwd='undef' @@ -360,9 +346,11 @@ i_varhdr='varargs.h' i_vfork='undef' incpath='' inews='' +installarchlib='~INST_TOP~\lib\~archname~' installbin='~INST_TOP~\bin' installman1dir='~INST_TOP~\man\man1' installman3dir='~INST_TOP~\man\man3' +installprivlib='~INST_TOP~\lib' installscript='~INST_TOP~\bin' installsitearch='~INST_TOP~\lib\site\~archname~' installsitelib='~INST_TOP~\lib\site' @@ -377,10 +365,12 @@ less='less' lib_ext='.lib' libc='msvcrt.lib' libperl='libperl.a' +libpth='' +libs='' libswanted='net socket inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun m c cposix posix ndir dir crypt ucb bsd BSD PW x' line='line' lint='' -lkflags=' ' +lkflags='' ln='' lns='copy' locincpth='/usr/local/include /opt/local/include /usr/gnu/include /opt/gnu/include /usr/GNU/include /opt/GNU/include' @@ -393,6 +383,7 @@ lseektype='off_t' mail='' mailx='' make='dmake' +make_set_make='#' mallocobj='malloc.o' mallocsrc='malloc.c' malloctype='void *' @@ -415,15 +406,20 @@ mydomain='' myhostname='' myuname='' n='-n' +netdb_hlen_type='int' +netdb_host_type='char *' +netdb_name_type='char *' +netdb_net_type='long' +nm='nm' nm_opt='' nm_so_opt='' nroff='' o_nonblock='O_NONBLOCK' obj_ext='.o' -oldarchlib='' -oldarchlibexp='' optimize='-O2' orderlib='false' +osname='MSWin32' +osvers='4.0' package='perl5' pager='more /e' passcat='' @@ -438,9 +434,12 @@ pidtype='int' plibpth='' pmake='' pr='' +prefix='~INST_DRV~' prefixexp='~INST_DRV~' privlib='~INST_TOP~\lib' +privlibexp='~INST_TOP~\lib' prototype='define' +ptrsize='4' randbits='15' ranlib='rem' rd_nodata='-1' @@ -454,9 +453,11 @@ selecttype='Perl_fd_set *' sendmail='blat' sh='cmd /x /c' shar='' +sharpbang='#!' shmattype='void *' shortsize='2' -shrpdir='none' +shrpenv='' +shsharp='true' sig_name='ZERO INT ILL FPE SEGV TERM BREAK ABRT' sig_name_init='"ZERO", "INT", "ILL", "FPE", "SEGV", "TERM", "BREAK", "ABRT", 0' sig_num='0, 2, 4, 8, 11, 15, 21, 22, 0' @@ -469,25 +470,32 @@ sizetype='size_t' sleep='' smail='' small='' +so='dll' sockethdr='' socketlib='' sort='sort' spackage='Perl5' spitshell='' split='' +src='' ssizetype='int' startperl='#!perl' +startsh='#!/bin/sh' +static_ext='DynaLoader' stdchar='char' stdio_base='((fp)->_base)' stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)' stdio_cnt='((fp)->_cnt)' +stdio_filbuf='' stdio_ptr='((fp)->_ptr)' strings='/usr/include/string.h' submit='' +subversion='~SUBVERSION~' sysman='/usr/man/man1' tail='' tar='' tbl='' +tee='' test='' timeincl='/usr/include/sys/time.h ' timetype='time_t' @@ -500,9 +508,11 @@ uniq='uniq' usedl='define' usemymalloc='n' usenm='false' +useopcode='true' useperlio='undef' -useposix='true' -usesafe='true' +useposix='false' +usesfio='false' +useshrplib='yes' usethreads='undef' usevfork='false' usrinc='/usr/include' @@ -511,3 +521,4 @@ vi='' voidflags='15' xlibpth='/usr/lib/386 /lib/386' zcat='' +zip='zip' diff --git a/win32/config.vc b/win32/config.vc index 486794d248..9797319b61 100644 --- a/win32/config.vc +++ b/win32/config.vc @@ -1,31 +1,5 @@ -# -## This file was hand coded and a lot of information is invalid -# ## Configured by: ~cf_email~ ## Target system: WIN32 -# - -archlibexp='~INST_TOP~\lib\~archname~' -archname='MSWin32' -cc='cl' -ccflags='-MD -DWIN32' -cppflags='-DWIN32' -dlsrc='dl_win32.xs' -dynamic_ext='Socket IO Fcntl Opcode SDBM_File attrs Thread' -extensions='~static_ext~ ~dynamic_ext~' -installarchlib='~INST_TOP~\lib\~archname~' -installprivlib='~INST_TOP~\lib' -libpth='' -libs='' -osname='MSWin32' -osvers='4.0' -prefix='~INST_DRV~' -privlibexp='~INST_TOP~\lib' -sharpbang='#!' -shsharp='true' -so='dll' -startsh='#!/bin/sh' -static_ext='DynaLoader' Author='' CONFIG='true' Date='$Date' @@ -35,22 +9,27 @@ Locker='' Log='$Log' Mcc='Mcc' PATCHLEVEL='~PATCHLEVEL~' -POSIX_cflags='ccflags="$ccflags -DSTRUCT_TM_HASZONE"' RCSfile='$RCSfile' Revision='$Revision' SUBVERSION='~SUBVERSION~' Source='' State='' +_a='.lib' +_exe='.exe' +_o='.obj' afs='false' alignbytes='8' aphostname='' ar='lib' archlib='~INST_TOP~\lib\~archname~' +archlibexp='~INST_TOP~\lib\~archname~' +archname='MSWin32' archobjs='' awk='awk' baserev='5.0' bash='' bin='~INST_TOP~\bin' +bincompat3='' binexp='~INST_TOP~\bin' bison='' byacc='byacc' @@ -58,8 +37,10 @@ byteorder='1234' c='' castflags='0' cat='type' +cc='cl' cccdlflags=' ' ccdlflags=' ' +ccflags='-MD -DWIN32' cf_by='nobody' cf_email='nobody@no.where.net' cf_time='' @@ -74,6 +55,7 @@ cp='copy' cpio='' cpp='cpp' cpp_stuff='42' +cppflags='-DWIN32' cpplast='' cppminus='' cpprun='cl -E' @@ -90,7 +72,6 @@ d_bcopy='undef' d_bincompat3='undef' d_bsd='define' d_bsdgetpgrp='undef' -d_bsdpgrp='undef' d_bsdsetpgrp='undef' d_bzero='undef' d_casti32='define' @@ -126,24 +107,26 @@ d_flock='define' d_fork='undef' d_fpathconf='undef' d_fsetpos='define' +d_ftime='define' d_getgrps='undef' -d_setgrps='undef' -d_gethent='undef' d_gethbyaddr='define' d_gethbyname='define' +d_gethent='undef' +d_gethname='define' +d_getlogin='define' d_getnbyaddr='undef' d_getnbyname='undef' d_getpbyname='define' d_getpbynumber='define' -d_getsbyname='define' -d_getsbyport='define' -d_getlogin='define' +d_getpgid='undef' d_getpgrp2='undef' d_getpgrp='undef' -d_getpgid='undef' d_getppid='undef' d_getprior='undef' +d_getsbyname='define' +d_getsbyport='define' d_gettimeod='undef' +d_gnulibc='undef' d_htonl='define' d_index='undef' d_inetaton='undef' @@ -170,7 +153,7 @@ d_msgrcv='define' d_msgsnd='define' d_mymalloc='define' d_nice='undef' -d_oldarchlib='undef' +d_oldpthreads='undef' d_oldsock='undef' d_open3='undef' d_pathconf='undef' @@ -179,6 +162,8 @@ d_phostname='undef' d_pipe='define' d_poll='undef' d_portable='define' +d_pthread_yield='undef' +d_pthreads_created_joinable='undef' d_pwage='undef' d_pwchange='undef' d_pwclass='undef' @@ -193,6 +178,7 @@ d_rmdir='define' d_safebcpy='undef' d_safemcpy='undef' d_sanemcmp='define' +d_sched_yield='undef' d_seekdir='define' d_select='define' d_sem='undef' @@ -201,6 +187,8 @@ d_semget='define' d_semop='define' d_setegid='undef' d_seteuid='undef' +d_setgrps='undef' +d_sethent='undef' d_setlinebuf='undef' d_setlocale='define' d_setpgid='undef' @@ -221,12 +209,8 @@ d_shmatprototype='undef' d_shmctl='define' d_shmdt='define' d_shmget='define' -d_shrplib='undef' d_sigaction='undef' -d_sigintrp='' d_sigsetjmp='undef' -d_sigvec='define' -d_sigvectr='undef' d_socket='define' d_sockpair='undef' d_statblks='undef' @@ -276,6 +260,9 @@ db_prefixtype='int' defvoidused='15' direntrytype='struct direct' dlext='dll' +dlsrc='dl_win32.xs' +doublesize='8' +dynamic_ext='Socket IO Fcntl Opcode SDBM_File attrs Thread' eagain='EAGAIN' echo='echo' egrep='egrep' @@ -283,6 +270,7 @@ emacs='' eunicefix=':' exe_ext='.exe' expr='expr' +extensions='~static_ext~ ~dynamic_ext~' find='find' firstmakefile='makefile' flex='' @@ -292,15 +280,12 @@ full_csh='' full_sed='' gcc='' gccversion='' -netdb_host_type='char *' -netdb_hlen_type='int' -netdb_name_type='char *' -netdb_net_type='long' gidtype='gid_t' glibpth='/usr/shlib /lib/pa1.1 /usr/lib/large /lib /usr/lib /usr/lib/386 /lib/386 /lib/large /usr/lib/small /lib/small /usr/ccs/lib /usr/ucblib /usr/shlib ' grep='grep' groupcat='' groupstype='gid_t' +gzip='gzip' h_fcntl='false' h_sysfile='true' hint='recommended' @@ -322,6 +307,7 @@ i_malloc='define' i_math='define' i_memory='undef' i_ndbm='undef' +i_netdb='undef' i_neterrno='undef' i_niin='undef' i_pwd='undef' @@ -360,9 +346,11 @@ i_varhdr='varargs.h' i_vfork='undef' incpath='' inews='' +installarchlib='~INST_TOP~\lib\~archname~' installbin='~INST_TOP~\bin' installman1dir='~INST_TOP~\man\man1' installman3dir='~INST_TOP~\man\man3' +installprivlib='~INST_TOP~\lib' installscript='~INST_TOP~\bin' installsitearch='~INST_TOP~\lib\site\~archname~' installsitelib='~INST_TOP~\lib\site' @@ -377,6 +365,8 @@ less='less' lib_ext='.lib' libc='msvcrt.lib' libperl='perl.lib' +libpth='' +libs='' libswanted='net socket inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun m c cposix posix ndir dir crypt ucb bsd BSD PW x' line='line' lint='' @@ -393,6 +383,7 @@ lseektype='off_t' mail='' mailx='' make='nmake' +make_set_make='#' mallocobj='malloc.o' mallocsrc='malloc.c' malloctype='void *' @@ -415,15 +406,20 @@ mydomain='' myhostname='' myuname='' n='-n' +netdb_hlen_type='int' +netdb_host_type='char *' +netdb_name_type='char *' +netdb_net_type='long' +nm='' nm_opt='' nm_so_opt='' nroff='' o_nonblock='O_NONBLOCK' obj_ext='.obj' -oldarchlib='' -oldarchlibexp='' optimize='-O' orderlib='false' +osname='MSWin32' +osvers='4.0' package='perl5' pager='more /e' passcat='' @@ -438,9 +434,12 @@ pidtype='int' plibpth='' pmake='' pr='' +prefix='~INST_DRV~' prefixexp='~INST_DRV~' privlib='~INST_TOP~\lib' +privlibexp='~INST_TOP~\lib' prototype='define' +ptrsize='4' randbits='15' ranlib='rem' rd_nodata='-1' @@ -454,9 +453,11 @@ selecttype='Perl_fd_set *' sendmail='blat' sh='cmd /x /c' shar='' +sharpbang='#!' shmattype='void *' shortsize='2' -shrpdir='none' +shrpenv='' +shsharp='true' sig_name='ZERO INT ILL FPE SEGV TERM BREAK ABRT' sig_name_init='"ZERO", "INT", "ILL", "FPE", "SEGV", "TERM", "BREAK", "ABRT", 0' sig_num='0, 2, 4, 8, 11, 15, 21, 22, 0' @@ -469,25 +470,32 @@ sizetype='size_t' sleep='' smail='' small='' +so='dll' sockethdr='' socketlib='' sort='sort' spackage='Perl5' spitshell='' split='' +src='' ssizetype='int' startperl='#!perl' +startsh='#!/bin/sh' +static_ext='DynaLoader' stdchar='char' stdio_base='((fp)->_base)' stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)' stdio_cnt='((fp)->_cnt)' +stdio_filbuf='' stdio_ptr='((fp)->_ptr)' strings='/usr/include/string.h' submit='' +subversion='~SUBVERSION~' sysman='/usr/man/man1' tail='' tar='' tbl='' +tee='' test='' timeincl='/usr/include/sys/time.h ' timetype='time_t' @@ -500,9 +508,11 @@ uniq='uniq' usedl='define' usemymalloc='n' usenm='false' +useopcode='true' useperlio='undef' -useposix='true' -usesafe='true' +useposix='false' +usesfio='false' +useshrplib='yes' usethreads='undef' usevfork='false' usrinc='/usr/include' @@ -511,3 +521,4 @@ vi='' voidflags='15' xlibpth='/usr/lib/386 /lib/386' zcat='' +zip='zip' diff --git a/win32/config_H.bc b/win32/config_H.bc index b8f52a020c..bcdc0b8d78 100644 --- a/win32/config_H.bc +++ b/win32/config_H.bc @@ -12,7 +12,7 @@ /* * Package name : perl5 - * Source directory : undef + * Source directory : * Configuration time: undef * Configured by : gsar * Target system : @@ -239,12 +239,6 @@ */ /*#define HAS_GETGROUPS /**/ -/* HAS_GETHOSTENT: - * This symbol, if defined, indicates that the gethostent routine is - * available to lookup host names in some data base or other. - */ -/*#define HAS_GETHOSTENT /**/ - /* HAS_UNAME: * This symbol, if defined, indicates that the C program may use the * uname() routine to derive the host name. See also HAS_GETHOSTNAME @@ -1467,6 +1461,12 @@ #define HAS_VPRINTF /**/ /*#define USE_CHAR_VSPRINTF /**/ +/* DOUBLESIZE: + * This symbol contains the size of a double, so that the C preprocessor + * can make decisions based on it. + */ +#define DOUBLESIZE 8 /**/ + /* I_TIME: * This symbol, if defined, indicates to the C program that it should * include <time.h>. @@ -1526,6 +1526,14 @@ #define RD_NODATA -1 #define EOF_NONBLOCK +/* PTRSIZE: + * This symbol contains the size of a pointer, so that the C preprocessor + * can make decisions based on it. It will be sizeof(void *) if + * the compiler supports (void *); otherwise it will be + * sizeof(char *). + */ +#define PTRSIZE 4 /**/ + /* RANDBITS: * This symbol contains the number of bits of random number the rand() * function produces. Usual values are 15, 16, and 31. @@ -1591,6 +1599,58 @@ */ /*#define CSH "" /**/ +/* HAS_GETHOSTBYADDR: + * This symbol, if defined, indicates that the gethostbyaddr() routine is + * available to look up hosts by their IP addresses. + */ +#define HAS_GETHOSTBYADDR /**/ + +/* HAS_GETHOSTBYNAME: + * This symbol, if defined, indicates that the gethostbyname() routine is + * available to look up host names in some data base or other. + */ +#define HAS_GETHOSTBYNAME /**/ + +/* HAS_GETHOSTENT: + * This symbol, if defined, indicates that the gethostent() routine is + * available to look up host names in some data base or another. + */ +/*#define HAS_GETHOSTENT /**/ + +/* HAS_GETNETBYADDR: + * This symbol, if defined, indicates that the getnetbyaddr() routine is + * available to look up networks by their IP addresses. + */ +/*#define HAS_GETNETBYADDR /**/ + +/* HAS_GETNETBYNAME: + * This symbol, if defined, indicates that the getnetbyname() routine is + * available to look up networks by their names. + */ +/*#define HAS_GETNETBYNAME /**/ + +/* HAS_GETPROTOBYNAME: + * This symbol, if defined, indicates that the getprotobyname() + * routine is available to look up protocols by their name. + */ +/* HAS_GETPROTOBYNUMBER: + * This symbol, if defined, indicates that the getprotobynumber() + * routine is available to look up protocols by their number. + */ +#define HAS_GETPROTOBYNAME /**/ +#define HAS_GETPROTOBYNUMBER /**/ + +/* HAS_GETSERVBYNAME: + * This symbol, if defined, indicates that the getservbyname() + * routine is available to look up services by their name. + */ +/* HAS_GETSERVBYPORT: + * This symbol, if defined, indicates that the getservbyport() + * routine is available to look up services by their port. + */ +#define HAS_GETSERVBYNAME /**/ +#define HAS_GETSERVBYPORT /**/ + /* HAS_SETGROUPS: * This symbol, if defined, indicates that the setgroups() routine is * available to set the list of process groups. If unavailable, multiple @@ -1598,6 +1658,12 @@ */ /*#define HAS_SETGROUPS /**/ +/* HAS_SETHOSTENT: + * This symbol, if defined, indicates that the sethostent() routine is + * available. + */ +/*#define HAS_SETHOSTENT /**/ + /* Signal_t: * This symbol's value is either "void" or "int", corresponding to the * appropriate return type of a signal handler. Thus, you can declare @@ -1802,7 +1868,12 @@ * This symbol, if defined, indicates that Perl should * be built to use threads. */ +/* OLD_PTHREADS_API: + * This symbol, if defined, indicates that Perl should + * be built to use the old draft POSIX threads API. + */ /*#define USE_THREADS /**/ +/*#define OLD_PTHREADS_API /**/ #endif #include <win32.h> diff --git a/win32/config_H.gc b/win32/config_H.gc index e5f3d27a93..eef1a63b5c 100644 --- a/win32/config_H.gc +++ b/win32/config_H.gc @@ -12,7 +12,7 @@ /* * Package name : perl5 - * Source directory : undef + * Source directory : * Configuration time: undef * Configured by : gsar * Target system : @@ -239,12 +239,6 @@ */ /*#define HAS_GETGROUPS /**/ -/* HAS_GETHOSTENT: - * This symbol, if defined, indicates that the gethostent routine is - * available to lookup host names in some data base or other. - */ -/*#define HAS_GETHOSTENT /**/ - /* HAS_UNAME: * This symbol, if defined, indicates that the C program may use the * uname() routine to derive the host name. See also HAS_GETHOSTNAME @@ -1467,6 +1461,12 @@ #define HAS_VPRINTF /**/ /*#define USE_CHAR_VSPRINTF /**/ +/* DOUBLESIZE: + * This symbol contains the size of a double, so that the C preprocessor + * can make decisions based on it. + */ +#define DOUBLESIZE 8 /**/ + /* I_TIME: * This symbol, if defined, indicates to the C program that it should * include <time.h>. @@ -1526,6 +1526,14 @@ #define RD_NODATA -1 #define EOF_NONBLOCK +/* PTRSIZE: + * This symbol contains the size of a pointer, so that the C preprocessor + * can make decisions based on it. It will be sizeof(void *) if + * the compiler supports (void *); otherwise it will be + * sizeof(char *). + */ +#define PTRSIZE 4 /**/ + /* RANDBITS: * This symbol contains the number of bits of random number the rand() * function produces. Usual values are 15, 16, and 31. @@ -1591,6 +1599,58 @@ */ /*#define CSH "" /**/ +/* HAS_GETHOSTBYADDR: + * This symbol, if defined, indicates that the gethostbyaddr() routine is + * available to look up hosts by their IP addresses. + */ +#define HAS_GETHOSTBYADDR /**/ + +/* HAS_GETHOSTBYNAME: + * This symbol, if defined, indicates that the gethostbyname() routine is + * available to look up host names in some data base or other. + */ +#define HAS_GETHOSTBYNAME /**/ + +/* HAS_GETHOSTENT: + * This symbol, if defined, indicates that the gethostent() routine is + * available to look up host names in some data base or another. + */ +/*#define HAS_GETHOSTENT /**/ + +/* HAS_GETNETBYADDR: + * This symbol, if defined, indicates that the getnetbyaddr() routine is + * available to look up networks by their IP addresses. + */ +/*#define HAS_GETNETBYADDR /**/ + +/* HAS_GETNETBYNAME: + * This symbol, if defined, indicates that the getnetbyname() routine is + * available to look up networks by their names. + */ +/*#define HAS_GETNETBYNAME /**/ + +/* HAS_GETPROTOBYNAME: + * This symbol, if defined, indicates that the getprotobyname() + * routine is available to look up protocols by their name. + */ +/* HAS_GETPROTOBYNUMBER: + * This symbol, if defined, indicates that the getprotobynumber() + * routine is available to look up protocols by their number. + */ +#define HAS_GETPROTOBYNAME /**/ +#define HAS_GETPROTOBYNUMBER /**/ + +/* HAS_GETSERVBYNAME: + * This symbol, if defined, indicates that the getservbyname() + * routine is available to look up services by their name. + */ +/* HAS_GETSERVBYPORT: + * This symbol, if defined, indicates that the getservbyport() + * routine is available to look up services by their port. + */ +#define HAS_GETSERVBYNAME /**/ +#define HAS_GETSERVBYPORT /**/ + /* HAS_SETGROUPS: * This symbol, if defined, indicates that the setgroups() routine is * available to set the list of process groups. If unavailable, multiple @@ -1598,6 +1658,12 @@ */ /*#define HAS_SETGROUPS /**/ +/* HAS_SETHOSTENT: + * This symbol, if defined, indicates that the sethostent() routine is + * available. + */ +/*#define HAS_SETHOSTENT /**/ + /* Signal_t: * This symbol's value is either "void" or "int", corresponding to the * appropriate return type of a signal handler. Thus, you can declare @@ -1802,7 +1868,12 @@ * This symbol, if defined, indicates that Perl should * be built to use threads. */ +/* OLD_PTHREADS_API: + * This symbol, if defined, indicates that Perl should + * be built to use the old draft POSIX threads API. + */ /*#define USE_THREADS /**/ +/*#define OLD_PTHREADS_API /**/ #endif #include <win32.h> diff --git a/win32/config_H.vc b/win32/config_H.vc index 87bc9c09dc..ac3487f5fb 100644 --- a/win32/config_H.vc +++ b/win32/config_H.vc @@ -12,7 +12,7 @@ /* * Package name : perl5 - * Source directory : undef + * Source directory : * Configuration time: undef * Configured by : gsar * Target system : @@ -246,12 +246,6 @@ */ /*#define HAS_GETGROUPS /**/ -/* HAS_GETHOSTENT: - * This symbol, if defined, indicates that the gethostent routine is - * available to lookup host names in some data base or other. - */ -/*#define HAS_GETHOSTENT /**/ - /* HAS_UNAME: * This symbol, if defined, indicates that the C program may use the * uname() routine to derive the host name. See also HAS_GETHOSTNAME @@ -1474,6 +1468,12 @@ #define HAS_VPRINTF /**/ /*#define USE_CHAR_VSPRINTF /**/ +/* DOUBLESIZE: + * This symbol contains the size of a double, so that the C preprocessor + * can make decisions based on it. + */ +#define DOUBLESIZE 8 /**/ + /* I_TIME: * This symbol, if defined, indicates to the C program that it should * include <time.h>. @@ -1533,6 +1533,14 @@ #define RD_NODATA -1 #define EOF_NONBLOCK +/* PTRSIZE: + * This symbol contains the size of a pointer, so that the C preprocessor + * can make decisions based on it. It will be sizeof(void *) if + * the compiler supports (void *); otherwise it will be + * sizeof(char *). + */ +#define PTRSIZE 4 /**/ + /* RANDBITS: * This symbol contains the number of bits of random number the rand() * function produces. Usual values are 15, 16, and 31. @@ -1598,6 +1606,58 @@ */ /*#define CSH "" /**/ +/* HAS_GETHOSTBYADDR: + * This symbol, if defined, indicates that the gethostbyaddr() routine is + * available to look up hosts by their IP addresses. + */ +#define HAS_GETHOSTBYADDR /**/ + +/* HAS_GETHOSTBYNAME: + * This symbol, if defined, indicates that the gethostbyname() routine is + * available to look up host names in some data base or other. + */ +#define HAS_GETHOSTBYNAME /**/ + +/* HAS_GETHOSTENT: + * This symbol, if defined, indicates that the gethostent() routine is + * available to look up host names in some data base or another. + */ +/*#define HAS_GETHOSTENT /**/ + +/* HAS_GETNETBYADDR: + * This symbol, if defined, indicates that the getnetbyaddr() routine is + * available to look up networks by their IP addresses. + */ +/*#define HAS_GETNETBYADDR /**/ + +/* HAS_GETNETBYNAME: + * This symbol, if defined, indicates that the getnetbyname() routine is + * available to look up networks by their names. + */ +/*#define HAS_GETNETBYNAME /**/ + +/* HAS_GETPROTOBYNAME: + * This symbol, if defined, indicates that the getprotobyname() + * routine is available to look up protocols by their name. + */ +/* HAS_GETPROTOBYNUMBER: + * This symbol, if defined, indicates that the getprotobynumber() + * routine is available to look up protocols by their number. + */ +#define HAS_GETPROTOBYNAME /**/ +#define HAS_GETPROTOBYNUMBER /**/ + +/* HAS_GETSERVBYNAME: + * This symbol, if defined, indicates that the getservbyname() + * routine is available to look up services by their name. + */ +/* HAS_GETSERVBYPORT: + * This symbol, if defined, indicates that the getservbyport() + * routine is available to look up services by their port. + */ +#define HAS_GETSERVBYNAME /**/ +#define HAS_GETSERVBYPORT /**/ + /* HAS_SETGROUPS: * This symbol, if defined, indicates that the setgroups() routine is * available to set the list of process groups. If unavailable, multiple @@ -1605,6 +1665,12 @@ */ /*#define HAS_SETGROUPS /**/ +/* HAS_SETHOSTENT: + * This symbol, if defined, indicates that the sethostent() routine is + * available. + */ +/*#define HAS_SETHOSTENT /**/ + /* Signal_t: * This symbol's value is either "void" or "int", corresponding to the * appropriate return type of a signal handler. Thus, you can declare @@ -1809,7 +1875,12 @@ * This symbol, if defined, indicates that Perl should * be built to use threads. */ +/* OLD_PTHREADS_API: + * This symbol, if defined, indicates that Perl should + * be built to use the old draft POSIX threads API. + */ /*#define USE_THREADS /**/ +/*#define OLD_PTHREADS_API /**/ #endif #include <win32.h> diff --git a/win32/config_h.PL b/win32/config_h.PL index 471c43c7e1..f317e5a407 100644 --- a/win32/config_h.PL +++ b/win32/config_h.PL @@ -27,6 +27,7 @@ eval $str; die "$str:$@" if $@; open(H,">$file.new") || die "Cannot open $file.new:$!"; +binmode H; # no CRs (which cause a spurious rebuild) while (<SH>) { last if /^$term$/o; diff --git a/win32/makefile.mk b/win32/makefile.mk index d027ce5b2d..789cf827c3 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -17,7 +17,7 @@ INST_TOP *= $(INST_DRV)\perl5004.5x # # uncomment to enable threads-capabilities -USE_THREADS *= define +#USE_THREADS *= define # # uncomment one diff --git a/win32/win32.c b/win32/win32.c index 54ce3990ab..65727a45f8 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -105,6 +105,20 @@ long w32_num_children = 0; HANDLE w32_child_pids[MAXIMUM_WAIT_OBJECTS]; #endif +#ifndef FOPEN_MAX +# ifdef _NSTREAM_ +# define FOPEN_MAX _NSTREAM_ +# elsif _NFILE_ +# define FOPEN_MAX _NFILE_ +# elsif _NFILE +# define FOPEN_MAX _NFILE +# endif +#endif + +#ifndef USE_CRT_POPEN +int w32_popen_pids[FOPEN_MAX]; +#endif + #ifdef USE_THREADS # ifdef USE_DECLSPEC_THREAD __declspec(thread) char strerror_buffer[512]; @@ -222,10 +236,8 @@ my_popen(char *cmd, char *mode) #define fixcmd(x) #endif fixcmd(cmd); -#ifdef __BORLANDC__ /* workaround a Borland stdio bug */ win32_fflush(stdout); win32_fflush(stderr); -#endif return win32_popen(cmd, mode); } @@ -370,15 +382,18 @@ do_aspawn(void *vreally, void **vmark, void **vsp) (const char* const*)argv); } - if (status < 0) { - if (dowarn) - warn("Can't spawn \"%s\": %s", argv[0], strerror(errno)); - status = 255 * 256; + if (flag != P_NOWAIT) { + if (status < 0) { + if (dowarn) + warn("Can't spawn \"%s\": %s", argv[0], strerror(errno)); + status = 255 * 256; + } + else + status *= 256; + statusvalue = status; } - else if (flag != P_NOWAIT) - status *= 256; Safefree(argv); - return (statusvalue = status); + return (status); } int @@ -454,16 +469,19 @@ do_spawn2(char *cmd, int exectype) cmd = argv[0]; Safefree(argv); } - if (status < 0) { - if (dowarn) - warn("Can't %s \"%s\": %s", - (exectype == EXECF_EXEC ? "exec" : "spawn"), - cmd, strerror(errno)); - status = 255 * 256; + if (exectype != EXECF_SPAWN_NOWAIT) { + if (status < 0) { + if (dowarn) + warn("Can't %s \"%s\": %s", + (exectype == EXECF_EXEC ? "exec" : "spawn"), + cmd, strerror(errno)); + status = 255 * 256; + } + else + status *= 256; + statusvalue = status; } - else if (exectype != EXECF_SPAWN_NOWAIT) - status *= 256; - return (statusvalue = status); + return (status); } int @@ -1483,16 +1501,125 @@ win32_pipe(int *pfd, unsigned int size, int mode) return _pipe(pfd, size, mode); } +/* + * a popen() clone that respects PERL5SHELL + */ + DllExport FILE* win32_popen(const char *command, const char *mode) { +#ifdef USE_CRT_POPEN return _popen(command, mode); +#else + int p[2]; + int parent, child; + int stdfd, oldfd; + int ourmode; + int childpid; + + /* establish which ends read and write */ + if (strchr(mode,'w')) { + stdfd = 0; /* stdin */ + parent = 1; + child = 0; + } + else if (strchr(mode,'r')) { + stdfd = 1; /* stdout */ + parent = 0; + child = 1; + } + else + return NULL; + + /* set the correct mode */ + if (strchr(mode,'b')) + ourmode = O_BINARY; + else if (strchr(mode,'t')) + ourmode = O_TEXT; + else + ourmode = _fmode & (O_TEXT | O_BINARY); + + /* the child doesn't inherit handles */ + ourmode |= O_NOINHERIT; + + if (win32_pipe( p, 512, ourmode) == -1) + return NULL; + + /* save current stdfd */ + if ((oldfd = win32_dup(stdfd)) == -1) + goto cleanup; + + /* make stdfd go to child end of pipe (implicitly closes stdfd) */ + /* stdfd will be inherited by the child */ + if (win32_dup2(p[child], stdfd) == -1) + goto cleanup; + + /* close the child end in parent */ + win32_close(p[child]); + + /* start the child */ + if ((childpid = do_spawn_nowait((char*)command)) == -1) + goto cleanup; + + /* revert stdfd to whatever it was before */ + if (win32_dup2(oldfd, stdfd) == -1) + goto cleanup; + + /* close saved handle */ + win32_close(oldfd); + + w32_popen_pids[p[parent]] = childpid; + + /* we have an fd, return a file stream */ + return (win32_fdopen(p[parent], (char *)mode)); + +cleanup: + /* we don't need to check for errors here */ + win32_close(p[0]); + win32_close(p[1]); + if (oldfd != -1) { + win32_dup2(oldfd, stdfd); + win32_close(oldfd); + } + return (NULL); + +#endif /* USE_CRT_POPEN */ } +/* + * pclose() clone + */ + DllExport int win32_pclose(FILE *pf) { +#ifdef USE_CRT_POPEN return _pclose(pf); +#else + int fd, childpid, status; + + fd = win32_fileno(pf); + childpid = w32_popen_pids[fd]; + + if (!childpid) { + errno = EBADF; + return -1; + } + + win32_fclose(pf); + w32_popen_pids[fd] = 0; + + /* wait for the child */ + if (cwait(&status, childpid, WAIT_CHILD) == -1) + return (-1); + /* cwait() returns differently on Borland */ +#ifdef __BORLANDC__ + return (((status >> 8) & 0xff) | ((status << 8) & 0xff00)); +#else + return (status); +#endif + +#endif /* USE_CRT_OPEN */ } DllExport int @@ -1814,7 +1941,7 @@ XS(w32_GetCwd) */ if (SvCUR(sv)) SvPOK_on(sv); - EXTEND(sp,1); + EXTEND(SP,1); ST(0) = sv; XSRETURN(1); } |