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

The getsubopt(3) Function

Many UNIX platforms support suboptions. Suboptions are useful when your application has many possible parameter values and suboptions, which are best specified by name. SGI's IRIX 6.5 documents an example of suboptions using its mount(1) command:

# mount -o rw,hard,bg,wsize=1024 speed:/usr /usr
					

In this example, the -o represents the option, which is then followed by an argument consisting of suboptions. The argument rw,hard,bg,wsize=1024 has several suboptions, which are separated by commas. As the example illustrates, some suboptions take arguments and others do not.

To make it easier for the application writer to parse suboptions, the function getsubopt(3) is provided. Its synopsis is as follows:

 #include <stdlib.h> ...

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