void print_list(const Node *const pt_to_node) { if (!pt_to_node) printf("()\n"); else { printf("("); apply_to_list(print_node, pt_to_node); printf("\b)\n"); } }
int main(int argc, char **argv) { node_t *data; node_t *symbols; data = (node_t *)malloc(sizeof(node_t)); symbols = (node_t *)malloc(sizeof(node_t)); /* Checking number of arguments and both mallocs */ if (argc != 2 || !data || !symbols) { return (1); } data = file_to_list(argv[1]); apply_to_list(data, trim); print_list(data); symbols = parse_symbols(data); print_list(symbols); free(data); return (0); }
static void fatal_code(const int sig) { fatal_error_code = sig; signal(sig, SIG_DFL); if (fatal_code_in_progress) { kill(getpid(), fatal_error_code); } fatal_code_in_progress = true; /* Let us clean up the terminal configuration. */ unset_interactive_mode(); apply_to_list(&buffers, auto_save); kill(getpid(), fatal_error_code); }