int exec_command(t_cam *c, char *command, char **param) { t_func *tmp = NULL; int flag = 0; if (strcmp(command, "liveview") != 0 && c->liveview == 1) { printf("enter inside here\n"); c->liveview = 0; flag = 1; sleep(1); } tmp = c->first_func_ptr; while (tmp != NULL) { if (strcmp(command, tmp->name) == 0) { tmp->func_ptr(c, param); break; } tmp = tmp->next; } if (tmp == NULL) generic_exec(c, command, param); if (flag == 1) liveview(c, NULL); return (0); }
static int run_generic_script(uev_t *w, generic_script_t *script) { pid_t pid; uev_timer_stop(&script->monitor_script_watcher); pid = generic_exec(script->monitor_script, script->warning, script->critical); if (pid <= 0) { ERROR("Could not start generic monitor script %s", script->monitor_script); return -1; } INFO("Started generic monitor script %s with PID %d", script->monitor_script, pid); script->pid = pid; script->is_running = 1; script->monitor_run_time = 0; uev_timer_init(w->ctx, &script->monitor_script_watcher, wait_for_generic_script, script, 1000, 1000); return script->pid; }