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/helper/command.c | |
parent | edc0db163aafc78b68ad23878225703742425df5 (diff) | |
download | riscv-openocd-2a0317e6f40a4f2d5d20ccdaae82100f0ad4340a.zip riscv-openocd-2a0317e6f40a4f2d5d20ccdaae82100f0ad4340a.tar.gz riscv-openocd-2a0317e6f40a4f2d5d20ccdaae82100f0ad4340a.tar.bz2 |
- 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/helper/command.c')
-rw-r--r-- | src/helper/command.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/helper/command.c b/src/helper/command.c index afd8667..9f756d4 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -268,7 +268,7 @@ void command_print(command_context_t *context, char *format, ...) /* process format string */ /* TODO: possible bug. va_list is undefined after the first call to vsnprintf */ while (!buffer || (n = vsnprintf(buffer, size, format, ap)) >= size) - { + { /* increase buffer until it fits the whole string */ if (!(p = realloc(buffer, size += 4096))) { @@ -359,7 +359,7 @@ int find_and_run_command(command_context_t *context, command_t *commands, char * return ERROR_OK; } -int command_run_line(command_context_t *context, char *line) +static int command_run_line_inner(command_context_t *context, char *line) { int nwords; char *words[128] = {0}; @@ -399,6 +399,17 @@ int command_run_line(command_context_t *context, char *line) return retval; } +int command_run_line(command_context_t *context, char *line) +{ + int retval=command_run_line_inner(context, line); + // we don't want any dangling callbacks! + // + // Capturing output from logging is *very* loosly modeled on C/C++ exceptions. + // the capture must be set up at function entry and + // stops when the function call returns + log_setCallback(NULL, NULL); + return retval; +} int command_run_file(command_context_t *context, FILE *file, enum command_mode mode) { int retval = ERROR_OK; @@ -441,7 +452,7 @@ int command_run_file(command_context_t *context, FILE *file, enum command_mode m break; /* run line */ - if ((retval = command_run_line(context, cmd)) == ERROR_COMMAND_CLOSE_CONNECTION) + if ((retval = command_run_line_inner(context, cmd)) == ERROR_COMMAND_CLOSE_CONNECTION) break; } |