|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef EXECCMD_H |
|
#define EXECCMD_H |
|
|
|
#include "lists.h" |
|
#include "strings.h" |
|
#include "timestamp.h" |
|
|
|
|
|
typedef struct timing_info |
|
{ |
|
double system; |
|
double user; |
|
timestamp start; |
|
timestamp end; |
|
} timing_info; |
|
|
|
typedef void (* ExecCmdCallback) |
|
( |
|
void * const closure, |
|
int const status, |
|
timing_info const * const, |
|
char const * const cmd_stdout, |
|
char const * const cmd_stderr, |
|
int const cmd_exit_reason |
|
); |
|
|
|
|
|
#define EXEC_CMD_OK 0 |
|
#define EXEC_CMD_FAIL 1 |
|
#define EXEC_CMD_INTR 2 |
|
|
|
int exec_check |
|
( |
|
string const * command, |
|
LIST * * pShell, |
|
int * error_length, |
|
int * error_max_length |
|
); |
|
|
|
|
|
#define EXEC_CHECK_OK 101 |
|
#define EXEC_CHECK_NOOP 102 |
|
#define EXEC_CHECK_LINE_TOO_LONG 103 |
|
#define EXEC_CHECK_TOO_LONG 104 |
|
|
|
void exec_cmd |
|
( |
|
string const * command, |
|
ExecCmdCallback func, |
|
void * closure, |
|
LIST * shell |
|
); |
|
|
|
void exec_wait(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void argv_from_shell( char const * * argv, LIST * shell, char const * command, |
|
int const slot ); |
|
|
|
|
|
|
|
|
|
void onintr( int disp ); |
|
|
|
|
|
int interrupted( void ); |
|
|
|
|
|
|
|
|
|
int is_raw_command_request( LIST * shell ); |
|
|
|
|
|
|
|
|
|
int check_cmd_for_too_long_lines( char const * command, int const max, |
|
int * const error_length, int * const error_max_length ); |
|
|
|
#endif |
|
|