FS-5319 --resolve
This commit is contained in:
parent
429e0fdec9
commit
2e4aedd0fb
|
@ -493,6 +493,13 @@ struct switch_directories {
|
||||||
typedef struct switch_directories switch_directories;
|
typedef struct switch_directories switch_directories;
|
||||||
SWITCH_DECLARE_DATA extern switch_directories SWITCH_GLOBAL_dirs;
|
SWITCH_DECLARE_DATA extern switch_directories SWITCH_GLOBAL_dirs;
|
||||||
|
|
||||||
|
struct switch_filenames {
|
||||||
|
char *conf_name;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct switch_filenames switch_filenames;
|
||||||
|
SWITCH_DECLARE_DATA extern switch_filenames SWITCH_GLOBAL_filenames;
|
||||||
|
|
||||||
#define SWITCH_MAX_STACKS 16
|
#define SWITCH_MAX_STACKS 16
|
||||||
#define SWITCH_THREAD_STACKSIZE 240 * 1024
|
#define SWITCH_THREAD_STACKSIZE 240 * 1024
|
||||||
#define SWITCH_SYSTEM_THREAD_STACKSIZE 8192 * 1024
|
#define SWITCH_SYSTEM_THREAD_STACKSIZE 8192 * 1024
|
||||||
|
|
16
src/switch.c
16
src/switch.c
|
@ -366,6 +366,7 @@ static const char usage[] =
|
||||||
"\t-c -- output to a console and stay in the foreground\n"
|
"\t-c -- output to a console and stay in the foreground\n"
|
||||||
"\n\tOptions to control locations of files:\n"
|
"\n\tOptions to control locations of files:\n"
|
||||||
"\t-base [basedir] -- alternate prefix directory\n"
|
"\t-base [basedir] -- alternate prefix directory\n"
|
||||||
|
"\t-cfgname [filename] -- alternate filename for FreeSWITCH main configuration file\n"
|
||||||
"\t-conf [confdir] -- alternate directory for FreeSWITCH configuration files\n"
|
"\t-conf [confdir] -- alternate directory for FreeSWITCH configuration files\n"
|
||||||
"\t-log [logdir] -- alternate directory for logfiles\n"
|
"\t-log [logdir] -- alternate directory for logfiles\n"
|
||||||
"\t-run [rundir] -- alternate directory for runtime files\n"
|
"\t-run [rundir] -- alternate directory for runtime files\n"
|
||||||
|
@ -857,6 +858,21 @@ int main(int argc, char *argv[])
|
||||||
strcpy(SWITCH_GLOBAL_dirs.sounds_dir, local_argv[x]);
|
strcpy(SWITCH_GLOBAL_dirs.sounds_dir, local_argv[x]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (!strcmp(local_argv[x], "-cfgname")) {
|
||||||
|
x++;
|
||||||
|
if (switch_strlen_zero(local_argv[x]) || is_option(local_argv[x])) {
|
||||||
|
fprintf(stderr, "When using -cfgname you must specify a filename\n");
|
||||||
|
return 255;
|
||||||
|
}
|
||||||
|
|
||||||
|
SWITCH_GLOBAL_filenames.conf_name = (char *) malloc(strlen(local_argv[x]) + 1);
|
||||||
|
if (!SWITCH_GLOBAL_filenames.conf_name) {
|
||||||
|
fprintf(stderr, "Allocation error\n");
|
||||||
|
return 255;
|
||||||
|
}
|
||||||
|
strcpy(SWITCH_GLOBAL_filenames.conf_name, local_argv[x]);
|
||||||
|
}
|
||||||
|
|
||||||
/* Unknown option (always last!) */
|
/* Unknown option (always last!) */
|
||||||
else {
|
else {
|
||||||
fprintf(stderr, "Unknown option '%s', see '%s -help' for a list of valid options\n",
|
fprintf(stderr, "Unknown option '%s', see '%s -help' for a list of valid options\n",
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
|
|
||||||
|
|
||||||
SWITCH_DECLARE_DATA switch_directories SWITCH_GLOBAL_dirs = { 0 };
|
SWITCH_DECLARE_DATA switch_directories SWITCH_GLOBAL_dirs = { 0 };
|
||||||
|
SWITCH_DECLARE_DATA switch_filenames SWITCH_GLOBAL_filenames = { 0 };
|
||||||
|
|
||||||
/* The main runtime obj we keep this hidden for ourselves */
|
/* The main runtime obj we keep this hidden for ourselves */
|
||||||
struct switch_runtime runtime = { 0 };
|
struct switch_runtime runtime = { 0 };
|
||||||
|
@ -728,6 +729,10 @@ SWITCH_DECLARE(void) switch_core_set_globals(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!SWITCH_GLOBAL_filenames.conf_name && (SWITCH_GLOBAL_filenames.conf_name = (char *) malloc(BUFSIZE))) {
|
||||||
|
switch_snprintf(SWITCH_GLOBAL_filenames.conf_name, BUFSIZE, "%s", "freeswitch.xml");
|
||||||
|
}
|
||||||
|
|
||||||
/* Do this last because it being empty is part of the above logic */
|
/* Do this last because it being empty is part of the above logic */
|
||||||
if (!SWITCH_GLOBAL_dirs.base_dir && (SWITCH_GLOBAL_dirs.base_dir = (char *) malloc(BUFSIZE))) {
|
if (!SWITCH_GLOBAL_dirs.base_dir && (SWITCH_GLOBAL_dirs.base_dir = (char *) malloc(BUFSIZE))) {
|
||||||
switch_snprintf(SWITCH_GLOBAL_dirs.base_dir, BUFSIZE, "%s", base_dir);
|
switch_snprintf(SWITCH_GLOBAL_dirs.base_dir, BUFSIZE, "%s", base_dir);
|
||||||
|
@ -746,6 +751,8 @@ SWITCH_DECLARE(void) switch_core_set_globals(void)
|
||||||
switch_assert(SWITCH_GLOBAL_dirs.recordings_dir);
|
switch_assert(SWITCH_GLOBAL_dirs.recordings_dir);
|
||||||
switch_assert(SWITCH_GLOBAL_dirs.sounds_dir);
|
switch_assert(SWITCH_GLOBAL_dirs.sounds_dir);
|
||||||
switch_assert(SWITCH_GLOBAL_dirs.temp_dir);
|
switch_assert(SWITCH_GLOBAL_dirs.temp_dir);
|
||||||
|
|
||||||
|
switch_assert(SWITCH_GLOBAL_filenames.conf_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2167,7 +2167,7 @@ SWITCH_DECLARE_NONSTD(switch_xml_t) __switch_xml_open_root(uint8_t reload, const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_snprintf(path_buf, sizeof(path_buf), "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "freeswitch.xml");
|
switch_snprintf(path_buf, sizeof(path_buf), "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, SWITCH_GLOBAL_filenames.conf_name);
|
||||||
if ((new_main = switch_xml_parse_file(path_buf))) {
|
if ((new_main = switch_xml_parse_file(path_buf))) {
|
||||||
*err = switch_xml_error(new_main);
|
*err = switch_xml_error(new_main);
|
||||||
switch_copy_string(not_so_threadsafe_error_buffer, *err, sizeof(not_so_threadsafe_error_buffer));
|
switch_copy_string(not_so_threadsafe_error_buffer, *err, sizeof(not_so_threadsafe_error_buffer));
|
||||||
|
|
Loading…
Reference in New Issue