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

version» Context lines:

pike.git/src/modules/_Stdio/efuns.c:396:    */   void f_file_stat(INT32 args)   {    PIKE_STAT_T st;    int i, l;    struct pike_string *str;       if(args<1)    SIMPLE_TOO_FEW_ARGS_ERROR("file_stat", 1);    if((TYPEOF(sp[-args]) != T_STRING) || sp[-args].u.string->size_shift) -  SIMPLE_BAD_ARG_ERROR("file_stat", 1, "string(0..255)"); +  SIMPLE_ARG_TYPE_ERROR("file_stat", 1, "string(0..255)");       str = sp[-args].u.string;    l = (args>1 && !UNSAFE_IS_ZERO(sp+1-args))?1:0;       if (string_has_null(str)) {    /* Filenames with NUL are not supported. */    errno = ENOENT;    pop_n_elems(args);    push_int(0);    return;
pike.git/src/modules/_Stdio/efuns.c:449:    INT64 len = 0;   #else    off_t len = 0;   #endif    struct pike_string *str;    int res;       if(args < 2)    SIMPLE_TOO_FEW_ARGS_ERROR("file_truncate", 2);    if(TYPEOF(sp[-args]) != T_STRING) -  SIMPLE_BAD_ARG_ERROR("file_truncate", 1, "string"); +  SIMPLE_ARG_TYPE_ERROR("file_truncate", 1, "string");      #if defined (INT64)   #if defined (HAVE_FTRUNCATE64) || SIZEOF_OFF_T > SIZEOF_INT_TYPE    if(is_bignum_object_in_svalue(&Pike_sp[1-args])) {    if (!int64_from_bignum(&len, Pike_sp[1-args].u.object))    Pike_error ("Bad argument 2 to file_truncate(). Length too large.\n");    }    else   #endif   #endif    if(TYPEOF(sp[1-args]) != T_INT) -  SIMPLE_BAD_ARG_ERROR("file_truncate", 2, "int"); +  SIMPLE_ARG_TYPE_ERROR("file_truncate", 2, "int");    else    len = sp[1-args].u.integer;       str = sp[-args].u.string;       if (string_has_null(str)) {    /* Filenames with NUL are not supported. */    errno = ENOENT;    pop_n_elems(args);    push_int(0);
pike.git/src/modules/_Stdio/efuns.c:679:   #error No stat function for filesystems.   #endif /* HAVE_USTAT */   #endif /* HAVE_STATFS */   #endif /* HAVE_STATVFS */    int i;    struct pike_string *str;       if(args<1)    SIMPLE_TOO_FEW_ARGS_ERROR("filesystem_stat", 1);    if(TYPEOF(sp[-args]) != T_STRING) -  SIMPLE_BAD_ARG_ERROR("filesystem_stat", 1, "string"); +  SIMPLE_ARG_TYPE_ERROR("filesystem_stat", 1, "string");       str = sp[-args].u.string;       if (string_has_null(str)) {    /* Filenames with NUL are not supported. */    errno = ENOENT;    pop_n_elems(args);    push_int(0);    return;    }
pike.git/src/modules/_Stdio/efuns.c:809:    PIKE_STAT_T st;    INT32 i;    struct pike_string *str;       destruct_objects_to_destruct();       if(!args)    SIMPLE_TOO_FEW_ARGS_ERROR("rm", 1);       if(TYPEOF(sp[-args]) != T_STRING) -  SIMPLE_BAD_ARG_ERROR("rm", 1, "string"); +  SIMPLE_ARG_TYPE_ERROR("rm", 1, "string");       str = sp[-args].u.string;       if (string_has_null(str)) {    /* Filenames with NUL are not supported. */    errno = ENOENT;    pop_n_elems(args);    push_int(0);    return;    }
pike.git/src/modules/_Stdio/efuns.c:892:   {    struct pike_string *str;    int mode;    int i;    char *s, *s_dup;       if(!args)    SIMPLE_TOO_FEW_ARGS_ERROR("mkdir", 1);       if(TYPEOF(sp[-args]) != T_STRING) -  SIMPLE_BAD_ARG_ERROR("mkdir", 1, "string"); +  SIMPLE_ARG_TYPE_ERROR("mkdir", 1, "string");       mode = 0777; /* &'ed with ~umask anyway. */       if(args > 1)    {    if(TYPEOF(sp[1-args]) != T_INT)    Pike_error("Bad argument 2 to mkdir.\n");       mode = sp[1-args].u.integer;    }
pike.git/src/modules/_Stdio/efuns.c:1386:    */   void f_cd(INT32 args)   {    INT32 i;    struct pike_string *str;       if(!args)    SIMPLE_TOO_FEW_ARGS_ERROR("cd", 1);       if(TYPEOF(sp[-args]) != T_STRING) -  SIMPLE_BAD_ARG_ERROR("cd", 1, "string"); +  SIMPLE_ARG_TYPE_ERROR("cd", 1, "string");       str = sp[-args].u.string;       if (string_has_null(str)) {    /* Filenames with NUL are not supported. */    errno = ENOENT;    pop_n_elems(args);    push_int(0);    return;    }
pike.git/src/modules/_Stdio/efuns.c:1492: Inside #if defined(HAVE_EXECVE)
      if(args < 2)    SIMPLE_TOO_FEW_ARGS_ERROR("exece", 2);       e=0;    en=0;    switch(args)    {    default:    if(TYPEOF(sp[2-args]) != T_MAPPING) -  SIMPLE_BAD_ARG_ERROR("exece", 3, "mapping(string:string)"); +  SIMPLE_ARG_TYPE_ERROR("exece", 3, "mapping(string:string)");    en=sp[2-args].u.mapping;    mapping_fix_type_field(en);       if(m_ind_types(en) & ~BIT_STRING) -  SIMPLE_BAD_ARG_ERROR("exece", 3, "mapping(string:string)"); +  SIMPLE_ARG_TYPE_ERROR("exece", 3, "mapping(string:string)");    if(m_val_types(en) & ~BIT_STRING) -  SIMPLE_BAD_ARG_ERROR("exece", 3, "mapping(string:string)"); +  SIMPLE_ARG_TYPE_ERROR("exece", 3, "mapping(string:string)");       /* FALL_THROUGH */       case 2:    if(TYPEOF(sp[1-args]) != T_ARRAY) -  SIMPLE_BAD_ARG_ERROR("exece", 2, "array(string)"); +  SIMPLE_ARG_TYPE_ERROR("exece", 2, "array(string)");          if(array_fix_type_field(sp[1-args].u.array) & ~BIT_STRING) -  SIMPLE_BAD_ARG_ERROR("exece", 2, "array(string)"); +  SIMPLE_ARG_TYPE_ERROR("exece", 2, "array(string)");       /* FALL_THROUGH */       case 1:    if(TYPEOF(sp[0-args]) != T_STRING) -  SIMPLE_BAD_ARG_ERROR("exece", 1, "string"); +  SIMPLE_ARG_TYPE_ERROR("exece", 1, "string");    break;    }       argv=xalloc((2+sp[1-args].u.array->size) * sizeof(char *));       argv[0]=sp[0-args].u.string->str;       for(e=0;e<sp[1-args].u.array->size;e++)    {    union anything *a;
pike.git/src/modules/_Stdio/efuns.c:1616: Inside #if defined(__NT__)
  #ifdef __NT__    int orig_errno = errno;    int err;    PIKE_STAT_T st;   #endif       if(args<2)    SIMPLE_TOO_FEW_ARGS_ERROR("mv", 2);       if(TYPEOF(sp[-args]) != T_STRING) -  SIMPLE_BAD_ARG_ERROR("mv", 1, "string"); +  SIMPLE_ARG_TYPE_ERROR("mv", 1, "string");       if(TYPEOF(sp[-args+1]) != T_STRING) -  SIMPLE_BAD_ARG_ERROR("mv", 2, "string"); +  SIMPLE_ARG_TYPE_ERROR("mv", 2, "string");       str1 = sp[-args].u.string;    str2 = sp[1-args].u.string;       if (string_has_null(str1) || string_has_null(str2)) {    /* Filenames with NUL are not supported. */    if (string_has_null(str1)) {    errno = ENOENT;    } else {    errno = EINVAL;
pike.git/src/modules/_Stdio/efuns.c:1821:    *! On some platforms the string returned can be somewhat nondescriptive.    */   void f_strerror(INT32 args)   {    char *s;    int err;       if(!args)    SIMPLE_TOO_FEW_ARGS_ERROR("strerror", 1);    if(TYPEOF(sp[-args]) != T_INT) -  SIMPLE_BAD_ARG_ERROR("strerror", 1, "int"); +  SIMPLE_ARG_TYPE_ERROR("strerror", 1, "int");       err = sp[-args].u.integer;    pop_n_elems(args);    if(err < 0 || err > 256 )    s=0;    else {   #ifdef HAVE_STRERROR    s=strerror(err);   #else    s=0;