diff options
author | mifi <mifi@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2008-02-13 19:02:17 +0000 |
---|---|---|
committer | mifi <mifi@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2008-02-13 19:02:17 +0000 |
commit | 2a0317e6f40a4f2d5d20ccdaae82100f0ad4340a (patch) | |
tree | 6703093498504afc671980ff8d506b23eefe448c /src/server/telnet_server.c | |
parent | edc0db163aafc78b68ad23878225703742425df5 (diff) |
- added patch to Improving progress/error output for telnet & GDB monitor
(thanks to Øyvind for the patch)
git-svn-id: svn://svn.berlios.de/openocd/trunk@293 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/server/telnet_server.c')
-rw-r--r-- | src/server/telnet_server.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/server/telnet_server.c b/src/server/telnet_server.c index 3a74f5ac..af49050a 100644 --- a/src/server/telnet_server.c +++ b/src/server/telnet_server.c @@ -57,6 +57,12 @@ void telnet_prompt(connection_t *connection) 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) { connection_t *connection = cmd_ctx->output_handler_priv; @@ -67,6 +73,19 @@ int telnet_output(struct command_context_s *cmd_ctx, char* line) return ERROR_OK; } +void telnet_log_callback(void *privData, const char *file, int line, + const char *function, const char *format, va_list args) +{ + connection_t *connection=(connection_t *)privData; + char *t=allocPrintf(format, args); + if (t==NULL) + return; + + telnet_outputline(connection, t); + + free(t); +} + int telnet_target_callback_event_handler(struct target_s *target, enum target_event event, void *priv) { struct command_context_s *cmd_ctx = priv; @@ -244,6 +263,10 @@ int telnet_input(connection_t *connection) continue; } + + + log_setCallback(telnet_log_callback, connection); + if ((retval = command_run_line(command_context, t_con->line)) != ERROR_OK) { if (retval == ERROR_COMMAND_CLOSE_CONNECTION) |