*** src/o_eval.c 2007-05-25 08:52:12.000000000 -0400 --- src/eval.c 2007-05-25 09:04:43.000000000 -0400 *************** *** 7094,7100 **** {"getcwd", 0, 0, f_getcwd}, {"getfontname", 0, 1, f_getfontname}, {"getfperm", 1, 1, f_getfperm}, ! {"getfsize", 1, 1, f_getfsize}, {"getftime", 1, 1, f_getftime}, {"getftype", 1, 1, f_getftype}, {"getline", 1, 2, f_getline}, --- 7094,7100 ---- {"getcwd", 0, 0, f_getcwd}, {"getfontname", 0, 1, f_getfontname}, {"getfperm", 1, 1, f_getfperm}, ! {"getfsize", 1, 2, f_getfsize}, {"getftime", 1, 1, f_getftime}, {"getftype", 1, 1, f_getftype}, {"getline", 1, 2, f_getline}, *************** *** 10135,10142 **** { if (mch_isdir(fname)) rettv->vval.v_number = 0; ! else rettv->vval.v_number = (varnumber_T)st.st_size; } else rettv->vval.v_number = -1; --- 10135,10151 ---- { if (mch_isdir(fname)) rettv->vval.v_number = 0; ! else if (argvars[1].v_type == VAR_UNKNOWN) rettv->vval.v_number = (varnumber_T)st.st_size; + else + { + unsigned long unitsize; + unsigned long stsize; + unitsize= get_tv_number(&argvars[1]); + stsize= st.st_size/unitsize; + if(stsize*unitsize < st.st_size) ++stsize; + rettv->vval.v_number = (varnumber_T) stsize; + } } else rettv->vval.v_number = -1; *** runtime/doc/o_eval.txt 2007-05-25 09:00:08.000000000 -0400 --- runtime/doc/eval.txt 2007-05-25 09:06:19.000000000 -0400 *************** *** 1615,1621 **** getcmdtype() String return the current command-line type getcwd() String the current working directory getfperm( {fname}) String file permissions of file {fname} ! getfsize( {fname}) Number size in bytes of file {fname} getfontname( [{name}]) String name of font being used getftime( {fname}) Number last modification time of file getftype( {fname}) String description of type of file {fname} --- 1615,1621 ---- getcmdtype() String return the current command-line type getcwd() String the current working directory getfperm( {fname}) String file permissions of file {fname} ! getfsize( {fname} [,unitsize]) Number size in bytes of file {fname} getfontname( [{name}]) String name of font being used getftime( {fname}) Number last modification time of file getftype( {fname}) String description of type of file {fname} *************** *** 2819,2827 **** getcwd() The result is a String, which is the name of the current working directory. ! getfsize({fname}) *getfsize()* The result is a Number, which is the size in bytes of the given file {fname}. If {fname} is a directory, 0 is returned. If the file {fname} can't be found, -1 is returned. --- 2819,2829 ---- getcwd() The result is a String, which is the name of the current working directory. ! getfsize({fname} [,unitsize]) *getfsize()* The result is a Number, which is the size in bytes of the given file {fname}. + If unitsize is given, then the file {fname}'s size will be + returned in units of size unitsize bytes (truncated up). If {fname} is a directory, 0 is returned. If the file {fname} can't be found, -1 is returned.