I'm trying to use getopt to parse my command line arguments but i'm having an issue where it is setting the wrong values its skipping case 1 and setting case 2 as case 1.Here is the while loop of just the cases. The flags work fine its just reading in by position that is the problem.
while ((c = getopt (argc, argv, "-l:u:eo")) != -1)
switch (c)
{
case 1:
printf("here\n");
lower = atoi(optarg);
break;
case 2:
upper = atoi(optarg);
break;
}
here is the output from the terminal after running the program.
(%) fibon 12 22
here
here
lower = 22, upper = 0, even = 0, odd = 0
Usage: fibon[[lower upper] | [-l lower -u upper]] [-e|-o]