libexplain  1.4.D001
Functions
libexplain/system_success_or_die.c File Reference
#include <libexplain/ac/assert.h>
#include <libexplain/ac/ctype.h>
#include <libexplain/ac/errno.h>
#include <libexplain/ac/limits.h>
#include <libexplain/ac/stdlib.h>
#include <libexplain/ac/string.h>
#include <libexplain/ac/sys/param.h>
#include <libexplain/ac/sys/wait.h>
#include <libexplain/ac/unistd.h>
#include <libexplain/buffer/errno/access.h>
#include <libexplain/buffer/errno/fork.h>
#include <libexplain/buffer/errno/system.h>
#include <libexplain/buffer/errno/wait.h>
#include <libexplain/buffer/wait_status.h>
#include <libexplain/common_message_buffer.h>
#include <libexplain/string_buffer.h>
#include <libexplain/system.h>
#include <libexplain/output.h>

Go to the source code of this file.

Functions

static int extract_command (const char *src, char *dst, size_t dst_size)
static int command_on_path (const char *cmd)
int explain_system_success (const char *command)
void explain_system_success_or_die (const char *command)

Function Documentation

static int command_on_path ( const char *  cmd) [static]

Definition at line 90 of file system_success_or_die.c.

int explain_system_success ( const char *  command)

The explain_system_success function is used to call the system(3) system call. On failure (including any exit status other than EXIT_SUCCESS) an explanation will be printed to stderr, obtained from explain_system(3). The return value from system(3) is returned.

This function is intended to be used in a fashion similar to the following example:

 int result = explain_system_success(command);
Parameters:
commandThe command, exactly as to be passed to the system(3) system call.
Returns:
the value returned by the system(3) system call.

Definition at line 128 of file system_success_or_die.c.

void explain_system_success_or_die ( const char *  command)

The explain_system_success_or_die function is used to call the system(3) system call. On failure (including any exit status other than EXIT_SUCCESS) an explanation will be printed to stderr, obtained from explain_system(3), and then the process terminates by calling exit(EXIT_FAILURE).

This function is intended to be used in a fashion similar to the following example:

Parameters:
commandThe command, exactly as to be passed to the system(3) system call.
Returns:
This function only returns on success (exit status EXIT_SUCCESS (0) by the command). On failure (including non-zero exit status), prints an explanation and exits; it does not return.

Definition at line 199 of file system_success_or_die.c.

static int extract_command ( const char *  src,
char *  dst,
size_t  dst_size 
) [static]

Definition at line 42 of file system_success_or_die.c.