pike.git / src / modules / _Stdio / stat.c

version» Context lines:

pike.git/src/modules/_Stdio/stat.c:463:    case S_IFDIR: ref_push_string(str_type_dir); break;    case S_IFLNK: ref_push_string(str_type_lnk); break;    case S_IFCHR: ref_push_string(str_type_chr); break;    case S_IFBLK: ref_push_string(str_type_blk); break;    case S_IFIFO: ref_push_string(str_type_fifo); break;    case S_IFSOCK: ref_push_string(str_type_sock); break;    default: ref_push_string(str_type_unknown); break;    }    break;    -  case STAT_MODE_STRING: -  switch (THIS_STAT->s.st_mode & S_IFMT) +  case STAT_MODE_STRING: { +  int mode = THIS_STAT->s.st_mode; +  switch (mode & S_IFMT)    {    case S_IFREG:    push_constant_text("-");    break;    case S_IFDIR:    push_constant_text("d");    break;    case S_IFLNK:    push_constant_text("l");    break;
pike.git/src/modules/_Stdio/stat.c:492:    push_constant_text("f");    break;    case S_IFSOCK:    push_constant_text("s");    break;    default:    push_constant_text("?");    break;    }    -  if ( (THIS_STAT->s.st_mode & S_IRUSR) ) +  if ( (mode & S_IRUSR) )    push_constant_text("r");    else    push_constant_text("-");    -  if ( (THIS_STAT->s.st_mode & S_IWUSR) ) +  if ( (mode & S_IWUSR) )    push_constant_text("w");    else    push_constant_text("-");    -  if ( (THIS_STAT->s.st_mode & S_ISUID) ) -  if ( (THIS_STAT->s.st_mode & S_IXUSR) ) +  if ( (mode & S_ISUID) ) +  if ( (mode & S_IXUSR) )    push_constant_text("s");    else    push_constant_text("S");    else -  if ( (THIS_STAT->s.st_mode & S_IXUSR) ) +  if ( (mode & S_IXUSR) )    push_constant_text("x");    else    push_constant_text("-");    -  if ( (THIS_STAT->s.st_mode & S_IRGRP) ) +  if ( (mode & S_IRGRP) )    push_constant_text("r");    else    push_constant_text("-");    -  if ( (THIS_STAT->s.st_mode & S_IWGRP) ) +  if ( (mode & S_IWGRP) )    push_constant_text("w");    else    push_constant_text("-");    -  if ( (THIS_STAT->s.st_mode & S_ISGID) ) -  if ( (THIS_STAT->s.st_mode & S_IXGRP) ) +  if ( (mode & S_ISGID) ) +  if ( (mode & S_IXGRP) )    push_constant_text("s");    else    push_constant_text("S");    else -  if ( (THIS_STAT->s.st_mode & S_IXGRP) ) +  if ( (mode & S_IXGRP) )    push_constant_text("x");    else    push_constant_text("-");    -  if ( (THIS_STAT->s.st_mode & S_IROTH) ) +  if ( (mode & S_IROTH) )    push_constant_text("r");    else    push_constant_text("-");    -  if ( (THIS_STAT->s.st_mode & S_IWOTH) ) +  if ( (mode & S_IWOTH) )    push_constant_text("w");    else    push_constant_text("-");    -  if ( (THIS_STAT->s.st_mode & S_ISVTX) ) -  if ( (THIS_STAT->s.st_mode & S_IXOTH) ) +  if ( (mode & S_ISVTX) ) +  if ( (mode & S_IXOTH) )    push_constant_text("t");    else    push_constant_text("T");    else -  if ( (THIS_STAT->s.st_mode & S_IXOTH) ) +  if ( (mode & S_IXOTH) )    push_constant_text("x");    else    push_constant_text("-");       f_add(10);       break; -  +  }    default:    Pike_fatal ("stat_index is not kept up-to-date with stat_map.\n");    }    }    else    SIMPLE_BAD_ARG_ERROR("Stat `[]",1,"int(0..6)|string");    }    else if (args>=2) /* range */    {    INT_TYPE from, to, n=0;