# HG changeset patch # User Mikael Berthe # Date 1271496064 -7200 # Node ID 75a0a22bbf7872930d94ab8eb3eb2607701553af # Parent 51cc01a1a5ec7393231711572df64df8d9258693 Fix issue #54 -- command line corruption Thanks to the Anonymous reporter :) diff -r 51cc01a1a5ec -r 75a0a22bbf78 mcabber/mcabber/screen.c --- a/mcabber/mcabber/screen.c Wed Apr 14 21:27:37 2010 +0200 +++ b/mcabber/mcabber/screen.c Sat Apr 17 11:21:04 2010 +0200 @@ -3141,6 +3141,14 @@ return cmdhisto_backup; } +static char *_strmove(char *dst, const char *src) +{ + char *dest = dst; + while ((*dest++ = *src++) != '\0') + ; + return dest; +} + // readline_transpose_chars() // Drag the character before point forward over the character at // point, moving point forward as well. If point is at the end of @@ -3221,10 +3229,7 @@ // Modify the line ptr_inputline = c; - for (;;) { - *c = *old++; - if (!*c++) break; - } + _strmove(ptr_inputline, old); check_offset(-1); } @@ -3451,9 +3456,7 @@ src = ptr_inputline; c = prev_char(ptr_inputline, inputLine); ptr_inputline = c; - for ( ; *src ; ) - *c++ = *src++; - *c = 0; + _strmove(ptr_inputline, src); check_offset(-1); } @@ -3462,7 +3465,7 @@ if (!*ptr_inputline) return; - strcpy(ptr_inputline, next_char(ptr_inputline)); + _strmove(ptr_inputline, next_char(ptr_inputline)); } void readline_iline_start(void) @@ -3486,7 +3489,7 @@ if (*dest == COMMAND_CHAR && ptr_inputline != dest+1) dest = next_char(dest); - strcpy(dest, ptr_inputline); + _strmove(dest, ptr_inputline); ptr_inputline = dest; inputline_offset = 0; }