]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
freeswitch: Add -base cmdline option.
authorStefan Knoblich <stkn@openisdn.net>
Thu, 12 Jul 2012 17:52:00 +0000 (19:52 +0200)
committerStefan Knoblich <stkn@openisdn.net>
Thu, 12 Jul 2012 17:52:00 +0000 (19:52 +0200)
Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
src/switch.c

index 3fddcb46932eb1527fa0ad4a96aa958c33e1cc32..4f257016713dacfeae6b08dd12a6019dbd50a98e 100644 (file)
@@ -365,6 +365,7 @@ static const char usage[] =
 #endif
        "\t-c                     -- output to a console and stay in the foreground\n"
        "\n\tOptions to control locations of files:\n"
+       "\t-base [basedir]         -- alternate prefix directory\n"
        "\t-conf [confdir]         -- alternate directory for FreeSWITCH configuration files\n"
        "\t-log [logdir]           -- alternate directory for logfiles\n"
        "\t-run [rundir]           -- alternate directory for runtime files\n"
@@ -766,6 +767,21 @@ int main(int argc, char *argv[])
                        strcpy(SWITCH_GLOBAL_dirs.htdocs_dir, local_argv[x]);
                }
 
+               else if (!strcmp(local_argv[x], "-base")) {
+                       x++;
+                       if (switch_strlen_zero(local_argv[x]) || is_option(local_argv[x])) {
+                               fprintf(stderr, "When using -base you must specify a base directory\n");
+                               return 255;
+                       }
+
+                       SWITCH_GLOBAL_dirs.base_dir = (char *) malloc(strlen(local_argv[x]) + 1);
+                       if (!SWITCH_GLOBAL_dirs.base_dir) {
+                               fprintf(stderr, "Allocation error\n");
+                               return 255;
+                       }
+                       strcpy(SWITCH_GLOBAL_dirs.base_dir, local_argv[x]);
+               }
+
                else if (!strcmp(local_argv[x], "-temp")) {
                        x++;
                        if (switch_strlen_zero(local_argv[x]) || is_option(local_argv[x])) {