# include <unistd.h>
#endif
#ifdef I_FCNTL
+#if defined(__GNUC__) && defined(__cplusplus) && defined(WIN32)
+#define _NO_OLDNAMES
+#endif
# include <fcntl.h>
+#if defined(__GNUC__) && defined(__cplusplus) && defined(WIN32)
+#undef _NO_OLDNAMES
+#endif
+
#endif
#ifdef PerlIO
#endif
static int
-not_here(s)
-char *s;
+not_here(char *s)
{
croak("%s not implemented on this architecture", s);
return -1;
}
static bool
-constant(name, pval)
-char *name;
-IV *pval;
+constant(char *name, IV *pval)
{
switch (*name) {
case '_':
ST(0) = sv_2mortal(newSVpv((char*)&pos, sizeof(Fpos_t)));
}
else {
- ST(0) = &sv_undef;
+ ST(0) = &PL_sv_undef;
errno = EINVAL;
}
InputStream handle
SV * pos
CODE:
- if (handle)
+ char *p;
+ if (handle && (p = SvPVx(pos, PL_na)) && PL_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;
SvREFCNT_dec(gv); /* undo increment in newRV() */
}
else {
- ST(0) = &sv_undef;
+ ST(0) = &PL_sv_undef;
SvREFCNT_dec(gv);
}
if (constant(name, &i))
ST(0) = sv_2mortal(newSViv(i));
else
- ST(0) = &sv_undef;
+ ST(0) = &PL_sv_undef;
int
ungetc(handle, c)
CODE:
/* 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 {