summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPerl 5 Porters <perl5-porters@africa.nicoh.com>1996-02-10 02:06:58 +0000
committerAndy Dougherty <doughera@lafcol.lafayette.edu>1996-02-10 02:06:58 +0000
commit80368503fa0e56f42725ce2936d9e73f6d9033b6 (patch)
tree864a47be93116a8d18307c49c73bfe932cbfe40e
parentdd7f575909ebc69e291e1e8c76970c6fa8cac237 (diff)
downloadperl-80368503fa0e56f42725ce2936d9e73f6d9033b6.tar.gz
perl 5.002gamma: ext/FileHandle/FileHandle.xs
Allow compilation even if f[sg]etpos not available. Allow compilation even if setvbuf() is not available.
-rw-r--r--ext/FileHandle/FileHandle.xs22
1 files changed, 20 insertions, 2 deletions
diff --git a/ext/FileHandle/FileHandle.xs b/ext/FileHandle/FileHandle.xs
index d9c8b68dc1..3a99cf1dc8 100644
--- a/ext/FileHandle/FileHandle.xs
+++ b/ext/FileHandle/FileHandle.xs
@@ -7,6 +7,14 @@ typedef int SysRet;
typedef FILE * InputStream;
typedef FILE * OutputStream;
+static int
+not_here(s)
+char *s;
+{
+ croak("FileHandle::%s not implemented on this architecture", s);
+ return -1;
+}
+
static bool
constant(name, pval)
char *name;
@@ -57,6 +65,7 @@ SV *
fgetpos(handle)
InputStream handle
CODE:
+#ifdef HAS_FGETPOS
if (handle) {
Fpos_t pos;
fgetpos(handle, &pos);
@@ -66,18 +75,25 @@ fgetpos(handle)
ST(0) = &sv_undef;
errno = EINVAL;
}
+#else
+ ST(0) = (SV *) not_here("fgetpos");
+#endif
SysRet
fsetpos(handle, pos)
InputStream handle
SV * pos
CODE:
+#ifdef HAS_FSETPOS
if (handle)
RETVAL = fsetpos(handle, (Fpos_t*)SvPVX(pos));
else {
RETVAL = -1;
errno = EINVAL;
}
+#else
+ RETVAL = (SysRet) not_here("fsetpos");
+#endif
OUTPUT:
RETVAL
@@ -138,7 +154,6 @@ setbuf(handle, buf)
setbuf(handle, buf);
-#ifdef _IOFBF
SysRet
setvbuf(handle, buf, type, size)
@@ -147,13 +162,16 @@ setvbuf(handle, buf, type, size)
int type
int size
CODE:
+#ifdef _IOFBF /* Should be HAS_SETVBUF once Configure tests for that */
if (handle)
RETVAL = setvbuf(handle, buf, type, size);
else {
RETVAL = -1;
errno = EINVAL;
}
+#else
+ RETVAL = (SysRet) not_here("setvbuf");
+#endif /* _IOFBF */
OUTPUT:
RETVAL
-#endif /* _IOFBF */