]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
allow you to specify -htdocs dir at runtime.
authorMichael Jerris <mike@jerris.com>
Tue, 3 Feb 2009 19:37:58 +0000 (19:37 +0000)
committerMichael Jerris <mike@jerris.com>
Tue, 3 Feb 2009 19:37:58 +0000 (19:37 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11614 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch.c

index 54ae45db6c4c802272964f3bb339c3e0348ae244..4d519cf731f1d442bb90aaaea7566024a282c6ab 100644 (file)
@@ -281,29 +281,30 @@ int main(int argc, char *argv[])
 
        usageDesc = "these are the optional arguments you can pass to freeswitch\n"
 #ifdef WIN32
-               "\t-service [name]  -- start freeswitch as a service, cannot be used if loaded as a console app\n"
-               "\t-install [name]  -- install freeswitch as a service, with optional service name\n"
-               "\t-uninstall       -- remove freeswitch as a service\n"
+               "\t-service [name]        -- start freeswitch as a service, cannot be used if loaded as a console app\n"
+               "\t-install [name]        -- install freeswitch as a service, with optional service name\n"
+               "\t-uninstall             -- remove freeswitch as a service\n"
 #else
-               "\t-nf              -- no forking\n"
-               "\t-u [user]        -- specify user to switch to\n"
-               "\t-g [group]       -- specify group to switch to\n"
+               "\t-nf                    -- no forking\n"
+               "\t-u [user]              -- specify user to switch to\n"
+               "\t-g [group]             -- specify group to switch to\n"
 #endif
-               "\t-help            -- this message\n"
+               "\t-help                  -- this message\n"
 #ifdef HAVE_SETRLIMIT
-               "\t-core            -- dump cores\n"
+               "\t-core                  -- dump cores\n"
 #endif
-               "\t-hp              -- enable high priority settings\n"
-               "\t-vg              -- run under valgrind\n"
-               "\t-nosql           -- disable internal sql scoreboard\n"
-               "\t-stop            -- stop freeswitch\n"
-               "\t-nc              -- do not output to a console and background\n"
-               "\t-c              -- output to a console and stay in the foreground\n"
-               "\t-conf [confdir]  -- specify an alternate config dir\n"
-               "\t-log [logdir]    -- specify an alternate log dir\n"
-               "\t-db [dbdir]      -- specify an alternate db dir\n"
-               "\t-mod [moddir]    -- specify an alternate mod dir\n"
-               "\t-scripts [scriptsdir]      -- specify an alternate scripts dir\n";
+               "\t-hp                    -- enable high priority settings\n"
+               "\t-vg                    -- run under valgrind\n"
+               "\t-nosql                 -- disable internal sql scoreboard\n"
+               "\t-stop                  -- stop freeswitch\n"
+               "\t-nc                    -- do not output to a console and background\n"
+               "\t-c                     -- output to a console and stay in the foreground\n"
+               "\t-conf [confdir]        -- specify an alternate config dir\n"
+               "\t-log [logdir]          -- specify an alternate log dir\n"
+               "\t-db [dbdir]            -- specify an alternate db dir\n"
+               "\t-mod [moddir]          -- specify an alternate mod dir\n"
+               "\t-htdocs [htdocsdir]    -- specify an alternate htdocs dir\n"
+               "\t-scripts [scriptsdir]  -- specify an alternate scripts dir\n";
 
        for (x = 1; x < argc; x++) {
                known_opt = 0;
@@ -550,6 +551,22 @@ int main(int argc, char *argv[])
                        known_opt++;
                }
 
+               if (argv[x] && !strcmp(argv[x], "-htdocs")) {
+                       x++;
+                       if (argv[x] && strlen(argv[x])) {
+                               SWITCH_GLOBAL_dirs.htdocs_dir = (char *) malloc(strlen(argv[x]) + 1);
+                               if (!SWITCH_GLOBAL_dirs.htdocs_dir) {
+                                       fprintf(stderr, "Allocation error\n");
+                                       return 255;
+                               }
+                               strcpy(SWITCH_GLOBAL_dirs.htdocs_dir, argv[x]);
+                       } else {
+                               fprintf(stderr, "When using -htdocs you must specify a htdocs directory\n");
+                               return 255;
+                       }
+                       known_opt++;
+               }
+
                if (!known_opt || (argv[x] && (!strcmp(argv[x], "-help") || !strcmp(argv[x], "-h") || !strcmp(argv[x], "-?")))) {
                        printf("%s\n", usageDesc);
                        exit(0);