allow you to specify -htdocs dir at runtime.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11614 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2009-02-03 19:37:58 +00:00
parent b4761bdaf3
commit 44a729e38e
1 changed files with 36 additions and 19 deletions

View File

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