webmcp
diff libraries/extos/extos.autodoc.lua @ 351:b1748c6c3c89
extos.stat(...) returns false (instead of nil) if file does not exist; Added extos.lstat(...) and extos.fstat(...)
| author | jbe |
|---|---|
| date | Thu Mar 26 16:38:30 2015 +0100 (2015-03-26) |
| parents | 546ec50e7170 |
| children | c7a27cfd07d0 |
line diff
1.1 --- a/libraries/extos/extos.autodoc.lua Thu Mar 26 12:26:00 2015 +0100 1.2 +++ b/libraries/extos/extos.autodoc.lua Thu Mar 26 16:38:30 2015 +0100 1.3 @@ -20,13 +20,30 @@ 1.4 1.5 1.6 --[[-- 1.7 -filestat_table, -- table with information on the file 1.8 -errmsg = -- error message if file information could not be read 1.9 +directory_entries, -- table of directory entries 1.10 +errmsg = -- error message if directory could not be read 1.11 +extos.listdir( 1.12 + path -- path name 1.13 +) 1.14 + 1.15 +This function returns a table containing strings representing each entry in a directory. On error nil and an error message are returned. 1.16 + 1.17 +--]]-- 1.18 +-- implemented in extos.c as 1.19 +-- static int extos_listdir(lua_State *L) 1.20 +--//-- 1.21 + 1.22 + 1.23 +--[[-- 1.24 +filestat_table, -- table with information on the file, false if file does not exist, nil on error 1.25 +errmsg = -- error message if file information could not be read or file does not exist 1.26 extos.stat( 1.27 filename -- path to a file on the file system 1.28 ) 1.29 1.30 -Return information on a file. The returned table contains the following fields: 1.31 +Return information on a file, following symbolic links if applicable. See also: extos.lstat(...) and extos.fstat(...). 1.32 + 1.33 +The returned table contains the following fields: 1.34 1.35 - "dev" (numeric ID of the device containing the file) 1.36 - "ino" (file's inode number) 1.37 @@ -48,7 +65,9 @@ 1.38 - "isreg" (true if regular file) 1.39 - "issock" (true if socket) 1.40 1.41 -On error, nil and an error message are returned. 1.42 +If the file does not exist, false and an error message are returned. 1.43 +In case of any other error, nil and an error message are returned. 1.44 + 1.45 1.46 --]]-- 1.47 -- implemented in extos.c as 1.48 @@ -57,17 +76,36 @@ 1.49 1.50 1.51 --[[-- 1.52 -directory_entries, -- table of directory entries 1.53 -errmsg = -- error message if directory could not be read 1.54 -extos.listdir( 1.55 - path -- path name 1.56 +filestat_table, -- table with information on the file, false if file does not exist, nil on error 1.57 +errmsg = -- error message if file information could not be read or file does not exist 1.58 +extos.lstat( 1.59 + filename -- path to a file on the file system 1.60 ) 1.61 1.62 -This function returns a table containing strings representing each entry in a directory. On error nil and an error message are returned. 1.63 +Return information on a file. Symbolic links are not followed, which means that if the filename points to a symbolic link, information on that symbolic link will be returned. Otherwise this function behaves like extos.stat(filename). 1.64 + 1.65 +See extos.stat(...) for further information. 1.66 1.67 --]]-- 1.68 -- implemented in extos.c as 1.69 --- static int extos_listdir(lua_State *L) 1.70 +-- static int extos_stat(lua_State *L) 1.71 +--//-- 1.72 + 1.73 + 1.74 +--[[-- 1.75 +filestat_table, -- table with information on the file, nil on error 1.76 +errmsg = -- error message if file information could not be determined 1.77 +extos.fstat( 1.78 + file_handle -- Lua file handle (e.g. as returned by io.open(...)) 1.79 +) 1.80 + 1.81 +Return information on an open file. The file is specified by passing an open file handle to this function. Otherwise this function behaves like extos.stat(...). 1.82 + 1.83 +See extos.stat(...) for further information. 1.84 + 1.85 +--]]-- 1.86 +-- implemented in extos.c as 1.87 +-- static int extos_stat(lua_State *L) 1.88 --//-- 1.89 1.90