getopt.3: Use constants in getopt_long() example

The description of getopt_long() mentions the constants
required_argument, no_argument and optional_argument.
Use them in the example to make the code easier to understand.

Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
This commit is contained in:
Bernhard Walle 2010-10-21 19:55:29 +02:00 committed by Michael Kerrisk
parent b66a64313c
commit e5266ff974
1 changed files with 7 additions and 7 deletions

View File

@ -444,13 +444,13 @@ main(int argc, char **argv)
int this_option_optind = optind ? optind : 1;
int option_index = 0;
static struct option long_options[] = {
{"add", 1, 0, 0},
{"append", 0, 0, 0},
{"delete", 1, 0, 0},
{"verbose", 0, 0, 0},
{"create", 1, 0, \(aqc\(aq},
{"file", 1, 0, 0},
{0, 0, 0, 0}
{"add", required_argument, 0, 0 },
{"append", no_argument, 0, 0 },
{"delete", required_argument, 0, 0 },
{"verbose", no_argument, 0, 0 },
{"create", required_argument, 0, \(aqc\(aq},
{"file", required_argument, 0, 0 },
{0, 0, 0, 0 }
};
c = getopt_long(argc, argv, "abc:d:012",