/ src / cli / main.c
main.c
 1  /*
 2   * main.c
 3   *
 4   * Copyright (C) 1999 Jonathan St-André
 5   * Copyright (C) 1999 Hugo Villeneuve <hugo@hugovil.com>
 6   *
 7   * This file is released under the GPLv2
 8   */
 9  
10  #include "config.h"
11  
12  #include <stdbool.h>
13  #include <stdio.h>
14  
15  #include "common.h"
16  #include "cpu8051.h"
17  #include "options.h"
18  #include "hexfile.h"
19  #include "menu.h"
20  #include "parser.h"
21  
22  extern struct options_t options;
23  
24  int
25  main(int argc, char **argv)
26  {
27  	int rc;
28  
29  	parse_command_line_options(argc, argv);
30  
31  	cpu8051_init();
32  
33  	if (options.filename != NULL) {
34  		rc = hexfile_load(options.filename);
35  		if (!rc)
36  			exit(EXIT_FAILURE);
37  	}
38  
39  	console_reset();
40  
41  	if (options.stop_address != 0) {
42  		/* Automatically run program and stop at specified address. */
43  		console_exec(-1);
44  	} else {
45  		//menu_display_usage();
46  		(void) yyparse();
47  	}
48  
49  	exit(EXIT_SUCCESS);
50  }