rev |
line source |
jbe@268
|
1
|
jbe@268
|
2 --[[--
|
jbe@268
|
3 data_out, -- string containing stdout data, or nil in case of error
|
jbe@268
|
4 data_err, -- string containing error or stderr data
|
jbe@268
|
5 status = -- exit code, or negative code in case of abnormal termination
|
jbe@268
|
6 extos.pfilter{
|
jbe@268
|
7 data_in = data_in, -- string containing stdin data
|
jbe@268
|
8 filename = filename, -- executable
|
jbe@268
|
9 arg1 = arg1, -- first (non-zero) argument to executable
|
jbe@268
|
10 arg2 = arg2, -- second argument to executable
|
jbe@268
|
11 ...
|
jbe@268
|
12 }
|
jbe@268
|
13
|
jbe@268
|
14 Executes the executable given by "filename", passing optional arguments. A given string may be fed into the program as stdin. On success 3 values are returned: A string containing all stdout data of the sub-process, a string containing all stderr data of the sub-process, and a status code. The status code is negative, if the program didn't terminate normally. By convention a status code of zero indicates success, while positive status codes indicate error conditions. If program execution was not possible at all, then nil is returned as first value and an error string as second value.
|
jbe@268
|
15
|
jbe@268
|
16 --]]--
|
jbe@268
|
17 -- implemented in extos.c as
|
jbe@268
|
18 -- static int extos_pfilter(lua_State *L)
|
jbe@268
|
19 --//--
|
jbe@268
|
20
|
jbe@268
|
21
|
jbe@268
|
22 --[[--
|
jbe@344
|
23 filestat_table, -- table with information on the file
|
jbe@344
|
24 errmsg = -- error message if file information could not be read
|
jbe@344
|
25 extos.stat(
|
jbe@344
|
26 filename -- path to a file on the file system
|
jbe@344
|
27 )
|
jbe@344
|
28
|
jbe@344
|
29 Return information on a file. The returned table contains the following fields:
|
jbe@344
|
30
|
jbe@344
|
31 - "dev" (numeric ID of the device containing the file)
|
jbe@344
|
32 - "ino" (file's inode number)
|
jbe@344
|
33 - "nlink" (number of hard links to the file)
|
jbe@344
|
34 - "atime" (time when file data was last accessed)
|
jbe@344
|
35 - "mtime" (time when file data was last modified)
|
jbe@344
|
36 - "ctime" (time when file status was last changed)
|
jbe@344
|
37 - "size" (file size in bytes)
|
jbe@344
|
38 - "blksize" (optimal I/O block size for the file)
|
jbe@344
|
39 - "blocks" (actual number of blocks allocated for the file in 512-byte units)
|
jbe@344
|
40 - "uid" (user ID of the file's owner)
|
jbe@344
|
41 - "gid" (group ID of the file)
|
jbe@344
|
42 - "mode" (bitfield including the access permissions)
|
jbe@344
|
43 - "isblk" (true if block special file)
|
jbe@344
|
44 - "ischr" (true if character special file)
|
jbe@344
|
45 - "isdir" (true if directory)
|
jbe@344
|
46 - "isfifo" (true if pope of FIFO special file)
|
jbe@344
|
47 - "islnk" (true if symbolic link)
|
jbe@344
|
48 - "isreg" (true if regular file)
|
jbe@344
|
49 - "issock" (true if socket)
|
jbe@344
|
50
|
jbe@344
|
51 On error, nil and an error message are returned.
|
jbe@344
|
52
|
jbe@344
|
53 --]]--
|
jbe@344
|
54 -- implemented in extos.c as
|
jbe@344
|
55 -- static int extos_stat(lua_State *L)
|
jbe@344
|
56 --//--
|
jbe@344
|
57
|
jbe@344
|
58
|
jbe@344
|
59 --[[--
|
jbe@268
|
60 directory_entries = -- table of directory entries
|
jbe@268
|
61 extos.listdir{
|
jbe@268
|
62 path = path -- path name
|
jbe@268
|
63 }
|
jbe@268
|
64
|
jbe@268
|
65 This function returns a table containing strings representing each entry in a directory. On error nil and an error message is returned.
|
jbe@268
|
66
|
jbe@268
|
67 --]]--
|
jbe@268
|
68 -- implemented in extos.c as
|
jbe@268
|
69 -- static int extos_listdir(lua_State *L)
|
jbe@268
|
70 --//--
|
jbe@268
|
71
|
jbe@268
|
72
|
jbe@268
|
73 --[[--
|
jbe@268
|
74 passhash = -- encrypted password
|
jbe@268
|
75 extos.crypt{
|
jbe@268
|
76 key = key, -- password to be one-way encrypted
|
jbe@268
|
77 salt = salt -- salt to be used for encryption, optionally starting with "$N$", where N is a digit
|
jbe@268
|
78 }
|
jbe@268
|
79
|
jbe@268
|
80 This function is a wrapper for the C function char *crypt(const char *key, const char *salt).
|
jbe@268
|
81
|
jbe@268
|
82 --]]--
|
jbe@268
|
83 -- implemented in extos.c as
|
jbe@268
|
84 -- static int extos_crypt(lua_State *L)
|
jbe@268
|
85 --//--
|
jbe@268
|
86
|
jbe@268
|
87
|
jbe@268
|
88 --[[--
|
jbe@268
|
89 seconds =
|
jbe@268
|
90 extos.hires_time()
|
jbe@268
|
91
|
jbe@268
|
92 Returns a unix time stamp representing current time with high resolution.
|
jbe@268
|
93
|
jbe@268
|
94 --]]--
|
jbe@268
|
95 -- implemented in extos.c as
|
jbe@268
|
96 -- static int extos_hires_time(lua_State *L)
|
jbe@268
|
97 --//--
|
jbe@268
|
98
|
jbe@268
|
99
|
jbe@268
|
100 --[[--
|
jbe@268
|
101 seconds =
|
jbe@268
|
102 extos.monotonic_hires_time()
|
jbe@268
|
103
|
jbe@268
|
104 Returns the number of (SI) seconds since loading the library with high resolution.
|
jbe@268
|
105
|
jbe@268
|
106 --]]--
|
jbe@268
|
107 -- implemented in extos.c as
|
jbe@268
|
108 -- static int extos_monotonic_hires_time(lua_State *L)
|
jbe@268
|
109 --//--
|
jbe@268
|
110
|