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

version» Context lines:

pike.git/src/modules/_Stdio/efuns.c:394:    *! @seealso    *! @[Stdio.Stat], @[Stdio.File->stat()]    */   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); +  SIMPLE_WRONG_NUM_ARGS_ERROR("file_stat", 1);    if((TYPEOF(sp[-args]) != T_STRING) || sp[-args].u.string->size_shift)    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);
pike.git/src/modules/_Stdio/efuns.c:446:   void f_file_truncate(INT32 args)   {   #if defined(INT64)    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(args != 2) +  SIMPLE_WRONG_NUM_ARGS_ERROR("file_truncate", 2);    if(TYPEOF(sp[-args]) != T_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
pike.git/src/modules/_Stdio/efuns.c:676: Inside #if defined(HAVE_USTAT)
   PIKE_STAT_T statbuf;    struct ustat st;   #else /* !HAVE_USTAT */   #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(args!=1) +  SIMPLE_WRONG_NUM_ARGS_ERROR("filesystem_stat", 1);    if(TYPEOF(sp[-args]) != T_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);
pike.git/src/modules/_Stdio/efuns.c:805:    *! @[mkdir()], @[Stdio.recursive_rm()]    */   void f_rm(INT32 args)   {    PIKE_STAT_T st;    INT32 i;    struct pike_string *str;       destruct_objects_to_destruct();    -  if(!args) -  SIMPLE_TOO_FEW_ARGS_ERROR("rm", 1); +  if(args!=1) +  SIMPLE_WRONG_NUM_ARGS_ERROR("rm", 1);       if(TYPEOF(sp[-args]) != T_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);
pike.git/src/modules/_Stdio/efuns.c:889:    *! @[rm()], @[cd()], @[Stdio.mkdirhier()]    */   void f_mkdir(INT32 args)   {    struct pike_string *str;    int mode;    int i;    char *s, *s_dup;       if(!args) -  SIMPLE_TOO_FEW_ARGS_ERROR("mkdir", 1); +  SIMPLE_WRONG_NUM_ARGS_ERROR("mkdir", 1);       if(TYPEOF(sp[-args]) != T_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");
pike.git/src/modules/_Stdio/efuns.c:1382:    *! Returns @expr{1@} for success, @expr{0@} (zero) otherwise.    *!    *! @seealso    *! @[getcwd()]    */   void f_cd(INT32 args)   {    INT32 i;    struct pike_string *str;    -  if(!args) -  SIMPLE_TOO_FEW_ARGS_ERROR("cd", 1); +  if(args!=1) +  SIMPLE_WRONG_NUM_ARGS_ERROR("cd", 1);       if(TYPEOF(sp[-args]) != T_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);
pike.git/src/modules/_Stdio/efuns.c:1484: Inside #if defined(HAVE_EXECVE)
   char **argv, **env;    struct svalue *save_sp;    struct mapping *en;   #ifdef DECLARE_ENVIRON    extern char **environ;   #endif       save_sp=sp-args;       if(args < 2) -  SIMPLE_TOO_FEW_ARGS_ERROR("exece", 2); +  SIMPLE_WRONG_NUM_ARGS_ERROR("exece", 2);       e=0;    en=0;    switch(args)    {    default:    if(TYPEOF(sp[2-args]) != T_MAPPING)    SIMPLE_ARG_TYPE_ERROR("exece", 3, "mapping(string:string)");    en=sp[2-args].u.mapping;    mapping_fix_type_field(en);
pike.git/src/modules/_Stdio/efuns.c:1612:   {    INT32 i;    struct pike_string *str1;    struct pike_string *str2;   #ifdef __NT__    int orig_errno = errno;    int err;    PIKE_STAT_T st;   #endif    -  if(args<2) -  SIMPLE_TOO_FEW_ARGS_ERROR("mv", 2); +  if(args!=2) +  SIMPLE_WRONG_NUM_ARGS_ERROR("mv", 2);       if(TYPEOF(sp[-args]) != T_STRING)    SIMPLE_ARG_TYPE_ERROR("mv", 1, "string");       if(TYPEOF(sp[-args+1]) != T_STRING)    SIMPLE_ARG_TYPE_ERROR("mv", 2, "string");       str1 = sp[-args].u.string;    str2 = sp[1-args].u.string;   
pike.git/src/modules/_Stdio/efuns.c:1818:    *! code is usually obtained from eg @[Stdio.File->errno()].    *!    *! @note    *! 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(args!=1) +  SIMPLE_WRONG_NUM_ARGS_ERROR("strerror", 1);    if(TYPEOF(sp[-args]) != T_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);