comparison lwlink/trunk/src/main.c @ 114:c65fcec346cd

Handle input files on command line and add some memory management utility functions
author lost
date Sat, 17 Jan 2009 20:54:58 +0000
parents a567dbb3f1d4
children 776d8bea5b46
comparison
equal deleted inserted replaced
113:f4a489ebd44a 114:c65fcec346cd
41 { 41 {
42 switch (key) 42 switch (key)
43 { 43 {
44 case 'o': 44 case 'o':
45 // output 45 // output
46 if (outfile)
47 {
48 }
49 outfile = arg; 46 outfile = arg;
50 break; 47 break;
51 48
52 case 'd': 49 case 'd':
53 // debug 50 // debug
81 if (!outfile) 78 if (!outfile)
82 outfile = "a.out"; 79 outfile = "a.out";
83 break; 80 break;
84 81
85 case ARGP_KEY_ARG: 82 case ARGP_KEY_ARG:
86 // FIXME: input files! 83 add_input_file(arg);
87 break; 84 break;
88 85
89 default: 86 default:
90 return ARGP_ERR_UNKNOWN; 87 return ARGP_ERR_UNKNOWN;
91 } 88 }
118 // main function; parse command line, set up assembler state, and run the 115 // main function; parse command line, set up assembler state, and run the
119 // assembler on the first file 116 // assembler on the first file
120 int main(int argc, char **argv) 117 int main(int argc, char **argv)
121 { 118 {
122 argp_parse(&argp, argc, argv, 0, 0, NULL); 119 argp_parse(&argp, argc, argv, 0, 0, NULL);
123 120 if (ninputfiles == 0)
121 {
122 fprintf(stderr, "No input files\n");
123 exit(1);
124 }
125
124 exit(0); 126 exit(0);
125 } 127 }