#include "arg.h" #include #include Args parseArgs(int argc, char** argv) { Args a; while (1) { static struct option long_options[] = { {"debug-log", no_argument, &a.debugLog, 1}, {0, 0, 0, 0} }; /* getopt_long stores the option index here. */ int option_index = 0; int c = getopt_long (argc, argv, "", long_options, &option_index); /* Detect the end of the options. */ if (c == -1) break; switch (c) { case 0: /* If this option set a flag, do nothing else now. */ break; case '?': /* getopt_long already printed an error message. */ break; default: abort(); } } return a; }