--base-dir must not be a required option.
authorAndre Noll <maan@systemlinux.org>
Sun, 1 Jun 2008 16:32:49 +0000 (18:32 +0200)
committerAndre Noll <maan@systemlinux.org>
Sun, 1 Jun 2008 16:32:49 +0000 (18:32 +0200)
Otherwise, gengetopt would complain if it is not given even in
--select mode. Make it optional and check manually whether it
is given in --create mode.

adu.c
adu.ggo

diff --git a/adu.c b/adu.c
index c35c535c436957795892c38fb6478bf2c335605d..86400677fc5d989a6163ed7f44771d61e73c80bc 100644 (file)
--- a/adu.c
+++ b/adu.c
@@ -470,6 +470,10 @@ static int check_args(void)
 {
        int i, ret;
 
+
+       if (conf.create_given && !conf.base_dir_given)
+               return -E_SYNTAX;
+
        /* remove trailing slashes from base-dir arg */
        if (conf.base_dir_given) {
                size_t len = strlen(conf.base_dir_arg);
diff --git a/adu.ggo b/adu.ggo
index a2a6c03192bf1e615e6cc8ff25eb60e538cc40ad..9f8b7105314f3f1e8cc508b1f9b30e67b92f85f8 100644 (file)
--- a/adu.ggo
+++ b/adu.ggo
@@ -125,12 +125,13 @@ option "base-dir" b
 "directory to traverse"
 string typestr="path"
 dependon="create"
-required
+optional
 details="
-       The base directory to be traversed recursively. A warning
-       message is printed for each subdirectory that could not be
-       read because of insufficient permission. These directories
-       will be ignored when computing statistics.
+       The base directory to be traversed recursively. Must be
+       given if --create mode was selected. A warning message is
+       printed for each subdirectory that could not be read because
+       of insufficient permission. These directories will be ignored
+       when computing statistics.
 "
 
 option "one-file-system" x