static void sig_handler(int signum) { if (signum == SIGINT) { if (hook_close()) exit(EXIT_FAILURE); exit(EXIT_SUCCESS); } else if (signum == SIGCONT) { if (hook_open()) exit(EXIT_FAILURE); } }
static int hook_fabric_close(struct fid *fid) { struct hook_fabric *fab; fab = container_of(fid, struct hook_fabric, fabric.fid); switch (fab->hclass) { case HOOK_PERF: hook_perf_destroy(fab); break; default: break; } return hook_close(fid); }
int main(int arg_c, char **arg_v, char **env_p) { t_hook_input hook; char *input; if (hook_open(&hook)) exit(EXIT_FAILURE); input = hook_input(&hook); ft_printf("[%s]\n", input); if (hook_close(&hook)) exit(EXIT_FAILURE); return (0); (void)arg_c; (void)arg_v; (void)env_p; }