diff options
author | David Oberhollenzer <david.oberhollenzer@tele2.at> | 2018-04-04 14:58:01 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@tele2.at> | 2018-04-04 14:58:01 +0200 |
commit | 04a23330e4a2085ee91980c223c5e4f089ebbe97 (patch) | |
tree | da0b02615fb21849a37cf4632c80df1569788dff /lib/include | |
parent | aa1356cb190a3416936b25f75ecaaa8684c6fcde (diff) |
Merge preprocessing of command lines
- Common function for splitting string into argument vector
- Preprocess & split command lines while parsing the service file
- Specify "before" and "after" dependencies in a single line
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
Diffstat (limited to 'lib/include')
-rw-r--r-- | lib/include/service.h | 14 | ||||
-rw-r--r-- | lib/include/util.h | 2 |
2 files changed, 12 insertions, 4 deletions
diff --git a/lib/include/service.h b/lib/include/service.h index 76d48ce..593b221 100644 --- a/lib/include/service.h +++ b/lib/include/service.h @@ -44,21 +44,27 @@ enum { TGT_MAX }; +typedef struct exec_t { + char **argv; + char *raw_argv; + + struct exec_t *next; +} exec_t; + typedef struct service_t { int type; /* SVC_* service type */ int target; /* TGT_* service target */ char *name; /* canonical service name */ char *desc; /* description string */ - char **exec; /* command lines to execute */ - size_t num_exec; /* number of command lines */ + exec_t *exec; /* command lines to execute */ char *ctty; /* controlling tty or log file */ int rspwn_limit; /* maximum respawn count */ char **before; /* services that must be executed later */ - size_t num_before; char **after; /* services that must be executed first */ - size_t num_after; + char *raw_after; + char *raw_before; pid_t pid; int status; /* process exit status */ diff --git a/lib/include/util.h b/lib/include/util.h index 0ed7002..a6e96fa 100644 --- a/lib/include/util.h +++ b/lib/include/util.h @@ -73,6 +73,8 @@ char *rdline(int fd, int argc, const char *const *argv); */ int unescape(char *src); +char **split_argv(char *str); + /* Search through an array of enum_map_t entries to resolve a string to a numeric value. The end of the map is indicated by a sentinel entry |