io = GvIO(gv);
if (!io) { /* never opened */
if (not_implicit) {
- if (ckWARN(WARN_UNOPENED)) /* no check for closed here */
- report_evil_fh(gv, PL_op->op_type);
+ report_evil_fh(gv);
SETERRNO(EBADF,SS_IVCHAN);
}
return FALSE;
if (!io)
return TRUE;
- else if ((IoTYPE(io) == IoTYPE_WRONLY) && ckWARN(WARN_IO))
+ else if (IoTYPE(io) == IoTYPE_WRONLY)
report_wrongway_fh(gv, '>');
while (IoIFP(io)) {
Perl_do_tell(pTHX_ GV *gv)
{
dVAR;
- register IO *io = NULL;
+ IO *const io = GvIO(gv);
register PerlIO *fp;
PERL_ARGS_ASSERT_DO_TELL;
- if (gv && (io = GvIO(gv)) && (fp = IoIFP(io))) {
+ if (io && (fp = IoIFP(io))) {
#ifdef ULTRIX_STDIO_BOTCH
if (PerlIO_eof(fp))
(void)PerlIO_seek(fp, 0L, 2); /* ultrix 1.2 workaround */
#endif
return PerlIO_tell(fp);
}
- if (ckWARN2(WARN_UNOPENED,WARN_CLOSED))
- report_evil_fh(gv, PL_op->op_type);
+ report_evil_fh(gv);
SETERRNO(EBADF,RMS_IFI);
return (Off_t)-1;
}
Perl_do_seek(pTHX_ GV *gv, Off_t pos, int whence)
{
dVAR;
- register IO *io = NULL;
+ IO *const io = GvIO(gv);
register PerlIO *fp;
- if (gv && (io = GvIO(gv)) && (fp = IoIFP(io))) {
+ if (io && (fp = IoIFP(io))) {
#ifdef ULTRIX_STDIO_BOTCH
if (PerlIO_eof(fp))
(void)PerlIO_seek(fp, 0L, 2); /* ultrix 1.2 workaround */
#endif
return PerlIO_seek(fp, pos, whence) >= 0;
}
- if (ckWARN2(WARN_UNOPENED,WARN_CLOSED))
- report_evil_fh(gv, PL_op->op_type);
+ report_evil_fh(gv);
SETERRNO(EBADF,RMS_IFI);
return FALSE;
}
Perl_do_sysseek(pTHX_ GV *gv, Off_t pos, int whence)
{
dVAR;
- register IO *io = NULL;
+ IO *const io = GvIO(gv);
register PerlIO *fp;
PERL_ARGS_ASSERT_DO_SYSSEEK;
- if (gv && (io = GvIO(gv)) && (fp = IoIFP(io)))
+ if (io && (fp = IoIFP(io)))
return PerlLIO_lseek(PerlIO_fileno(fp), pos, whence);
- if (ckWARN2(WARN_UNOPENED,WARN_CLOSED))
- report_evil_fh(gv, PL_op->op_type);
+ report_evil_fh(gv);
SETERRNO(EBADF,RMS_IFI);
return (Off_t)-1;
}
tmpbuf = bytes_to_utf8((const U8*) tmps, &len);
tmps = (char *) tmpbuf;
}
+ else if (ckWARN_d(WARN_UTF8)) {
+ (void) check_utf8_print((const U8*) tmps, len);
+ }
}
else if (DO_UTF8(sv)) {
STRLEN tmplen = len;
"Wide character in %s",
PL_op ? OP_DESC(PL_op) : "print"
);
+ /* Could also check that isn't one of the things to avoid
+ * in utf8 by using check_utf8_print(), but not doing so,
+ * since the stream isn't a UTF8 stream */
}
}
/* To detect whether the process is about to overstep its
} else if (IoDIRP(io)) {
return (PL_laststatval = PerlLIO_fstat(my_dirfd(IoDIRP(io)), &PL_statcache));
} else {
- if (ckWARN2(WARN_UNOPENED,WARN_CLOSED))
- report_evil_fh(gv, PL_op->op_type);
+ report_evil_fh(gv);
return (PL_laststatval = -1);
}
} else {
- if (ckWARN2(WARN_UNOPENED,WARN_CLOSED))
- report_evil_fh(gv, PL_op->op_type);
+ report_evil_fh(gv);
return (PL_laststatval = -1);
}
}
/* [Comments and code from Len Reed]
* MS-DOS "user" is similar to UNIX's "superuser," but can't write
* to write-protected files. The execute permission bit is set
- * by the Miscrosoft C library stat() function for the following:
+ * by the Microsoft C library stat() function for the following:
* .exe files
* .com files
* .bat files