summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorBen Morrow <ben@morrow.me.uk>2009-01-18 08:56:11 +0000
committerBen Morrow <ben@morrow.me.uk>2009-03-25 21:14:04 +0000
commit07fe7c6a9fbc767805839cebb0e0e06dd88b0104 (patch)
tree5b33525d73cb484448e61d656cbbbe9db17a24bd /pp_sys.c
parent180b7b9bf7b919003df56bf402fc3934dc71f196 (diff)
downloadperl-07fe7c6a9fbc767805839cebb0e0e06dd88b0104.tar.gz
Finish the rest of the -X ops.
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c42
1 files changed, 40 insertions, 2 deletions
diff --git a/pp_sys.c b/pp_sys.c
index 1945b13d9e..374e5c12c8 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -2983,7 +2983,7 @@ PP(pp_ftrread)
int stat_mode = S_IRUSR;
bool effective = FALSE;
- char opchar;
+ char opchar = '?';
dSP;
STACKED_FTEST_CHECK;
@@ -3090,8 +3090,19 @@ PP(pp_ftis)
dVAR;
I32 result;
const int op_type = PL_op->op_type;
+ char opchar = '?';
dSP;
STACKED_FTEST_CHECK;
+
+ switch (op_type) {
+ case OP_FTIS: opchar = 'e'; break;
+ case OP_FTSIZE: opchar = 's'; break;
+ case OP_FTMTIME: opchar = 'M'; break;
+ case OP_FTCTIME: opchar = 'C'; break;
+ case OP_FTATIME: opchar = 'A'; break;
+ }
+ tryAMAGICftest(opchar);
+
result = my_stat();
SPAGAIN;
if (result < 0)
@@ -3128,10 +3139,12 @@ PP(pp_ftrowned)
{
dVAR;
I32 result;
+ char opchar = '?';
dSP;
/* I believe that all these three are likely to be defined on most every
system these days. */
+ if (!SvAMAGIC(TOPs)) {
#ifndef S_ISUID
if(PL_op->op_type == OP_FTSUID)
RETPUSHNO;
@@ -3144,8 +3157,26 @@ PP(pp_ftrowned)
if(PL_op->op_type == OP_FTSVTX)
RETPUSHNO;
#endif
+ }
STACKED_FTEST_CHECK;
+
+ switch (PL_op->op_type) {
+ case OP_FTROWNED: opchar = 'O'; break;
+ case OP_FTEOWNED: opchar = 'o'; break;
+ case OP_FTZERO: opchar = 'z'; break;
+ case OP_FTSOCK: opchar = 'S'; break;
+ case OP_FTCHR: opchar = 'c'; break;
+ case OP_FTBLK: opchar = 'b'; break;
+ case OP_FTFILE: opchar = 'f'; break;
+ case OP_FTDIR: opchar = 'd'; break;
+ case OP_FTPIPE: opchar = 'p'; break;
+ case OP_FTSUID: opchar = 'u'; break;
+ case OP_FTSGID: opchar = 'g'; break;
+ case OP_FTSVTX: opchar = 'k'; break;
+ }
+ tryAMAGICftest(opchar);
+
result = my_stat();
SPAGAIN;
if (result < 0)
@@ -3212,8 +3243,11 @@ PP(pp_ftrowned)
PP(pp_ftlink)
{
dVAR;
- I32 result = my_lstat();
+ I32 result;
dSP;
+
+ tryAMAGICftest('l');
+ result = my_lstat();
if (result < 0)
RETPUSHUNDEF;
if (S_ISLNK(PL_statcache.st_mode))
@@ -3231,6 +3265,8 @@ PP(pp_fttty)
STACKED_FTEST_CHECK;
+ tryAMAGICftest('t');
+
if (PL_op->op_flags & OPf_REF)
gv = cGVOP_gv;
else if (isGV(TOPs))
@@ -3280,6 +3316,8 @@ PP(pp_fttext)
STACKED_FTEST_CHECK;
+ tryAMAGICftest(PL_op->op_type == OP_FTTEXT ? 'T' : 'B');
+
if (PL_op->op_flags & OPf_REF)
gv = cGVOP_gv;
else if (isGV(TOPs))