libexplain  1.4.D001
Functions | Variables
libexplain/buffer/permission_mode.c File Reference
#include <libexplain/ac/sys/stat.h>
#include <libexplain/buffer/permission_mode.h>
#include <libexplain/option.h>
#include <libexplain/parse_bits.h>
#include <libexplain/sizeof.h>
#include <libexplain/string_buffer.h>

Go to the source code of this file.

Functions

void explain_buffer_permission_mode (explain_string_buffer_t *sb, mode_t mode)
mode_t explain_permission_mode_parse_or_die (const char *text, const char *caption)

Variables

static const
explain_parse_bits_table_t 
short_table []
static const
explain_parse_bits_table_t 
long_table []

Function Documentation

void explain_buffer_permission_mode ( explain_string_buffer_t sb,
mode_t  mode 
)

The explain_buffer_permission_mode function may be used to decode a set of permission mode bits into human readable text, something like the programmer would have written.

Parameters:
sbThe string buffer to write the mode into. This makes the function thread safe if the buffer is suitable.
modethe permission mode bits to be decoded

Definition at line 58 of file permission_mode.c.

mode_t explain_permission_mode_parse_or_die ( const char *  text,
const char *  caption 
)

The explain_permission_mode_parse_or_die function may be used to parse a strings containing a symbolic representation of a permission mode, turning it into a permission mode value.

Parameters:
textThe text to be parsed to extract a permission mode value.
captionadditional text to add to the start of the error message
Returns:
permission mode value
Note:
If there is a parse error, a fatal error message is printed, and exit(EXIT_FAILURE) is called. If there is an error, this function will not return.

Definition at line 100 of file permission_mode.c.


Variable Documentation

Initial value:
{
    { "S_ISUID", S_ISUID },
    { "S_ISGID", S_ISGID },
    { "S_ISVTX", S_ISVTX },
    { "S_IRWXU", S_IRWXU },
    { "S_IRUSR", S_IRUSR },
    { "S_IWUSR", S_IWUSR },
    { "S_IXUSR", S_IXUSR },
    { "S_IRWXG", S_IRWXG },
    { "S_IRGRP", S_IRGRP },
    { "S_IWGRP", S_IWGRP },
    { "S_IXGRP", S_IXGRP },
    { "S_IRWXO", S_IRWXO },
    { "S_IROTH", S_IROTH },
    { "S_IWOTH", S_IWOTH },
    { "S_IXOTH", S_IXOTH },
}

Definition at line 37 of file permission_mode.c.

Initial value:
{
    { "S_ISUID", S_ISUID },
    { "S_ISGID", S_ISGID },
    { "S_ISVTX", S_ISVTX },
}

Definition at line 29 of file permission_mode.c.