GNU Long Options Extension

A number of GNU commands like the gcc(1) compiler for example have a large number of options to support. Besides the fact that you can exhaust all possible characters for those options, a user just cannot remember them all. The GNU solution to this problem is the convention of long options.

FreeBSD 3.4 Release includes gcc(1), allowing the following demonstration of a long option:

$ gcc --version
2.7.2.3
$

Long options begin with two hyphens and must be followed by one or more characters. In order to process long options, the GNU function getopt_long(3) must be used.

The GNU getopt_long(3) Function

The getopt_long(3) function will process both the traditional short options and the newer GNU long options. The synopsis ...

Get Advanced UNIX Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.