]> git.tuebingen.mpg.de Git - dss.git/commitdiff
Don't check for required options when parsing the command line.
authorAndre Noll <maan@systemlinux.org>
Fri, 21 Mar 2008 12:19:32 +0000 (13:19 +0100)
committerAndre Noll <maan@systemlinux.org>
Fri, 21 Mar 2008 12:19:32 +0000 (13:19 +0100)
We want to be able to specify required options in the config file.

dss.c
dss.ggo

diff --git a/dss.c b/dss.c
index 24ef6ccc83549231252ee093bedded5a911951d0..d77fef2f8cb31704c619d6cda61fd68570bbbe35 100644 (file)
--- a/dss.c
+++ b/dss.c
@@ -596,16 +596,11 @@ void parse_config_file(int override)
                struct cmdline_parser_params params = {
                        .override = override,
                        .initialize = 0,
-                       .check_required = 0,
+                       .check_required = 1,
                        .check_ambiguity = 0
                };
                cmdline_parser_config_file(config_file, &conf, &params);
        }
-       if (!conf.source_dir_given || !conf.dest_dir_given) {
-               ret = -E_SYNTAX;
-               make_err_msg("you need to specify both source_dir and dest_dir");
-               goto out;
-       }
        ret = check_config();
        if (ret < 0)
                goto out;
@@ -1092,8 +1087,14 @@ err:
 int main(int argc, char **argv)
 {
        int ret;
+       struct cmdline_parser_params params = {
+               .override = 0,
+               .initialize = 1,
+               .check_required = 0,
+               .check_ambiguity = 0
+       };
 
-       cmdline_parser(argc, argv, &conf); /* aborts on errors */
+       cmdline_parser_ext(argc, argv, &conf, &params); /* aborts on errors */
        parse_config_file(0);
        if (conf.daemon_given)
                daemon_init();
diff --git a/dss.ggo b/dss.ggo
index e91a4c5b90d4fd7ca015f77bf3264ff06e0e6b03..51cfadd3391b41d4636c29b07411f93063a06413 100644 (file)
--- a/dss.ggo
+++ b/dss.ggo
@@ -157,7 +157,7 @@ option "source-dir" -
 #~~~~~~~~~~~~~~~~~~~~
 "The data directory"
 string typestr="dirname"
-optional
+required
 details="
        The directory on the remote host from which snapshots are
        taken.  Of course, the user specified as --remote-user must
@@ -168,7 +168,7 @@ option "dest-dir" -
 #~~~~~~~~~~~~~~~~~~
 "Snapshot dir"
 string typestr="dirname"
-optional
+required
 details="
        The destination directory on the local host where snapshots
        will be written. This must be writable by the user who runs