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 successful

Or

  1. nil
  2. string error message
  3. 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

  1. nil
  2. string error message
  3. int errnum

See also:

mkstemp (templ)
Create a unique temporary file.

Parameters:

  • templ string pattern that ends in six 'X' characters

Returns:

  1. int open file descriptor
  2. string path to file, if successful

Or

  1. nil
  2. string error message
  3. 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 and O_NOCTTY

Returns:

    file descriptor of pseudoterminal, if successful

Or

  1. nil
  2. string error message
  3. int errnum

See also:

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

  1. nil
  2. string error message
  3. int errnum

See also:

realpath (path)
Find canonicalized absolute pathname.

Parameters:

Returns:

    string canonicalized absolute path, if successful

Or

  1. nil
  2. string error messag
  3. 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 successful

Or

  1. nil
  2. string error message
  3. int errnum

See also:

unlockpt (fd)
Unlock a pseudoterminal master/slave pair

Parameters:

  • fd int descriptor returned by openpt

Returns:

    int 0, if successful

Or

  1. nil
  2. string error message
  3. int errnum

See also:

generated by LDoc 1.5.0 Last updated 2023-06-16 20:19:12