Made parse_options void

This commit is contained in:
Bert 2011-01-19 18:16:44 +01:00
parent 6851d5c4e5
commit 8b3b28300f
3 changed files with 5 additions and 7 deletions

3
main.c
View File

@ -50,8 +50,7 @@ void run() {
} }
int main(int argc, char **argv) { int main(int argc, char **argv) {
if (parse_options(argc, argv) < 0) parse_options(argc, argv);
return 1;
if (!options->filecnt) { if (!options->filecnt) {
print_usage(); print_usage();

View File

@ -37,7 +37,7 @@ void print_version() {
printf("Version %s, written by Bert Muennich\n", VERSION); printf("Version %s, written by Bert Muennich\n", VERSION);
} }
int parse_options(int argc, char **argv) { void parse_options(int argc, char **argv) {
int opt; int opt;
_options.filenames = (const char**) argv + 1; _options.filenames = (const char**) argv + 1;
@ -46,7 +46,8 @@ int parse_options(int argc, char **argv) {
while ((opt = getopt(argc, argv, "hv")) != -1) { while ((opt = getopt(argc, argv, "hv")) != -1) {
switch (opt) { switch (opt) {
case '?': case '?':
return -1; print_usage();
exit(1);
case 'h': case 'h':
print_usage(); print_usage();
exit(0); exit(0);
@ -55,6 +56,4 @@ int parse_options(int argc, char **argv) {
exit(0); exit(0);
} }
} }
return 0;
} }

View File

@ -29,6 +29,6 @@ extern const options_t *options;
void print_usage(); void print_usage();
void print_version(); void print_version();
int parse_options(int, char**); void parse_options(int, char**);
#endif /* OPTIONS_H */ #endif /* OPTIONS_H */