[Solved] getopt adding extra functionality in C

Taken directly from the GNU C Library Reference page on getopt: while ((c = getopt (argc, argv, “abc:”)) != -1) switch (c) { case ‘a’: aflag = 1; break; case ‘b’: bflag = 1; break; case ‘c’: cvalue = optarg; break; case ‘?’: if (optopt == ‘c’) fprintf (stderr, “Option -%c requires an argument.\n”, optopt); … Read more