Mercurial > hg > index.cgi
comparison lwar/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 | e34c8bd6ea29 |
children | 96a05e89ab03 |
comparison
equal
deleted
inserted
replaced
440:fda62f676ed4 | 441:b138b4005125 |
---|---|
141 // main function; parse command line, set up assembler state, and run the | 141 // main function; parse command line, set up assembler state, and run the |
142 // assembler on the first file | 142 // assembler on the first file |
143 int main(int argc, char **argv) | 143 int main(int argc, char **argv) |
144 { | 144 { |
145 program_name = argv[0]; | 145 program_name = argv[0]; |
146 lw_cmdline_parse(&argparser, argc, argv, 0, 0, NULL); | 146 if (lw_cmdline_parse(&argparser, argc, argv, 0, 0, NULL) != 0) |
147 { | |
148 exit(1); | |
149 } | |
147 if (archive_file == NULL) | 150 if (archive_file == NULL) |
148 { | 151 { |
149 fprintf(stderr, "You must specify an archive file.\n"); | 152 fprintf(stderr, "You must specify an archive file.\n"); |
150 exit(1); | 153 exit(1); |
151 } | 154 } |