diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2016-08-23 19:50:31 -0800 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2016-08-25 17:39:01 -0800 |
commit | cdd61de630124d5b3d30e8927c9be02735f85f80 (patch) | |
tree | 522d4e4c835378f31782da90efabc15f4345bc64 /bcache-fs.c | |
parent | 932ece1567dfc4ea7d993c8f62ccc9adfcf736ef (diff) |
Rework option handling
Diffstat (limited to 'bcache-fs.c')
-rw-r--r-- | bcache-fs.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/bcache-fs.c b/bcache-fs.c index b0438c56..f06ca378 100644 --- a/bcache-fs.c +++ b/bcache-fs.c @@ -1,9 +1,7 @@ -#include <nih/command.h> #include <nih/option.h> #include "bcache.h" -#include "bcache-fs.h" struct bcache_fs { /* options... */ @@ -20,13 +18,14 @@ static struct bcache_fs fill_fs(struct bcache_handle fs) }; } -NihOption opts_fs_show[] = { -// { int shortoption, char *longoption, char *help, NihOptionGroup, char *argname, void *value, NihOptionSetter} - NIH_OPTION_LAST -}; - -int cmd_fs_show(NihCommand *command, char *const *args) +int cmd_fs_show(int argc, char *argv[]) { + NihOption opts[] = { + // { int shortoption, char *longoption, char *help, NihOptionGroup, char *argname, void *value, NihOptionSetter} + NIH_OPTION_LAST + }; + char **args = bch_nih_init(argc, argv, opts); + if (nr_args(args) != 1) die("Please supply a filesystem"); @@ -35,13 +34,14 @@ int cmd_fs_show(NihCommand *command, char *const *args) return 0; } -NihOption opts_fs_set[] = { -// { int shortoption, char *longoption, char *help, NihOptionGroup, char *argname, void *value, NihOptionSetter} - NIH_OPTION_LAST -}; - -int cmd_fs_set(NihCommand *command, char *const *args) +int cmd_fs_set(int argc, char *argv[]) { + NihOption opts[] = { + // { int shortoption, char *longoption, char *help, NihOptionGroup, char *argname, void *value, NihOptionSetter} + NIH_OPTION_LAST + }; + char **args = bch_nih_init(argc, argv, opts); + if (nr_args(args) < 1) die("Please supply a filesystem"); |