Skip to content

Commit

Permalink
bugfix: remove newlines from debugger input (#1407)
Browse files Browse the repository at this point in the history
The "fd" command didn't work in the debugger. This was because the "d"
was followed in the input buffer by \n rather than \0.

The Windows version of console_get replaces the terminating \r with \0.
amiberry's version uses fgets, which doesn't do this; it did adjust the
length value returned, but the debugger code doesn't look at the length.

Make it actually strip the newline characters when adjusting the length.
  • Loading branch information
atsampson authored and midwan committed Aug 26, 2024
1 parent 289f68a commit 71bc2c8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/osdep/writelog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,11 @@ int console_get (TCHAR *out, int maxlen)
return -1;
}
int len = strlen(out);
return len - 1;
while (len > 0 && (out[len - 1] == '\r' || out[len - 1] == '\n')) {
out[len - 1] = 0;
len--;
}
return len;
#endif
}

Expand Down

0 comments on commit 71bc2c8

Please sign in to comment.