The Linux Programming Interface
Parsing Command-Line options
(01) 形式
command [ options ] arguments
An option takes the form of a hyphen (-) followed by a unique character identifying the option and a possible argument for the option.
Multiple options can be group after a single hyphen
(02) getopt() 函数
int getopt(int argc, char * const argv[], const char *optstring);
argc, argv, which would normally be taken from the arguments of the same name to main().
The optstring argument specifies the set of options that getopt() should look for in argv.