Mercurial > hg > index.cgi
comparison lwlink/main.c @ 441:b138b4005125
Make missing command line arguments fail properly
Actually make lwasm, lwlink, and lwar exit with a nonzero status if command
line argument parsing fails due to missing arguments. This required
adjustments to lw_cmdline to return error codes in those cases.
author | William Astle <lost@l-w.ca> |
---|---|
date | Mon, 27 Nov 2017 22:35:53 -0700 |
parents | 221b5f58d8ad |
children | a6c9129e5948 |
comparison
equal
deleted
inserted
replaced
440:fda62f676ed4 | 441:b138b4005125 |
---|---|
183 // assembler on the first file | 183 // assembler on the first file |
184 int main(int argc, char **argv) | 184 int main(int argc, char **argv) |
185 { | 185 { |
186 program_name = argv[0]; | 186 program_name = argv[0]; |
187 | 187 |
188 lw_cmdline_parse(&cmdline_parser, argc, argv, 0, 0, NULL); | 188 if (lw_cmdline_parse(&cmdline_parser, argc, argv, 0, 0, NULL) != 0) |
189 { | |
190 // bail if parsing failed | |
191 exit(1); | |
192 } | |
189 if (ninputfiles == 0) | 193 if (ninputfiles == 0) |
190 { | 194 { |
191 fprintf(stderr, "No input files\n"); | 195 fprintf(stderr, "No input files\n"); |
192 exit(1); | 196 exit(1); |
193 } | 197 } |