aboutsummaryrefslogtreecommitdiff
path: root/manual/examples
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-01-07 16:59:39 +0000
committerUlrich Drepper <drepper@redhat.com>2001-01-07 16:59:39 +0000
commit9495793d2a467e7be150fd71a7d6bb90cc86afce (patch)
tree7e8b31909397edf4e63fa6b166a4b0ff259ba0dc /manual/examples
parentdabb1db4d1efee735ac5b402f78e6cbf81097dbe (diff)
downloadglibc-9495793d2a467e7be150fd71a7d6bb90cc86afce.zip
glibc-9495793d2a467e7be150fd71a7d6bb90cc86afce.tar.gz
glibc-9495793d2a467e7be150fd71a7d6bb90cc86afce.tar.bz2
Update.
2001-01-07 Ben Collins <bcollins@debian.org> * manual/examples/longopt.c: Make the "struct option" a little more like it should be, adding usage of required_argument, noargument and such, and also setting the options string right. * manual/sysinfo.texi (Load Average): New section, documents getloadavg().
Diffstat (limited to 'manual/examples')
-rw-r--r--manual/examples/longopt.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/manual/examples/longopt.c b/manual/examples/longopt.c
index 9d6bd53..e6567c7 100644
--- a/manual/examples/longopt.c
+++ b/manual/examples/longopt.c
@@ -17,21 +17,21 @@ main (argc, argv)
static struct option long_options[] =
{
/* These options set a flag. */
- {"verbose", 0, &verbose_flag, 1},
- {"brief", 0, &verbose_flag, 0},
+ {"verbose", no_argument, &verbose_flag, 1},
+ {"brief", no_argument, &verbose_flag, 0},
/* These options don't set a flag.
We distinguish them by their indices. */
- {"add", 1, 0, 0},
- {"append", 0, 0, 0},
- {"delete", 1, 0, 0},
- {"create", 0, 0, 0},
- {"file", 1, 0, 0},
+ {"add", required_argument, 0, 'a'},
+ {"append", no_argument, 0, 'b'},
+ {"delete", required_argument, 0, 'd'},
+ {"create", no_argument, 0, 'c'},
+ {"file", required_argument, 0, 'f'},
{0, 0, 0, 0}
};
/* @code{getopt_long} stores the option index here. */
int option_index = 0;
- c = getopt_long (argc, argv, "abc:d:",
+ c = getopt_long (argc, argv, "abc:d:f:",
long_options, &option_index);
/* Detect the end of the options. */
@@ -66,6 +66,10 @@ main (argc, argv)
printf ("option -d with value `%s'\n", optarg);
break;
+ case 'f':
+ printf ("option -f with value `%s'\n", optarg);
+ break;
+
case '?':
/* @code{getopt_long} already printed an error message. */
break;