commit 2790c6c68e89a8f8cab9b8b54a8961377c567f92
parent 2663d4dd56a8f6d842e5625b034f5cfa4a50e5f3
Author: Frederic Cambus <fcambus@users.sourceforge.net>
Date: Tue, 8 Dec 2015 16:19:55 +0100
Use optind to check if an input file is specified, removing legacy method
Diffstat:
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/main.c b/src/main.c
@@ -121,11 +121,6 @@ int main(int argc, char *argv[])
bool fileIsANSi = false;
bool fileIsPCBoard = false;
bool fileIsTundra = false;
-
- if (argc == 1 || argc >= 9) {
- synopsis();
- return EXIT_SUCCESS;
- }
int getoptFlag;
char *bits = NULL;
@@ -174,7 +169,12 @@ int main(int argc, char *argv[])
}
}
- input = argv[optind];
+ if (optind < argc) {
+ input = argv[optind];
+ } else {
+ synopsis();
+ return EXIT_SUCCESS;
+ }
argc -= optind;
argv += optind;