| www.delorie.com/gnu/docs/avl/libavl_84.html | search |
![]() Buy GNU books! | |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This section briefly discusses libavl's data structures and functions for parsing command-line arguments. For more information on the command-line arguments accepted by the testing program, refer to the libavl reference manual.
The main way that the test program receives instructions from the user is through the set of arguments passed to main(). The program assumes that these arguments can be controlled easily by the user, presumably through some kind of command-based "shell" program. It allows for two kinds of options: traditional UNIX "short options" that take the form `-o' and GNU-style "long options" of the form `--option'. Either kind of option may take an argument.
Options are specified using an array of struct option, terminated by an all-zero structure:
There are two public functions in the option parser:
These functions' implementation are not too interesting for our purposes, so they are relegated to an appendix. See section B.1 Option Parser, for the full story.
The option parser provides a lot of support for parsing the command line, but of course the individual options have to be handled once they are retrieved by option_get(). The parse_command_line() function takes care of the whole process:
See section B.2 Command-Line Parser, for source code. The struct test_options initialized by parse_command_line() is described in detail below.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| webmaster donations bookstore | delorie software privacy |
| Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |