From 7e80bf7f2a7fe2c3925d7b1b45ea1f52281b338f Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 1 Jun 2008 18:32:49 +0200 Subject: [PATCH] --base-dir must not be a required option. 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 | 4 ++++ adu.ggo | 11 ++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/adu.c b/adu.c index c35c535..8640067 100644 --- 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 a2a6c03..9f8b710 100644 --- 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 -- 2.39.2