- combine similar functions in telnet_server.c
git-svn-id: svn://svn.berlios.de/openocd/trunk@301 b42882b7-edfa-0310-969c-e2dbd0fdcd60__archive__
parent
e859281eb3
commit
cf9646bda6
|
@ -34,7 +34,6 @@ int debug_level = -1;
|
||||||
|
|
||||||
static FILE* log_output;
|
static FILE* log_output;
|
||||||
|
|
||||||
|
|
||||||
static void *privData;
|
static void *privData;
|
||||||
static logCallback callback;
|
static logCallback callback;
|
||||||
|
|
||||||
|
|
|
@ -46,10 +46,10 @@ extern int log_register_commands(struct command_context_s *cmd_ctx);
|
||||||
extern int log_init(struct command_context_s *cmd_ctx);
|
extern int log_init(struct command_context_s *cmd_ctx);
|
||||||
extern int set_log_output(struct command_context_s *cmd_ctx, FILE *output);
|
extern int set_log_output(struct command_context_s *cmd_ctx, FILE *output);
|
||||||
|
|
||||||
typedef void (*logCallback)(void *privData, const char *file, int line,
|
typedef void (*logCallback)(void *priv, const char *file, int line,
|
||||||
const char *function, const char *format, va_list args);
|
const char *function, const char *format, va_list args);
|
||||||
|
|
||||||
void log_setCallback(logCallback callback, void *privData);
|
extern void log_setCallback(logCallback callback, void *priv);
|
||||||
|
|
||||||
extern int debug_level;
|
extern int debug_level;
|
||||||
|
|
||||||
|
|
|
@ -57,12 +57,6 @@ void telnet_prompt(connection_t *connection)
|
||||||
write_socket(connection->fd, t_con->prompt, strlen(t_con->prompt));
|
write_socket(connection->fd, t_con->prompt, strlen(t_con->prompt));
|
||||||
}
|
}
|
||||||
|
|
||||||
int telnet_outputline(connection_t *connection, char* line)
|
|
||||||
{
|
|
||||||
write_socket(connection->fd, line, strlen(line));
|
|
||||||
return write_socket(connection->fd, "\r\n\0", 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
int telnet_output(struct command_context_s *cmd_ctx, char* line)
|
int telnet_output(struct command_context_s *cmd_ctx, char* line)
|
||||||
{
|
{
|
||||||
connection_t *connection = cmd_ctx->output_handler_priv;
|
connection_t *connection = cmd_ctx->output_handler_priv;
|
||||||
|
@ -73,16 +67,15 @@ int telnet_output(struct command_context_s *cmd_ctx, char* line)
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void telnet_log_callback(void *privData, const char *file, int line,
|
void telnet_log_callback(void *priv, const char *file, int line,
|
||||||
const char *function, const char *format, va_list args)
|
const char *function, const char *format, va_list args)
|
||||||
{
|
{
|
||||||
connection_t *connection = (connection_t *)privData;
|
connection_t *connection = priv;
|
||||||
char *t = allocPrintf(format, args);
|
char *t = allocPrintf(format, args);
|
||||||
if (t == NULL)
|
if (t == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
telnet_outputline(connection, t);
|
telnet_output(connection->cmd_ctx, t);
|
||||||
|
|
||||||
free(t);
|
free(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue