CE change environment variables syntax, sdutil Add help command
This commit is contained in:
18
ce/interp.c
18
ce/interp.c
@@ -424,20 +424,24 @@ static void execute_cmd (struct ast_cmd* cmd, struct context* context) {
|
||||
|
||||
int pgid = get_procgroup (pid);
|
||||
|
||||
for (int i = 0; i < cmd->arg_count; i++) {
|
||||
int i = 0;
|
||||
while (i < cmd->arg_count) {
|
||||
char* arg = cmd->args[i];
|
||||
char *key, *value;
|
||||
|
||||
char* sep = strchr (arg, '=');
|
||||
if (arg[0] == '-') {
|
||||
key = &arg[1];
|
||||
|
||||
if (sep != NULL) {
|
||||
*sep = '\0';
|
||||
|
||||
key = arg;
|
||||
value = sep + 1;
|
||||
if (i < cmd->arg_count - 1) {
|
||||
value = cmd->args[++i];
|
||||
} else {
|
||||
value = "yes";
|
||||
}
|
||||
|
||||
env_set (pgid, key, value, strlen (value) + 1);
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
struct cmd_write_proc_ctx wpctx = {.pgid = pgid, .cancel_pid = pid};
|
||||
|
||||
Reference in New Issue
Block a user