use ExtUtils::MakeMaker;
-use Config;\r
+use Config;
# The existence of the ./sdbm/Makefile.PL file causes MakeMaker
# to automatically include Makefile code for the targets
sub MY::postamble {
if ($^O =~ /MSWin32/ && Win32::IsWin95()) {
- if ($Config{'make'} =~ /dmake/i) {\r
- # dmake-specific\r
- return <<EOT;\r
+ if ($Config{'make'} =~ /dmake/i) {
+ # dmake-specific
+ return <<EOT;
$(MYEXTLIB): sdbm/Makefile
@[
cd sdbm
$(MAKE) all
cd ..
]
-EOT\r
- } elsif ($Config{'make'} =~ /nmake/i) {\r
- #\r
- return <<'EOT';\r
-$(MYEXTLIB): sdbm/Makefile\r
- cd sdbm\r
- $(MAKE) all\r
- cd ..\r
-EOT\r
- } \r
- } elsif ($^O ne 'VMS') {\r
+EOT
+ } elsif ($Config{'make'} =~ /nmake/i) {
+ #
+ return <<EOT;
+$(MYEXTLIB): sdbm/Makefile
+ cd sdbm
+ $(MAKE) all
+ cd ..
+EOT
+ }
+} elsif ($^O ne 'VMS') {
'
$(MYEXTLIB): sdbm/Makefile
cd sdbm && $(MAKE) all
my($self, $subdir) = @_;
my(@m);
if ($Is_Win32 && Win32::IsWin95()) {
- if ($Config{'make'} =~ /dmake/i) {\r
- # dmake-specific\r
- return <<EOT;\r
+ if ($Config{'make'} =~ /dmake/i) {
+ # dmake-specific
+ return <<EOT;
subdirs ::
@[
cd $subdir
cd ..
]
EOT
- } elsif ($Config{'make'} =~ /nmake/i) {\r
- # nmake-specific\r
- return <<EOT;\r
-subdirs ::\r
- cd $subdir\r
- \$(MAKE) all \$(PASTHRU)\r
- cd ..\r
-EOT\r
- }\r
- } else {\r
+ } elsif ($Config{'make'} =~ /nmake/i) {
+ # nmake-specific
+ return <<EOT;
+subdirs ::
+ cd $subdir
+ \$(MAKE) all \$(PASTHRU)
+ cd ..
+EOT
+ }
+ } else {
return <<EOT;
subdirs ::
}
elsif ($PLATFORM eq 'win32') {
$CCTYPE = "MSVC" unless defined $CCTYPE;
- foreach ($thrdvar_h, $intrpvar_h, $perlvars_h, $global_sym,\r
- $pp_sym, $globvar_sym, $perlio_sym) {\r
+ foreach ($thrdvar_h, $intrpvar_h, $perlvars_h, $global_sym,
+ $pp_sym, $globvar_sym, $perlio_sym) {
s!^!..\\!;
}
}
if ($PLATFORM eq 'win32') {
foreach my $symbol (qw(
- setuid\r
- setgid\r
+ setuid
+ setgid
boot_DynaLoader
Perl_init_os_extras
Perl_thread_create
win32_getpid
win32_crypt
win32_dynaload
-\r
- win32_stdin\r
- win32_stdout\r
- win32_stderr\r
- win32_ferror\r
- win32_feof\r
- win32_strerror\r
- win32_fprintf\r
- win32_printf\r
- win32_vfprintf\r
- win32_vprintf\r
- win32_fread\r
- win32_fwrite\r
- win32_fopen\r
- win32_fdopen\r
- win32_freopen\r
- win32_fclose\r
- win32_fputs\r
- win32_fputc\r
- win32_ungetc\r
- win32_getc\r
- win32_fileno\r
- win32_clearerr\r
- win32_fflush\r
- win32_ftell\r
- win32_fseek\r
- win32_fgetpos\r
- win32_fsetpos\r
- win32_rewind\r
- win32_tmpfile\r
- win32_setbuf\r
- win32_setvbuf\r
- win32_flushall\r
- win32_fcloseall\r
- win32_fgets\r
- win32_gets\r
- win32_fgetc\r
- win32_putc\r
- win32_puts\r
- win32_getchar\r
- win32_putchar\r
+
+ win32_stdin
+ win32_stdout
+ win32_stderr
+ win32_ferror
+ win32_feof
+ win32_strerror
+ win32_fprintf
+ win32_printf
+ win32_vfprintf
+ win32_vprintf
+ win32_fread
+ win32_fwrite
+ win32_fopen
+ win32_fdopen
+ win32_freopen
+ win32_fclose
+ win32_fputs
+ win32_fputc
+ win32_ungetc
+ win32_getc
+ win32_fileno
+ win32_clearerr
+ win32_fflush
+ win32_ftell
+ win32_fseek
+ win32_fgetpos
+ win32_fsetpos
+ win32_rewind
+ win32_tmpfile
+ win32_setbuf
+ win32_setvbuf
+ win32_flushall
+ win32_fcloseall
+ win32_fgets
+ win32_gets
+ win32_fgetc
+ win32_putc
+ win32_puts
+ win32_getchar
+ win32_putchar
))
{
try_symbol($symbol);
static int dbg = 0;
if (!dbg)
{
- char *s = PerlEnv_getenv("PERLIO_DEBUG");\r
+ char *s = PerlEnv_getenv("PERLIO_DEBUG");
if (s && *s)
- dbg = PerlLIO_open3(s,O_WRONLY|O_CREAT|O_APPEND,0666);\r
+ dbg = PerlLIO_open3(s,O_WRONLY|O_CREAT|O_APPEND,0666);
else
dbg = -1;
}
Perl_sv_vcatpvf(aTHX_ sv, fmt, &ap);
s = SvPV(sv,len);
- PerlLIO_write(dbg,s,len);\r
+ PerlLIO_write(dbg,s,len);
va_end(ap);
SvREFCNT_dec(sv);
}
int len;
if (!PerlIO_layer_hv)
{
- char *s = PerlEnv_getenv("PERLIO");\r
+ char *s = PerlEnv_getenv("PERLIO");
newXS("perlio::import",XS_perlio_import,__FILE__);
newXS("perlio::unimport",XS_perlio_unimport,__FILE__);
PerlIO_layer_hv = get_hv("perlio::layers",GV_ADD|GV_ADDMULTI);
{
while (*s)
{
- while (*s && isSPACE((unsigned char)*s))\r
+ while (*s && isSPACE((unsigned char)*s))
s++;
if (*s)
{
char *e = s;
SV *layer;
- while (*e && !isSPACE((unsigned char)*e))\r
+ while (*e && !isSPACE((unsigned char)*e))
e++;
layer = PerlIO_find_layer(s,e-s);
if (layer)
int oflags = PerlIOUnix_oflags(mode);
if (oflags != -1)
{
- int fd = PerlLIO_open3(path,oflags,0666);\r
+ int fd = PerlLIO_open3(path,oflags,0666);
if (fd >= 0)
{
PerlIOUnix *s = PerlIOSelf(PerlIO_push(f = PerlIO_allocate(),self,mode),PerlIOUnix);
(*PerlIOBase(f)->tab->Close)(f);
if (oflags != -1)
{
- int fd = PerlLIO_open3(path,oflags,0666);\r
+ int fd = PerlLIO_open3(path,oflags,0666);
if (fd >= 0)
{
s->fd = fd;
return 0;
while (1)
{
- SSize_t len = PerlLIO_read(fd,vbuf,count);\r
+ SSize_t len = PerlLIO_read(fd,vbuf,count);
if (len >= 0 || errno != EINTR)
{
if (len < 0)
int fd = PerlIOSelf(f,PerlIOUnix)->fd;
while (1)
{
- SSize_t len = PerlLIO_write(fd,vbuf,count);\r
+ SSize_t len = PerlLIO_write(fd,vbuf,count);
if (len >= 0 || errno != EINTR)
{
if (len < 0)
IV
PerlIOUnix_seek(PerlIO *f, Off_t offset, int whence)
{
- Off_t new = PerlLIO_lseek(PerlIOSelf(f,PerlIOUnix)->fd,offset,whence);\r
+ Off_t new = PerlLIO_lseek(PerlIOSelf(f,PerlIOUnix)->fd,offset,whence);
PerlIOBase(f)->flags &= ~PERLIO_F_EOF;
return (new == (Off_t) -1) ? -1 : 0;
}
Off_t
PerlIOUnix_tell(PerlIO *f)
{
- return PerlLIO_lseek(PerlIOSelf(f,PerlIOUnix)->fd,0,SEEK_CUR);\r
+ return PerlLIO_lseek(PerlIOSelf(f,PerlIOUnix)->fd,0,SEEK_CUR);
}
IV
{
int fd = PerlIOSelf(f,PerlIOUnix)->fd;
int code = 0;
- while (PerlLIO_close(fd) != 0)\r
+ while (PerlLIO_close(fd) != 0)
{
if (errno != EINTR)
{
{
PerlIOBase(f)->flags |= PERLIO_F_TEMP;
}
- PerlLIO_unlink(SvPVX(sv));\r
+ PerlLIO_unlink(SvPVX(sv));
SvREFCNT_dec(sv);
}
return f;
#USE_IMP_SYS = define
#
-# uncomment to enable the experimental PerlIO I/O subsystem.\r
-# This is currently incompatible with USE_MULTI, USE_ITHREADS,\r
-# and USE_IMP_SYS\r
-#USE_PERLIO = define\r
-\r
-#\r
+# uncomment to enable the experimental PerlIO I/O subsystem.
+# This is currently incompatible with USE_MULTI, USE_ITHREADS,
+# and USE_IMP_SYS
+#USE_PERLIO = define
+
+#
# WARNING! This option is deprecated and will eventually go away (enable
# USE_ITHREADS instead).
#
!IF "$(USE_MULTI)" == "define"
ARCHNAME = MSWin32-$(PROCESSOR_ARCHITECTURE)-multi
!ELSE
-!IF "$(USE_PERLIO)" == "define"\r
-ARCHNAME = MSWin32-$(PROCESSOR_ARCHITECTURE)-perlio\r
-!ELSE\r
+!IF "$(USE_PERLIO)" == "define"
+ARCHNAME = MSWin32-$(PROCESSOR_ARCHITECTURE)-perlio
+!ELSE
ARCHNAME = MSWin32-$(PROCESSOR_ARCHITECTURE)
!ENDIF
!ENDIF
!ENDIF
-!ENDIF\r
-\r
-!IF "$(USE_PERLIO)" == "define"\r
-BUILDOPT = $(BUILDOPT) -DUSE_PERLIO\r
-!ENDIF\r
+!ENDIF
+
+!IF "$(USE_PERLIO)" == "define"
+BUILDOPT = $(BUILDOPT) -DUSE_PERLIO
+!ENDIF
!IF "$(USE_ITHREADS)" == "define"
ARCHNAME = $(ARCHNAME)-thread
NOOP = @echo
NULL =
-DEL = bin\mdelete.bat\r
-\r
+DEL = bin\mdelete.bat
+
#
# filenames given to xsubpp must have forward slashes (since it puts
# full pathnames in #line strings)
"INST_ARCH=$(INST_ARCH)" \
"archname=$(ARCHNAME)" \
"cc=$(CC)" \
- "ccflags=-nologo -Gf -W3 $(OPTIMIZE:"=\") $(DEFINES) $(BUILDOPT)" \\r
- "cf_email=$(EMAIL)" \\r
+ "ccflags=-nologo -Gf -W3 $(OPTIMIZE:"=\") $(DEFINES) $(BUILDOPT)" \
+ "cf_email=$(EMAIL)" \
"d_crypt=$(D_CRYPT)" \
"d_mymalloc=$(PERL_MALLOC)" \
"libs=$(LIBFILES)" \
rename config.h $(CFGH_TMPL)
$(CONFIGPM) : $(MINIPERL) ..\config.sh config_h.PL ..\minimod.pl
- cd .. \r
- miniperl configpm\r
- cd win32\r
+ cd ..
+ miniperl configpm
+ cd win32
if exist lib\* $(RCOPY) lib\*.* ..\lib\$(NULL)
$(XCOPY) ..\*.h $(COREDIR)\*.*
$(XCOPY) *.h $(COREDIR)\*.*
$(XCOPY) ..\ext\re\re.pm $(LIBDIR)\*.*
$(RCOPY) include $(COREDIR)\*.*
- -$(MINIPERL) -I..\lib config_h.PL "INST_VER=$(INST_VER)"\r
- if errorlevel 1 $(MAKE) /$(MAKEFLAGS) $(CONFIGPM)\r
+ -$(MINIPERL) -I..\lib config_h.PL "INST_VER=$(INST_VER)"
+ if errorlevel 1 $(MAKE) /$(MAKEFLAGS) $(CONFIGPM)
$(MINIPERL) : $(MINIDIR) $(MINI_OBJ)
$(LINK32) -subsystem:console -out:$@ @<<
$(XCOPY) $(PERLIMPLIB) $(COREDIR)
$(MINIMOD) : $(MINIPERL) ..\minimod.pl
- cd .. \r
- miniperl minimod.pl > lib\ExtUtils\Miniperl.pm\r
- cd win32\r
+ cd ..
+ miniperl minimod.pl > lib\ExtUtils\Miniperl.pm
+ cd win32
..\x2p\a2p$(o) : ..\x2p\a2p.c
$(CC) -I..\x2p $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\a2p.c
-del /f $(LIBDIR)\Devel\Peek.pm $(LIBDIR)\Devel\DProf.pm
-del /f $(LIBDIR)\File\Glob.pm
-del /f $(LIBDIR)\Storable.pm
- -if exist $(LIBDIR)\IO rmdir /s /q $(LIBDIR)\IO \r
- -rmdir /s $(LIBDIR)\IO\r
- -if exist $(LIBDIR)\Thread rmdir /s /q $(LIBDIR)\Thread \r
- -rmdir /s $(LIBDIR)\Thread\r
- -if exist $(LIBDIR)\B rmdir /s /q $(LIBDIR)\B\r
- -rmdir /s $(LIBDIR)\B\r
- -if exist $(LIBDIR)\Data rmdir /s /q $(LIBDIR)\Data \r
- -rmdir /s $(LIBDIR)\Data\r
+ -if exist $(LIBDIR)\IO rmdir /s /q $(LIBDIR)\IO
+ -rmdir /s $(LIBDIR)\IO
+ -if exist $(LIBDIR)\Thread rmdir /s /q $(LIBDIR)\Thread
+ -rmdir /s $(LIBDIR)\Thread
+ -if exist $(LIBDIR)\B rmdir /s /q $(LIBDIR)\B
+ -rmdir /s $(LIBDIR)\B
+ -if exist $(LIBDIR)\Data rmdir /s /q $(LIBDIR)\Data
+ -rmdir /s $(LIBDIR)\Data
-del /f $(PODDIR)\*.html
-del /f $(PODDIR)\*.bat
cd ..\utils
cd $(EXTDIR)
-del /s *.lib *.def *.map *.pdb *.bs Makefile *$(o) pm_to_blib
cd ..\win32
- -if exist $(AUTODIR) rmdir /s /q $(AUTODIR) \r
- -rmdir /s $(AUTODIR)\r
- -if exist $(COREDIR) rmdir /s /q $(COREDIR) \r
- -rmdir /s $(COREDIR)\r
+ -if exist $(AUTODIR) rmdir /s /q $(AUTODIR)
+ -rmdir /s $(AUTODIR)
+ -if exist $(COREDIR) rmdir /s /q $(COREDIR)
+ -rmdir /s $(COREDIR)
install : all installbare installhtml
cd ..\win32
clean :
- -@$(DEL) miniperlmain$(o)\r
- -@$(DEL) $(MINIPERL)\r
- -@$(DEL) perlglob$(o)\r
- -@$(DEL) perlmain$(o)\r
- -@$(DEL) config.w32\r
- -@$(DEL) /f config.h\r
- -@$(DEL) $(GLOBEXE)\r
- -@$(DEL) $(PERLEXE)\r
- -@$(DEL) $(WPERLEXE)\r
- -@$(DEL) $(PERLDLL)\r
- -@$(DEL) $(CORE_OBJ)\r
- -if exist $(MINIDIR) deltree /y $(MINIDIR) \r
- -@$(DEL) $(WIN32_OBJ)\r
- -@$(DEL) $(DLL_OBJ)\r
- -@$(DEL) $(X2P_OBJ)\r
- -@$(DEL) ..\*$(o) ..\*.lib ..\*.exp *$(o) *.lib *.exp *.res\r
- -@$(DEL) ..\t\*.exe ..\t\*.dll ..\t\*.bat\r
- -@$(DEL) ..\x2p\*.exe ..\x2p\*.bat\r
- -@$(DEL) *.ilk\r
- -@$(DEL) *.pdb\r
+ -@$(DEL) miniperlmain$(o)
+ -@$(DEL) $(MINIPERL)
+ -@$(DEL) perlglob$(o)
+ -@$(DEL) perlmain$(o)
+ -@$(DEL) config.w32
+ -@$(DEL) /f config.h
+ -@$(DEL) $(GLOBEXE)
+ -@$(DEL) $(PERLEXE)
+ -@$(DEL) $(WPERLEXE)
+ -@$(DEL) $(PERLDLL)
+ -@$(DEL) $(CORE_OBJ)
+ -if exist $(MINIDIR) deltree /y $(MINIDIR)
+ -@$(DEL) $(WIN32_OBJ)
+ -@$(DEL) $(DLL_OBJ)
+ -@$(DEL) $(X2P_OBJ)
+ -@$(DEL) ..\*$(o) ..\*.lib ..\*.exp *$(o) *.lib *.exp *.res
+ -@$(DEL) ..\t\*.exe ..\t\*.dll ..\t\*.bat
+ -@$(DEL) ..\x2p\*.exe ..\x2p\*.bat
+ -@$(DEL) *.ilk
+ -@$(DEL) *.pdb
# Handy way to run perlbug -ok without having to install and run the
# installed perlbug. We don't re-run the tests here - we trust the user.
-@echo off\r
-rem ! This is a batch file to delete all the files on its\r
-rem ! command line, to work around command.com's del command's\r
-rem ! braindeadness\r
-rem !\r
-rem ! -- BKS, 11-11-2000\r
-\r
-:nextfile\r
-set file=%1\r
-shift\r
-if "%file%"=="" goto end\r
-del %file%\r
-goto nextfile\r
-:end\r
-\r
+@echo off
+rem ! This is a batch file to delete all the files on its
+rem ! command line, to work around command.com's del command's
+rem ! braindeadness
+rem !
+rem ! -- BKS, 11-11-2000
+
+:nextfile
+set file=%1
+shift
+if "%file%"=="" goto end
+del %file%
+goto nextfile
+:end
+
@echo off\r
rem ! This is a batch file to delete all the files on its\r
rem ! command line, to work around command.com's del command's\r
d_stdio_cnt_lval='define'
d_stdio_ptr_lval='define'
d_stdio_ptr_lval_sets_cnt='undef'
-d_stdio_ptr_lval_nochange_cnt='define'\r
+d_stdio_ptr_lval_nochange_cnt='define'
d_stdio_stream_array='undef'
d_stdiobase='define'
d_stdstdio='define'
d_stdio_cnt_lval='define'
d_stdio_ptr_lval='define'
d_stdio_ptr_lval_sets_cnt='undef'
-d_stdio_ptr_lval_nochange_cnt='define'\r
+d_stdio_ptr_lval_nochange_cnt='define'
d_stdio_stream_array='undef'
d_stdiobase='define'
d_stdstdio='define'
return 0;
}
-/*\r
- * XXX this needs strengthening (for PerlIO)\r
- * -- BKS, 11-11-200\r
-*/\r
-int mkstemp(const char *path)\r
-{\r
- dTHX;\r
- char buf[MAX_PATH+1];\r
- int i = 0, fd = -1;\r
-\r
-retry:\r
- if (i++ > 10) { /* give up */\r
- errno = ENOENT;\r
- return -1;\r
- }\r
- if (!GetTempFileNameA((LPCSTR)path, "plr", 1, buf)) {\r
- errno = ENOENT;\r
- return -1;\r
- }\r
- fd = PerlLIO_open3(buf, O_CREAT|O_RDWR|O_EXCL, 0600);\r
- if (fd == -1)\r
- goto retry;\r
- return fd;\r
-}\r
-\r
+/*
+ * XXX this needs strengthening (for PerlIO)
+ * -- BKS, 11-11-200
+*/
+int mkstemp(const char *path)
+{
+ dTHX;
+ char buf[MAX_PATH+1];
+ int i = 0, fd = -1;
+
+retry:
+ if (i++ > 10) { /* give up */
+ errno = ENOENT;
+ return -1;
+ }
+ if (!GetTempFileNameA((LPCSTR)path, "plr", 1, buf)) {
+ errno = ENOENT;
+ return -1;
+ }
+ fd = PerlLIO_open3(buf, O_CREAT|O_RDWR|O_EXCL, 0600);
+ if (fd == -1)
+ goto retry;
+ return fd;
+}
+
static long
find_pid(int pid)
{
/*
* a popen() clone that respects PERL5SHELL
- *\r
- * changed to return PerlIO* rather than FILE * by BKS, 11-11-2000\r
+ *
+ * changed to return PerlIO* rather than FILE * by BKS, 11-11-2000
*/
-DllExport PerlIO*\r
+DllExport PerlIO*
win32_popen(const char *command, const char *mode)
{
#ifdef USE_RTL_POPEN
}
/* we have an fd, return a file stream */
-#ifdef USE_PERLIO\r
- return (PerlIO_fdopen(p[parent], (char *)mode));\r
-#else\r
- return (fdopen(p[parent], (char *)mode));\r
-#endif\r
+#ifdef USE_PERLIO
+ return (PerlIO_fdopen(p[parent], (char *)mode));
+#else
+ return (fdopen(p[parent], (char *)mode));
+#endif
cleanup:
/* we don't need to check for errors here */
*/
DllExport int
-win32_pclose(PerlIO *pf)\r
+win32_pclose(PerlIO *pf)
{
#ifdef USE_RTL_POPEN
return _pclose(pf);
SV *sv;
LOCK_FDPID_MUTEX;
- sv = *av_fetch(w32_fdpid, PerlIO_fileno(pf), TRUE);\r
+ sv = *av_fetch(w32_fdpid, PerlIO_fileno(pf), TRUE);
if (SvIOK(sv))
childpid = SvIVX(sv);
return -1;
}
-#ifdef USE_PERLIO\r
- PerlIO_close(pf);\r
-#else\r
- fclose(pf);\r
-#endif\r
+#ifdef USE_PERLIO
+ PerlIO_close(pf);
+#else
+ fclose(pf);
+#endif
SvIVX(sv) = 0;
UNLOCK_FDPID_MUTEX;
return open(PerlDir_mapA(path), flag, pmode);
}
-/* close() that understands socket */\r
-extern int my_close(int); /* in win32sck.c */\r
-\r
+/* close() that understands socket */
+extern int my_close(int); /* in win32sck.c */
+
DllExport int
win32_close(int fd)
{
- return my_close(fd);\r
+ return my_close(fd);
}
DllExport int
extern void *sbrk(int need);
extern char * getlogin(void);
extern int chown(const char *p, uid_t o, gid_t g);
-extern int mkstemp(const char *path);\r
+extern int mkstemp(const char *path);
#undef Stat
#define Stat win32_stat
return s;
}
-/*\r
- * close RTL fd while respecting sockets\r
- * added as temporary measure until PerlIO has real\r
- * Win32 native layer\r
- * -- BKS, 11-11-2000\r
-*/\r
-\r
-int my_close(int fd)\r
-{\r
- int osf;\r
- if (!wsock_started) /* No WinSock? */\r
- return(close(fd)); /* Then not a socket. */\r
- osf = TO_SOCKET(fd);/* Get it now before it's gone! */\r
- if (osf != -1) {\r
- int err;\r
- err = closesocket(osf);\r
- if (err == 0) {\r
-#if defined(USE_FIXED_OSFHANDLE) || defined(PERL_MSVCRT_READFIX)\r
- _set_osfhnd(fd, INVALID_HANDLE_VALUE);\r
-#endif\r
- (void)close(fd); /* handle already closed, ignore error */\r
- return 0;\r
- }\r
- else if (err == SOCKET_ERROR) {\r
- err = WSAGetLastError();\r
- if (err != WSAENOTSOCK) {\r
- (void)close(fd);\r
- errno = err;\r
- return EOF;\r
- }\r
- }\r
- }\r
- return close(fd);\r
-}\r
-\r
+/*
+ * close RTL fd while respecting sockets
+ * added as temporary measure until PerlIO has real
+ * Win32 native layer
+ * -- BKS, 11-11-2000
+*/
+
+int my_close(int fd)
+{
+ int osf;
+ if (!wsock_started) /* No WinSock? */
+ return(close(fd)); /* Then not a socket. */
+ osf = TO_SOCKET(fd);/* Get it now before it's gone! */
+ if (osf != -1) {
+ int err;
+ err = closesocket(osf);
+ if (err == 0) {
+#if defined(USE_FIXED_OSFHANDLE) || defined(PERL_MSVCRT_READFIX)
+ _set_osfhnd(fd, INVALID_HANDLE_VALUE);
+#endif
+ (void)close(fd); /* handle already closed, ignore error */
+ return 0;
+ }
+ else if (err == SOCKET_ERROR) {
+ err = WSAGetLastError();
+ if (err != WSAENOTSOCK) {
+ (void)close(fd);
+ errno = err;
+ return EOF;
+ }
+ }
+ }
+ return close(fd);
+}
+
#undef fclose
int
my_fclose (FILE *pf)
int osf;
if (!wsock_started) /* No WinSock? */
return(fclose(pf)); /* Then not a socket. */
- osf = TO_SOCKET(win32_fileno(pf));/* Get it now before it's gone! */\r
+ osf = TO_SOCKET(win32_fileno(pf));/* Get it now before it's gone! */
if (osf != -1) {
int err;
win32_fflush(pf);
err = closesocket(osf);
if (err == 0) {
#if defined(USE_FIXED_OSFHANDLE) || defined(PERL_MSVCRT_READFIX)
- _set_osfhnd(win32_fileno(pf), INVALID_HANDLE_VALUE);\r
+ _set_osfhnd(win32_fileno(pf), INVALID_HANDLE_VALUE);
#endif
(void)fclose(pf); /* handle already closed, ignore error */
return 0;