summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2000-11-16 01:34:18 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2000-11-16 01:34:18 +0000
commit74cac757131a44f884c4728708d3a2e5d87b32d3 (patch)
tree6d2eb90fe3f3281dc6ad24428da39f64d03b91bc /util.c
parenta56128cb6b3ea4627b6695edab03059309381357 (diff)
downloadperl-74cac757131a44f884c4728708d3a2e5d87b32d3.tar.gz
Add fwalk() probe to the configuration files and regen perltoc.
p4raw-id: //depot/perl@7705
Diffstat (limited to 'util.c')
-rw-r--r--util.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/util.c b/util.c
index fe88f23414..6a68fe6c2a 100644
--- a/util.c
+++ b/util.c
@@ -3876,30 +3876,36 @@ Perl_get_vtbl(pTHX_ int vtbl_id)
I32
Perl_my_fflush_all(pTHX)
{
-#ifdef FFLUSH_NULL
+#if defined(FFLUSH_NULL)
return PerlIO_flush(NULL);
#else
+# if defined(HAS__FWALK)
+ /* undocumented, unprototyped, but very useful BSDism */
+ extern void _fwalk(int (*)(FILE *));
+ _fwalk(&fflush);
+ return 0;
+# else
long open_max = -1;
-# if defined(FFLUSH_ALL) && defined(HAS_STDIO_STREAM_ARRAY)
-# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
+# if defined(FFLUSH_ALL) && defined(HAS_STDIO_STREAM_ARRAY)
+# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
-# else
-# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
+# else
+# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
open_max = sysconf(_SC_OPEN_MAX);
-# else
-# ifdef FOPEN_MAX
- open_max = FOPEN_MAX;
# else
-# ifdef OPEN_MAX
- open_max = OPEN_MAX;
+# ifdef FOPEN_MAX
+ open_max = FOPEN_MAX;
# else
-# ifdef _NFILE
+# ifdef OPEN_MAX
+ open_max = OPEN_MAX;
+# else
+# ifdef _NFILE
open_max = _NFILE;
+# endif
# endif
# endif
# endif
-# endif
-# endif
+# endif
if (open_max > 0) {
long i;
for (i = 0; i < open_max; i++)
@@ -3909,9 +3915,10 @@ Perl_my_fflush_all(pTHX)
PerlIO_flush(&STDIO_STREAM_ARRAY[i]);
return 0;
}
-# endif
+# endif
SETERRNO(EBADF,RMS$_IFI);
return EOF;
+# endif
#endif
}