]> code.citadel.org Git - citadel.git/blobdiff - citadel/utils/ctdlload.c
ctdldump/ctdlload: -h now specifies the top-level Citadel directory, just like all...
[citadel.git] / citadel / utils / ctdlload.c
index 5c660dab7e6b2d0d1f5d198b6bf438cc266f3db4..59cc9b785ce91e8f94a97aa609cdd0f749cac610 100644 (file)
@@ -822,7 +822,7 @@ void ingest(DB_ENV *dst_dbenv) {
 
 // Main entry point
 int main(int argc, char **argv) {
-       char *dst_dir = NULL;
+       char dst_dir[PATH_MAX];
        int confirmed = 0;
        static DB_ENV *dst_dbenv;               // Target DB environment
 
@@ -834,12 +834,15 @@ int main(int argc, char **argv) {
                        "\033[44m\033[33m\033[1m is subject to the terms of the GNU General Public license v3. \033[K\033[0m\n"
                        "\033[44m\033[33m\033[1m \033[K\033[0m\n");
 
+       // Default destination directory unless overridden
+       snprintf(dst_dir, sizeof(dst_dir), "%s/data", CTDLDIR);
+
        // Parse command line
        int a;
        while ((a = getopt(argc, argv, "h:y")) != EOF) {
                switch (a) {
                case 'h':
-                       dst_dir = optarg;
+                       snprintf(dst_dir, sizeof(dst_dir), "%s/data", optarg);
                        break;
                case 'y':
                        confirmed = 1;