#include "xdasd_exec.h"
#include "xdasd_log.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
Go to the source code of this file.
Defines | |
#define | INITIAL_BUFSZ_MULTIPLIER 2 |
#define | XDAS_FIELD_COUNT 33 |
#define | SHELL_ENVAR "SHELL" |
#define | DEFAULT_SHELL "/bin/sh" |
Functions | |
static char * | ex_substitute_vars (const char *script, const char **msgflds) |
Substitute values in for variable names. | |
static int | ex_exec_script (const char *script) |
Execute an extra-process command. | |
int | xdasd_exec (const char *script, const char **msgflds) |
Execute a shell script with variable expansion. |
Definition in file xdasd_exec.c.
#define DEFAULT_SHELL "/bin/sh" |
Referenced by ex_exec_script().
#define INITIAL_BUFSZ_MULTIPLIER 2 |
#define SHELL_ENVAR "SHELL" |
Referenced by ex_exec_script().
#define XDAS_FIELD_COUNT 33 |
Definition at line 64 of file xdasd_exec.c.
Referenced by ex_substitute_vars(), mcache_put_msg(), mcache_read_record(), mcache_write_record(), tr_put(), and xdasd_parse_message().
static int ex_exec_script | ( | const char * | script | ) | [static] |
Execute an extra-process command.
This routine spawns an extra-process shell, feeding it a shell script via standard handle redirection. That is, the child shell process reads a script from STDIN (piped from the parent process), and then terminates with the exit code from the script.
[in] | script | - the (possibly multi-line) script to be executed. |
For internal use only.
Definition at line 151 of file xdasd_exec.c.
References bytes, DEFAULT_SHELL, SHELL_ENVAR, and xdasd_log().
Referenced by xdasd_exec().
static char* ex_substitute_vars | ( | const char * | script, | |
const char ** | msgflds | |||
) | [static] |
Substitute values in for variable names.
[in] | script | - the script text (possibly) containing variables. |
[in] | msgflds | - The values to be substitued for variables in line . |
line
. Caller is responsible for releasing allocated memory.For internal use only.
Definition at line 76 of file xdasd_exec.c.
References free, INITIAL_BUFSZ_MULTIPLIER, malloc, XDAS_FIELD_COUNT, and xdasd_log().
Referenced by xdasd_exec().