FreeDOS getopt_long library The getopt_long function works like getopt except that it also accepts long options, started out by a slash char. Both long and short options may take arguments, which are set off by equals (=). Short options are case sensitive. Long options are not. This is a compromise from the UNIX getopt. See the foo.c sample program to see how to use getopt_long. This getopt_long function returns the option character if the option was found successfully, : if there was a missing argument to one of the options, ? for an unknown option character, or EOF for the end of the option list. Note that getopt_long_only returns the option character when a short option is recognized. For a long option, they return val if flag is NULL, and 0 otherwise. Error and EOF returns are the same as for getopt, plus ? for an ambiguous match or an extraneous parameter. Changes from GNU getopt_long This is an approximation of GNU getopt_long, re-written for DOS systems. I have not implemented all features from GNU getopt_long; flag is not used in longopts, and longindex is not (yet) used. These should be implemented in a future version of getopt_long. Other issues Options must be separated on the command line. Combining options is not allowed. You must write: foo /a /v and not foo /av. The second version would try to match a long option called /av. Also, you must write: foo /a /v and not foo /a/v. The second version would try to match a long option called /a/v.