int builtin_echo(int argc, const char **argv, char **env) { t_command *command; int i; (void)argc; (void)env; command = builtin_echo_init(); if (!parse_command(argv, command)) return (0); if (is_active(command, "help")) details_of_command(command); else { i = skip_options(argv); while (argv[i]) { if (display_arg(command, argv[i])) return (0); if (argv[++i]) ft_putchar(' '); } if (!is_active(command, "n")) ft_putchar('\n'); } return (0); }
int init_env(t_select *sel) { int *pos; if (!(pos = ft_memalloc(sizeof(int) * 2))) sel_error(MALLER); if (!(sel->io = ft_memalloc(sizeof(struct winsize)))) sel_error(MALLER); if (env_sw() == 0) sel_error(ENV_ERROR); signal(SIGINT, res_and_quit); signal(SIGKILL, res_and_quit); signal(SIGTERM, res_and_quit); signal(SIGTSTP, suspend); signal(SIGWINCH, restart_display); if (signal(SIGCONT, restart)) display_arg(sel->first, sel); ft_select(sel, pos); return (1); }