Module posix.stdlib
Standard Posix Library functions.
Functions
abort () | Abort the program immediately. |
getenv ([name]) | Get value of environment variable, or all variables. |
grantpt (fd) | Grant access to a slave pseudoterminal |
mkdtemp (templ) | Create a unique temporary directory. |
mkstemp (templ) | Create a unique temporary file. |
openpt (oflags) | Open a pseudoterminal. |
ptsname (fd) | Get the name of a slave pseudo-terminal |
realpath (path) | Find canonicalized absolute pathname. |
setenv (name[, value[, overwrite]]) | Set an environment variable for this process. |
unlockpt (fd) | Unlock a pseudoterminal master/slave pair |
Functions
- abort ()
-
Abort the program immediately.
See also:
- getenv ([name])
-
Get value of environment variable, or all variables.
Parameters:
- name string if nil, get all (optional)
Returns:
-
value if name given, otherwise a name-indexed table of values.
See also:
Usage:
for a,b in pairs(posix.getenv()) do print(a, b) end
- grantpt (fd)
-
Grant access to a slave pseudoterminal
Parameters:
- fd int descriptor returned by openpt
Returns:
-
int
0
, if successfulOr
- nil
- string error message
- int errnum
See also:
- mkdtemp (templ)
-
Create a unique temporary directory.
Parameters:
- templ string pattern that ends in six 'X' characters
Returns:
-
string
path to directory, if successful
Or
- nil
- string error message
- int errnum
See also:
- mkstemp (templ)
-
Create a unique temporary file.
Parameters:
- templ string pattern that ends in six 'X' characters
Returns:
- int open file descriptor
- string path to file, if successful
Or
- nil
- string error message
- int errnum
See also:
Usage:
local stdlib = require "posix.stdlib" stdlib.mkstemp 'wooXXXXXX'
- openpt (oflags)
-
Open a pseudoterminal.
Parameters:
- oflags
int
bitwise OR of zero or more of
O_RDWR
andO_NOCTTY
Returns:
-
file descriptor of pseudoterminal, if successful
Or
- nil
- string error message
- int errnum
See also:
- oflags
int
bitwise OR of zero or more of
- ptsname (fd)
-
Get the name of a slave pseudo-terminal
Parameters:
- fd int descriptor returned by openpt
Returns:
-
path name of the slave terminal device, if successful
Or
- nil
- string error message
- int errnum
See also:
- realpath (path)
-
Find canonicalized absolute pathname.
Parameters:
- path string file to act on
Returns:
-
string
canonicalized absolute path, if successful
Or
- nil
- string error messag
- int errnum
See also:
- setenv (name[, value[, overwrite]])
-
Set an environment variable for this process.
(Child processes will inherit this)
Parameters:
- name string
- value string (maybe nil, meaning 'unset') (optional)
- overwrite non-nil prevents overwriting a variable (optional)
Returns:
-
int
0
, if successfulOr
- nil
- string error message
- int errnum
See also:
- unlockpt (fd)
-
Unlock a pseudoterminal master/slave pair
Parameters:
- fd int descriptor returned by openpt
Returns:
-
int
0
, if successfulOr
- nil
- string error message
- int errnum
See also: