summaryrefslogtreecommitdiff
path: root/storeio
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1996-09-23 19:58:38 +0000
committerMiles Bader <miles@gnu.org>1996-09-23 19:58:38 +0000
commit81e0fd0c877e47cb04625116ff2809e56533906b (patch)
tree1c1f84daf57c101691be6250c08df8b944f1d7c7 /storeio
parentfe722d84b0bfcae285d51d520de58c30d608295c (diff)
(main):
Use STORE_PARAMS variable to get result from parsing STORE_ARGP. (trivfs_append_args): New function.
Diffstat (limited to 'storeio')
-rw-r--r--storeio/storeio.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/storeio/storeio.c b/storeio/storeio.c
index e860f3b3..f2edb29f 100644
--- a/storeio/storeio.c
+++ b/storeio/storeio.c
@@ -104,7 +104,7 @@ void main (int argc, char *argv[])
}
break;
case ARGP_KEY_INIT:
- state->child_inputs[0] = &store_name; break;
+ state->child_inputs[0] = state->input; break;
default:
return ARGP_ERR_UNKNOWN;
}
@@ -112,8 +112,10 @@ void main (int argc, char *argv[])
}
const struct argp *kids[] = { &store_argp, 0 };
const struct argp argp = { options, parse_opt, args_doc, doc, kids };
+ struct store_argp_params store_params = { default_type: "device" };
- argp_parse (&argp, argc, argv, 0, 0, 0);
+ argp_parse (&argp, argc, argv, 0, 0, &store_params);
+ store_name = store_params.result;
if (readonly)
/* Catch illegal writes at the point of open. */
@@ -148,7 +150,29 @@ void main (int argc, char *argv[])
exit (0);
}
+
+error_t
+trivfs_append_args (struct trivfs_control *trivfs_control,
+ char **argz, size_t argz_len)
+{
+ error_t err = 0;
+ char buf[40];
+
+ if (rdev)
+ {
+ snprintf (buf, sizeof buf, "--rdev=%d,%d", (rdev >> 8), rdev & 0xFF);
+ err = argz_add (argz, argz_len, buf);
+ }
+
+ if (! err)
+ err = argz_add (argz, argz_len, readonly ? "--readonly" : "--writable");
+
+ if (! err)
+ err = store_parsed_append_args (store_name, argz, argz_len);
+ return err;
+}
+
/* Called whenever someone tries to open our node (even for a stat). We
delay opening the kernel device until this point, as we can usefully
return errors from here. */