O'Reilly logo

Advanced UNIX Programming by Warren W. Gay

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required