aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.c3
-rw-r--r--options.c7
-rw-r--r--options.h2
3 files changed, 5 insertions, 7 deletions
diff --git a/main.c b/main.c
index 6c3c2f3..e0433d8 100644
--- a/main.c
+++ b/main.c
@@ -50,8 +50,7 @@ void run() {
}
int main(int argc, char **argv) {
- if (parse_options(argc, argv) < 0)
- return 1;
+ parse_options(argc, argv);
if (!options->filecnt) {
print_usage();
diff --git a/options.c b/options.c
index 4968d2e..5b52b66 100644
--- a/options.c
+++ b/options.c
@@ -37,7 +37,7 @@ void print_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;
_options.filenames = (const char**) argv + 1;
@@ -46,7 +46,8 @@ int parse_options(int argc, char **argv) {
while ((opt = getopt(argc, argv, "hv")) != -1) {
switch (opt) {
case '?':
- return -1;
+ print_usage();
+ exit(1);
case 'h':
print_usage();
exit(0);
@@ -55,6 +56,4 @@ int parse_options(int argc, char **argv) {
exit(0);
}
}
-
- return 0;
}
diff --git a/options.h b/options.h
index 3003dff..f6dc974 100644
--- a/options.h
+++ b/options.h
@@ -29,6 +29,6 @@ extern const options_t *options;
void print_usage();
void print_version();
-int parse_options(int, char**);
+void parse_options(int, char**);
#endif /* OPTIONS_H */