From 9c4bc98761828cbe3997e071ad5b4d24eb52e599 Mon Sep 17 00:00:00 2001
From: Andre Noll <maan@systemlinux.org>
Date: Fri, 21 Mar 2008 13:19:32 +0100
Subject: [PATCH] Don't check for required options when parsing the command
 line.

We want to be able to specify required options in the config file.
---
 dss.c   | 15 ++++++++-------
 dss.ggo |  4 ++--
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/dss.c b/dss.c
index 24ef6cc..d77fef2 100644
--- 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 e91a4c5..51cfadd 100644
--- 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
-- 
2.39.5