Fix a bug where the program doesn't read the arguments

This commit is contained in:
Ivaylo Ivanov 2018-10-10 15:49:24 +02:00
parent e94d16e7ea
commit c564873ed9

View File

@ -1,4 +1,4 @@
#define _GNU_SOURCE // in order for strcasestr to work #define _GNU_SOURCE ///< in order for strcasestr to work
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
@ -15,10 +15,10 @@ int main(int argc, char *argv[]) {
char *ofile = NULL; char *ofile = NULL;
char *keyword = NULL; char *keyword = NULL;
char *filename = NULL; char *filename = NULL;
int c = getopt(argc, argv, "io:h"); ///< Get the options int c;
/// Process the options /// Process the options
while(c != -1) { while((c = getopt(argc, argv, "io:h")) != -1) {
switch(c) { switch(c) {
case 'i': case 'i':
iflag = 1; iflag = 1;