InputStream handle
SV * pos
CODE:
- if (handle)
+ char *p;
+ if (handle && (p = SvPVx(pos, na)) && na == sizeof(Fpos_t))
#ifdef PerlIO
- RETVAL = PerlIO_setpos(handle, (Fpos_t*)SvPVX(pos));
+ RETVAL = PerlIO_setpos(handle, (Fpos_t*)p);
#else
- RETVAL = fsetpos(handle, (Fpos_t*)SvPVX(pos));
+ RETVAL = fsetpos(handle, (Fpos_t*)p);
#endif
else {
RETVAL = -1;
int type
int size
CODE:
-#ifdef PERLIO_IS_STDIO
-#ifdef _IOFBF /* Should be HAS_SETVBUF once Configure tests for that */
+/* Should check HAS_SETVBUF once Configure tests for that */
+#if defined(PERLIO_IS_STDIO) && defined(_IOFBF)
+ if (!handle) /* Try input stream. */
+ handle = IoIFP(sv_2io(ST(0)));
if (handle)
RETVAL = setvbuf(handle, buf, type, size);
else {
errno = EINVAL;
}
#else
- RETVAL = (SysRet) not_here("IO::Handle::setvbuf");
-#endif /* _IOFBF */
-#else
- not_here("IO::Handle::setvbuf");
+ RETVAL = (SysRet) not_here("IO::Handle::setvbuf");
#endif
OUTPUT:
RETVAL