summaryrefslogtreecommitdiff
path: root/src/server/telnet_server.c
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-02-28 08:11:18 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-02-28 08:11:18 +0000
commit0689e3dd6752f45f493eceb3edf040fbc7849846 (patch)
tree57c2d288e4ea01551e0ea7806957cd1f5a2165dc /src/server/telnet_server.c
parentb70e262867b724f7d265f0c6b206801a29ba284b (diff)
downloadopenocd+libswd-0689e3dd6752f45f493eceb3edf040fbc7849846.tar.gz
openocd+libswd-0689e3dd6752f45f493eceb3edf040fbc7849846.tar.bz2
openocd+libswd-0689e3dd6752f45f493eceb3edf040fbc7849846.tar.xz
openocd+libswd-0689e3dd6752f45f493eceb3edf040fbc7849846.zip
- Added TARGET_REQ_DEBUGCHAR target_request debugmsg. This
provides a better impeadance match for debug output char fn's, e.g. eCos. - Line endings are now added at the caller site of command_print*(). command_print() still adds a line ending - echo of commands in scripts are now available via debug_level instead of forced echo - Added a USER_SAMELINE() for printing without a lineend. git-svn-id: svn://svn.berlios.de/openocd/trunk@364 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/server/telnet_server.c')
-rw-r--r--src/server/telnet_server.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/src/server/telnet_server.c b/src/server/telnet_server.c
index 5cfb0ab4..ea5ec575 100644
--- a/src/server/telnet_server.c
+++ b/src/server/telnet_server.c
@@ -77,8 +77,26 @@ int telnet_prompt(connection_t *connection)
int telnet_outputline(connection_t *connection, char* line)
{
- telnet_write(connection, line, strlen(line));
- return telnet_write(connection, "\r\n\0", 3);
+
+ /* process lines in buffer */
+ char *p=line;
+ do {
+ char *next = strchr(p, '\n');
+
+ if (next)
+ *next++ = 0;
+
+
+ telnet_write(connection, p, strlen(p));
+ if (next)
+ {
+ telnet_write(connection, "\r\n\0", 3);
+ }
+
+ p = next;
+ } while (p);
+
+ return ERROR_OK;
}
int telnet_output(struct command_context_s *cmd_ctx, char* line)
@@ -93,20 +111,9 @@ void telnet_log_callback(void *priv, const char *file, int line,
{
connection_t *connection = priv;
char *t = alloc_printf(format, args);
- char *t2;
if (t == NULL)
return;
- t2=t;
- char *endline;
- do
- {
- if ((endline=strchr(t2, '\n'))!=NULL)
- {
- *endline=0;
- }
- telnet_outputline(connection, t2);
- t2=endline+1;
- } while (endline);
+ telnet_outputline(connection, t);
free(t);
}