summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1996-06-22 21:45:52 +0000
committerMiles Bader <miles@gnu.org>1996-06-22 21:45:52 +0000
commit28a99b0d3e7d6669bcfa9c6eb6c4d53a6c719c34 (patch)
tree6e40ede4642c8eb37be87bba8eaf3560967c91a1
parent3d5b150c93d186d64e8b5d408b31e1ecb52ed473 (diff)
(diskfs_get_options): New function.
-rw-r--r--ufs/main.c43
1 files changed, 30 insertions, 13 deletions
diff --git a/ufs/main.c b/ufs/main.c
index ac3a34bb..617796d8 100644
--- a/ufs/main.c
+++ b/ufs/main.c
@@ -111,23 +111,40 @@ parse_opt (int key, char *arg, struct argp_state *state)
}
return 0;
}
-
-static const struct argp *startup_parents[] = {
- &diskfs_std_device_startup_argp, 0
-};
-static const struct argp startup_argp = {
- options, parse_opt, 0, 0, startup_parents
-};
-static const struct argp *runtime_parents[] = {
- &diskfs_std_runtime_argp, 0
-};
-static const struct argp runtime_argp = {
- options, parse_opt, 0, 0, runtime_parents
-};
+/* Add our startup arguments to the standard diskfs set. */
+static struct argp *startup_parents[] = { &diskfs_std_device_startup_argp, 0};
+static struct argp startup_argp = {options, parse_opt, 0, 0, startup_parents};
+
+/* Similarly at runtime. */
+static struct argp *runtime_parents[] = {&diskfs_std_runtime_argp, 0};
+static struct argp runtime_argp = {options, parse_opt, 0, 0, runtime_parents};
struct argp *diskfs_runtime_argp = (struct argp *)&runtime_argp;
+/* Override the standard diskfs routine so we can add our own output. */
+error_t
+diskfs_get_options (char **argz, unsigned *argz_len)
+{
+ error_t err;
+
+ *argz = 0;
+ *argz_len = 0;
+
+ /* Get the standard things. */
+ err = diskfs_append_std_options (argz, argz_len);
+
+ if (!err && compat_mode != COMPAT_GNU)
+ {
+ char *mode = (compat_mode == COMPAT_BSD42) ? "4.2" : "4.4";
+ err = argz_add (argz, argz_len, mode);
+ if (err)
+ free (argz); /* Deallocate what diskfs returned. */
+ }
+
+ return err;
+}
+
int
main (int argc, char **argv)
{