예제 #1
0
파일: lab4_4.c 프로젝트: kamocat/cs151
/*
 * 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 );
	}
}
예제 #2
0
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);
}