libexplain  1.4.D001
Functions | Variables
libexplain/buffer/access_mode.c File Reference
#include <libexplain/ac/unistd.h>
#include <libexplain/buffer/access_mode.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_access_mode (explain_string_buffer_t *sb, int mode)
int explain_access_mode_parse (const char *text)
int explain_access_mode_parse_or_die (const char *text, const char *caption)

Variables

static const
explain_parse_bits_table_t 
table []

Function Documentation

int explain_access_mode_parse ( const char *  text)

The explain_access_mode_parse function may be used to parse a C-like expression string, into an access(2) mode argument.

Parameters:
textThe text to be parsed.
Returns:
int; access mode on success, -1 on failure

Definition at line 48 of file access_mode.c.

int explain_access_mode_parse_or_die ( const char *  text,
const char *  caption 
)

The explain_access_mode_parse_or_die function may be used to parse a C-like expression string, into an access(2) mode argument. If string is not valie, issues a diagnostic and exits EXIT_FAILURE.

Parameters:
textThe text to be parsed.
captionCaption for error message, or NULL for none.
Returns:
the access mode

Definition at line 59 of file access_mode.c.

void explain_buffer_access_mode ( struct explain_string_buffer_t sb,
int  mode 
)

The explain_buffer_access_mode function may be used to emit a human readable representation of an access mode.

Parameters:
sbThe string buffer to print into.
modeThe access(2) mode to encode.

Definition at line 38 of file access_mode.c.


Variable Documentation

Initial value:
{
    { "F_OK", F_OK },
    { "R_OK", R_OK },
    { "W_OK", W_OK },
    { "X_OK", X_OK },
}

Definition at line 28 of file access_mode.c.