formatting whitespace changes from knhor branch.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3239 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2006-10-31 05:04:47 +00:00
parent d1fe31d8c3
commit 051b623bb0
1 changed files with 34 additions and 45 deletions

View File

@ -139,23 +139,24 @@ static switch_status_t ctl_function(char *data, switch_core_session_t *session,
} }
static switch_status_t load_function(char *mod, switch_core_session_t *session, switch_stream_handle_t *stream) static switch_status_t load_function(char *mod, switch_core_session_t *session, switch_stream_handle_t *stream)
{ {
if (session) { if (session) {
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
if (switch_strlen_zero(mod)) { if (switch_strlen_zero(mod)) {
stream->write_function(stream, "USAGE: %s\n", load_api_interface.syntax); stream->write_function(stream, "USAGE: %s\n", load_api_interface.syntax);
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) mod); switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) mod);
stream->write_function(stream, "OK\n"); stream->write_function(stream, "OK\n");
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
static switch_status_t reload_function(char *mod, switch_core_session_t *session, switch_stream_handle_t *stream) static switch_status_t reload_function(char *mod, switch_core_session_t *session, switch_stream_handle_t *stream)
{ {
const char *err; const char *err;
@ -170,6 +171,7 @@ static switch_status_t reload_function(char *mod, switch_core_session_t *session
} }
stream->write_function(stream, "OK [%s]\n", err); stream->write_function(stream, "OK [%s]\n", err);
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
@ -195,7 +197,6 @@ static switch_status_t kill_function(char *dest, switch_core_session_t *isession
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
static switch_status_t transfer_function(char *cmd, switch_core_session_t *isession, switch_stream_handle_t *stream) static switch_status_t transfer_function(char *cmd, switch_core_session_t *isession, switch_stream_handle_t *stream)
{ {
switch_core_session_t *session = NULL; switch_core_session_t *session = NULL;
@ -234,8 +235,6 @@ static switch_status_t transfer_function(char *cmd, switch_core_session_t *isess
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
static switch_status_t uuid_bridge_function(char *cmd, switch_core_session_t *isession, switch_stream_handle_t *stream) static switch_status_t uuid_bridge_function(char *cmd, switch_core_session_t *isession, switch_stream_handle_t *stream)
{ {
char *argv[4] = {0}; char *argv[4] = {0};
@ -258,8 +257,6 @@ static switch_status_t uuid_bridge_function(char *cmd, switch_core_session_t *is
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
static switch_status_t pause_function(char *cmd, switch_core_session_t *isession, switch_stream_handle_t *stream) static switch_status_t pause_function(char *cmd, switch_core_session_t *isession, switch_stream_handle_t *stream)
{ {
switch_core_session_t *session = NULL; switch_core_session_t *session = NULL;
@ -420,9 +417,6 @@ static int show_callback(void *pArg, int argc, char **argv, char **columnNames){
} }
} }
holder->count++; holder->count++;
return 0; return 0;
} }
@ -445,25 +439,21 @@ static switch_status_t show_function(char *cmd, switch_core_session_t *session,
holder.print_title = 1; holder.print_title = 1;
// If you changes the field qty or order of any of these select
// statmements, you must also change show_callback and friends to match!
if (!cmd) { if (!cmd) {
sprintf (sql, "select * from interfaces"); sprintf (sql, "select * from interfaces");
} } else if ( !strcmp(cmd,"codec") || !strcmp(cmd,"dialplan") || !strcmp(cmd,"file") || !strcmp(cmd,"timer")) {
else if ( !strcmp(cmd,"codec") || !strcmp(cmd,"dialplan") ||
!strcmp(cmd,"file") || !strcmp(cmd,"timer")
) {
sprintf (sql, "select type, name from interfaces where type = '%s'", cmd); sprintf (sql, "select type, name from interfaces where type = '%s'", cmd);
} } else if (!strcmp(cmd,"application") || !strcmp(cmd,"api")) {
else if (!strcmp(cmd,"application") || !strcmp(cmd,"api")) {
sprintf (sql, "select name, description, syntax from interfaces where type = '%s'", cmd); sprintf (sql, "select name, description, syntax from interfaces where type = '%s'", cmd);
} } else if ( !strcmp(cmd,"calls")) {
else if ( !strcmp(cmd,"calls")) {
sprintf (sql, "select * from calls"); sprintf (sql, "select * from calls");
} } else if ( !strcmp(cmd,"channels")) {
else if ( !strcmp(cmd,"channels")) {
sprintf (sql, "select * from channels"); sprintf (sql, "select * from channels");
} } else if (!strncasecmp(cmd, "help", 4)) {
else if (!strncasecmp(cmd, "help", 4)) {
char *cmdname = NULL; char *cmdname = NULL;
help = 1; help = 1;
holder.print_title = 0; holder.print_title = 0;
if ((cmdname = strchr(cmd, ' ')) != 0) { if ((cmdname = strchr(cmd, ' ')) != 0) {
@ -472,8 +462,7 @@ static switch_status_t show_function(char *cmd, switch_core_session_t *session,
} else { } else {
sprintf (sql, "select name, syntax, description from interfaces where type = 'api'"); sprintf (sql, "select name, syntax, description from interfaces where type = 'api'");
} }
} } else {
else {
stream->write_function(stream, "USAGE: %s\n", show_api_interface.syntax); stream->write_function(stream, "USAGE: %s\n", show_api_interface.syntax);
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
@ -517,11 +506,16 @@ static switch_status_t help_function(char *cmd, switch_core_session_t *session,
sprintf (showcmd, "help %s", cmd); sprintf (showcmd, "help %s", cmd);
} }
if (all) if (all) {
stream->write_function(stream, "\nValid Commands:\n\n"); stream->write_function(stream, "\nValid Commands:\n\n");
}
show_function(showcmd, session, stream); show_function(showcmd, session, stream);
if (all)
if (all) {
stream->write_function(stream, "version\n" "shutdown - stop the program\n"); stream->write_function(stream, "version\n" "shutdown - stop the program\n");
}
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
@ -614,7 +608,6 @@ static switch_api_interface_t originate_api_interface = {
/*.next */ &kill_api_interface /*.next */ &kill_api_interface
}; };
static const switch_loadable_module_interface_t mod_commands_module_interface = { static const switch_loadable_module_interface_t mod_commands_module_interface = {
/*.module_name */ modname, /*.module_name */ modname,
/*.endpoint_interface */ NULL, /*.endpoint_interface */ NULL,
@ -625,15 +618,11 @@ static const switch_loadable_module_interface_t mod_commands_module_interface =
/*.api_interface */ &originate_api_interface /*.api_interface */ &originate_api_interface
}; };
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename) SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
{ {
/* connect my internal structure to the blank pointer passed to me */ /* connect my internal structure to the blank pointer passed to me */
*module_interface = &mod_commands_module_interface; *module_interface = &mod_commands_module_interface;
/* indicate that the module should continue to be loaded */ /* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }