summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-04-04 13:20:39 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-04-04 13:20:39 +0000
commit771c8da8a7459d77e0377cf0a891bf62d70cdfa2 (patch)
tree117a49b9a31d771d580fc2a7840fb456b8f325d4 /util.c
parent7d3fb23018f73b213481a8b6b108e1dc03cefcff (diff)
downloadperl-771c8da8a7459d77e0377cf0a891bf62d70cdfa2.tar.gz
Make the stdio tricks of fflush_all() to exist only if
stdio is being used. p4raw-id: //depot/perl@9542
Diffstat (limited to 'util.c')
-rw-r--r--util.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/util.c b/util.c
index 7e3934eee7..012928573a 100644
--- a/util.c
+++ b/util.c
@@ -3958,49 +3958,52 @@ Perl_get_vtbl(pTHX_ int vtbl_id)
return result;
}
-#if !defined(FFLUSH_NULL) && defined(HAS__FWALK)
+#ifdef PERLIO_IS_STDIO
+# if !defined(FFLUSH_NULL) && defined(HAS__FWALK)
static int S_fflush(FILE *fp);
static int
S_fflush(FILE *fp)
{
- return fflush(fp);
+ return fflush(fp); /* fflush() maybe a macro but we need a function */
}
+# endif
#endif
I32
Perl_my_fflush_all(pTHX)
{
-#if defined(FFLUSH_NULL)
+#ifdef FFLUSH_NULL
return PerlIO_flush(NULL);
#else
-# if defined(HAS__FWALK)
+# ifdef PERLIO_IS_STDIO
+# if defined(HAS__FWALK)
/* undocumented, unprototyped, but very useful BSDism */
extern void _fwalk(int (*)(FILE *));
_fwalk(&S_fflush);
return 0;
-# else
+# 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
+# else
+# ifdef FOPEN_MAX
open_max = FOPEN_MAX;
-# else
-# ifdef OPEN_MAX
+# else
+# ifdef OPEN_MAX
open_max = OPEN_MAX;
-# else
-# ifdef _NFILE
+# 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++)
@@ -4010,9 +4013,10 @@ Perl_my_fflush_all(pTHX)
PerlIO_flush(&STDIO_STREAM_ARRAY[i]);
return 0;
}
-# endif
+# endif
SETERRNO(EBADF,RMS$_IFI);
return EOF;
+# endif
# endif
#endif
}