/* * Ask for input from user */ int get_input ( ) { printf( "Please enter a number between 1 and 20: " ); int input; scanf("%d", &input ); if( is_number_valid( input ) ) { return input; } else { /* Print an error message */ printf("ERROR: input is not between %d and %d.\n", MIN, MAX ); /* Quit the program entirely */ exit( ERROR ); } }
static int parse_line_instruction(t_parser *parser, char **my_tab) { if (is_defined(my_tab[0]) == 1) { if (compressor(&my_tab) == 1) { my_putstr_err("Can’t perform malloc", 2); return (1); } if (is_number_valid(my_tab, my_tab[0]) == 1) parser->current_address += get_incsize(my_tab); else return (syntax_error_and_return(parser->line_nb)); if (valid_args(my_tab) == 0) return (syntax_error_and_return(parser->line_nb)); } else return (syntax_error_and_return(parser->line_nb)); return (0); }