[Freeswitch-svn] [commit] r11614 - freeswitch/trunk/src

FreeSWITCH SVN mikej at freeswitch.org
Tue Feb 3 11:37:59 PST 2009


Author: mikej
Date: Tue Feb  3 13:37:58 2009
New Revision: 11614

Log:
allow you to specify -htdocs dir at runtime.

Modified:
   freeswitch/trunk/src/switch.c

Modified: freeswitch/trunk/src/switch.c
==============================================================================
--- freeswitch/trunk/src/switch.c	(original)
+++ freeswitch/trunk/src/switch.c	Tue Feb  3 13:37:58 2009
@@ -281,29 +281,30 @@
 
 	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 @@
 			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);



More information about the Freeswitch-svn mailing list