summaryrefslogtreecommitdiff
path: root/libdiskfs/opts-set.c
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1995-10-13 23:06:30 +0000
committerMiles Bader <miles@gnu.org>1995-10-13 23:06:30 +0000
commita74ced5ce1ca2015b3376280fbaa57668c407c09 (patch)
treef72c18322661f05c53664a3a95f76b1afd1e7b00 /libdiskfs/opts-set.c
parent6dce64794f38a1fe0836d160549f4b911c6cb97f (diff)
(std_runtime_options): Renamed from long_options, convert to argp format.
(SHORT_OPTIONS): Removed. (diskfs_set_options): Converted to use argp.
Diffstat (limited to 'libdiskfs/opts-set.c')
-rw-r--r--libdiskfs/opts-set.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/libdiskfs/opts-set.c b/libdiskfs/opts-set.c
index 9de9a3bb..51b7119b 100644
--- a/libdiskfs/opts-set.c
+++ b/libdiskfs/opts-set.c
@@ -22,14 +22,20 @@
#define SHORT_OPTIONS "rwsnm"
-static struct option long_options[] =
+static struct argp_option
+std_runtime_options[] =
{
- {"readonly", no_argument, 0, 'r'},
- {"writable", no_argument, 0, 'w'},
- {"sync", optional_argument, 0, 's'},
- {"nosync", no_argument, 0, 'n'},
- {"remount", no_argument, 0, 'm'},
- {0, 0, 0, 0}
+ {"readonly", 'r', 0, 0, "Never write to disk or allow opens for writing"},
+ {"rdonly", 0, 0, OPTION_ALIAS | OPTION_HIDDEN},
+ {"writable", 'w', 0, 0, "Use normal read/write behavior"},
+ {"rdwr", 0, 0, OPTION_ALIAS | OPTION_HIDDEN},
+ {"sync", 's', "INTERVAL", OPTION_ARG_OPTIONAL,
+ "If INTERVAL is supplied, sync all data not actually written to disk"
+ " every INTERVAL seconds, otherwise operate in synchronous mode (the"
+ " default is to sync every 30 seconds)"},
+ {"nosync", 'n', 0, 0, "Don't automatically sync data to disk"},
+ {"remount", 'u', 0, 0, "Flush any meta-data cached in core"},
+ {0, 0}
};
error_t
@@ -38,7 +44,7 @@ diskfs_set_options (int argc, char **argv)
int readonly = diskfs_readonly;
int sync = diskfs_synchronous;
int sync_interval = -1;
- error_t parse_opt (int opt, char *arg)
+ error_t parse_opt (int opt, char *arg, struct argp_state *argp)
{
switch (opt)
{
@@ -59,11 +65,11 @@ diskfs_set_options (int argc, char **argv)
}
return 0;
}
- struct options options = { SHORT_OPTIONS, long_options, parse_opt, 0 };
+ struct argp argp = { std_runtime_options, parse_opt };
/* Call the user option parsing routine, giving it our set of options to do
with as it pleases. */
- error_t err = diskfs_parse_runtime_options (argc, argv, &options);
+ error_t err = diskfs_parse_runtime_options (argc, argv, &argp);
if (err)
return err;