Handling command line options before and after an argument in C
问题 So far I've been using getopt_long to parse options for a command line C program. Is there a way to stop getopt_long parsing when it hits a non-option argument? If not, what's the best way to handle this in C? To give an example, I'd like to handle commands in a similar way to git, and have general arguments before a command, and command-specific arguments after it: git [general options] <command> [command options] e.g.: git --bare commit -a git -p --bare status -s -p and --bare are general