提交 e8e72dd3 authored 作者: Michael Jerris's avatar Michael Jerris

cleanup

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10961 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 4bfb1535
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include <getopt.h> #include <getopt.h>
static char prompt_str[512] = ""; static char prompt_str[512] = "";
static char hostname[512] = "";
#ifdef HAVE_EDITLINE #ifdef HAVE_EDITLINE
static char *prompt(EditLine * e) static char *prompt(EditLine * e)
...@@ -236,9 +235,9 @@ int main(int argc, char *argv[]) ...@@ -236,9 +235,9 @@ int main(int argc, char *argv[])
char cfile[512] = "/tmp/fs_cli_config"; char cfile[512] = "/tmp/fs_cli_config";
char *home = getenv("HOME"); char *home = getenv("HOME");
#else #else
char hfile[512] = ".\\fs_cli_history"; char hfile[512] = "fs_cli_history";
char cfile[512] = ".\\fs_cli_config"; char cfile[512] = "fs_cli_config";
char *home = ""; //getenv("HOME"); char *home = getenv("HOME");
#endif #endif
/* Vars for optargs */ /* Vars for optargs */
int opt; int opt;
...@@ -276,7 +275,6 @@ int main(int argc, char *argv[]) ...@@ -276,7 +275,6 @@ int main(int argc, char *argv[])
} }
signal(SIGINT, handle_SIGINT); signal(SIGINT, handle_SIGINT);
gethostname(hostname, sizeof(hostname));
handle.debug = 0; handle.debug = 0;
esl_global_set_default_logger(0); /* default debug level to 0 */ esl_global_set_default_logger(0); /* default debug level to 0 */
...@@ -381,12 +379,14 @@ int main(int argc, char *argv[]) ...@@ -381,12 +379,14 @@ int main(int argc, char *argv[])
} }
} }
esl_log(ESL_LOG_INFO, "Using profile %s\n", profile->name); esl_log(ESL_LOG_INFO, "Using profile %s [%s]\n", profile->name, profile->host);
gethostname(hostname, sizeof(hostname));
snprintf(prompt_str, sizeof(prompt_str), "freeswitch@%s> ", profile->name);
if (argv_host) {
snprintf(prompt_str, sizeof(prompt_str), "freeswitch@%s> ", profile->host);
} else {
snprintf(prompt_str, sizeof(prompt_str), "freeswitch@%s> ", profile->name);
}
if (esl_connect(&handle, profile->host, profile->port, profile->pass)) { if (esl_connect(&handle, profile->host, profile->port, profile->pass)) {
esl_log(ESL_LOG_ERROR, "Error Connecting [%s]\n", handle.err); esl_log(ESL_LOG_ERROR, "Error Connecting [%s]\n", handle.err);
return -1; return -1;
......
...@@ -634,7 +634,7 @@ ESL_DECLARE(esl_status_t) esl_recv_event_timed(esl_handle_t *handle, uint32_t ms ...@@ -634,7 +634,7 @@ ESL_DECLARE(esl_status_t) esl_recv_event_timed(esl_handle_t *handle, uint32_t ms
done: done:
esl_mutex_unlock(handle->mutex); if (handle->mutex) esl_mutex_unlock(handle->mutex);
return status; return status;
......
...@@ -313,41 +313,41 @@ static esl_status_t esl_event_base_add_header(esl_event_t *event, esl_stack_t st ...@@ -313,41 +313,41 @@ static esl_status_t esl_event_base_add_header(esl_event_t *event, esl_stack_t st
int vasprintf(char **ret, const char *format, va_list ap); int vasprintf(char **ret, const char *format, va_list ap);
static int esl_vasprintf(char **ret, const char *fmt, va_list ap) static int esl_vasprintf(char **ret, const char *fmt, va_list ap)
{ {
#ifndef WIN32 #ifndef WIN32
return vasprintf(ret, fmt, ap); return vasprintf(ret, fmt, ap);
#else #else
char *buf; char *buf;
int len; int len;
size_t buflen; size_t buflen;
va_list ap2; va_list ap2;
char *tmp = NULL; char *tmp = NULL;
#ifdef _MSC_VER #ifdef _MSC_VER
#if _MSC_VER >= 1500 #if _MSC_VER >= 1500
/* hack for incorrect assumption in msvc header files for code analysis */ /* hack for incorrect assumption in msvc header files for code analysis */
__analysis_assume(tmp); __analysis_assume(tmp);
#endif #endif
ap2 = ap; ap2 = ap;
#else #else
va_copy(ap2, ap); va_copy(ap2, ap);
#endif #endif
len = vsnprintf(tmp, 0, fmt, ap2); len = vsnprintf(tmp, 0, fmt, ap2);
if (len > 0 && (buf = malloc((buflen = (size_t) (len + 1)))) != NULL) { if (len > 0 && (buf = malloc((buflen = (size_t) (len + 1)))) != NULL) {
len = vsnprintf(buf, buflen, fmt, ap); len = vsnprintf(buf, buflen, fmt, ap);
*ret = buf; *ret = buf;
} else { } else {
*ret = NULL; *ret = NULL;
len = -1; len = -1;
} }
va_end(ap2); va_end(ap2);
return len; return len;
#endif #endif
} }
ESL_DECLARE(esl_status_t) esl_event_add_header(esl_event_t *event, esl_stack_t stack, const char *header_name, const char *fmt, ...) ESL_DECLARE(esl_status_t) esl_event_add_header(esl_event_t *event, esl_stack_t stack, const char *header_name, const char *fmt, ...)
......
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论