diff options
author | Zack Weinberg <zackw@panix.com> | 2017-06-08 15:39:03 -0400 |
---|---|---|
committer | Zack Weinberg <zackw@panix.com> | 2017-06-08 15:39:03 -0400 |
commit | 5046dbb4a7eba5eccfd258f92f4735c9ffc8d069 (patch) | |
tree | 4470480d904b65cf14ca524f96f79eca818c3eaf /manual/examples/subopt.c | |
parent | 199fc19d3aaaf57944ef036e15904febe877fc93 (diff) | |
download | glibc-zack/build-layout-experiment.tar glibc-zack/build-layout-experiment.tar.gz glibc-zack/build-layout-experiment.tar.bz2 glibc-zack/build-layout-experiment.zip |
Prepare for radical source tree reorganization.zack/build-layout-experiment
All top-level files and directories are moved into a temporary storage
directory, REORG.TODO, except for files that will certainly still
exist in their current form at top level when we're done (COPYING,
COPYING.LIB, LICENSES, NEWS, README), all old ChangeLog files (which
are moved to the new directory OldChangeLogs, instead), and the
generated file INSTALL (which is just deleted; in the new order, there
will be no generated files checked into version control).
Diffstat (limited to 'manual/examples/subopt.c')
-rw-r--r-- | manual/examples/subopt.c | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/manual/examples/subopt.c b/manual/examples/subopt.c deleted file mode 100644 index 278b6dbbc1..0000000000 --- a/manual/examples/subopt.c +++ /dev/null @@ -1,95 +0,0 @@ -/* Parsing of Suboptions Example - Copyright (C) 1991-2017 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. -*/ - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> - -int do_all; -const char *type; -int read_size; -int write_size; -int read_only; - -enum -{ - RO_OPTION = 0, - RW_OPTION, - READ_SIZE_OPTION, - WRITE_SIZE_OPTION, - THE_END -}; - -const char *mount_opts[] = -{ - [RO_OPTION] = "ro", - [RW_OPTION] = "rw", - [READ_SIZE_OPTION] = "rsize", - [WRITE_SIZE_OPTION] = "wsize", - [THE_END] = NULL -}; - -int -main (int argc, char **argv) -{ - char *subopts, *value; - int opt; - - while ((opt = getopt (argc, argv, "at:o:")) != -1) - switch (opt) - { - case 'a': - do_all = 1; - break; - case 't': - type = optarg; - break; - case 'o': - subopts = optarg; - while (*subopts != '\0') - switch (getsubopt (&subopts, mount_opts, &value)) - { - case RO_OPTION: - read_only = 1; - break; - case RW_OPTION: - read_only = 0; - break; - case READ_SIZE_OPTION: - if (value == NULL) - abort (); - read_size = atoi (value); - break; - case WRITE_SIZE_OPTION: - if (value == NULL) - abort (); - write_size = atoi (value); - break; - default: - /* Unknown suboption. */ - printf ("Unknown suboption `%s'\n", value); - break; - } - break; - default: - abort (); - } - - /* Do the real work. */ - - return 0; -} |