mirror of
https://github.com/tbamud/tbamud.git
synced 2026-02-15 12:28:06 +01:00
Fixed a client issue that was causing duplicate new lines
This commit is contained in:
parent
1d4fb13044
commit
debf92811f
2 changed files with 14 additions and 2 deletions
11
src/db.c
11
src/db.c
|
|
@ -156,6 +156,7 @@ char *fread_action(FILE *fl, int nr)
|
|||
{
|
||||
char buf[MAX_STRING_LENGTH];
|
||||
char *buf1;
|
||||
int i;
|
||||
|
||||
buf1 = fgets(buf, MAX_STRING_LENGTH, fl);
|
||||
if (feof(fl)) {
|
||||
|
|
@ -169,7 +170,15 @@ char *fread_action(FILE *fl, int nr)
|
|||
return (NULL);
|
||||
|
||||
parse_at(buf);
|
||||
buf[strlen(buf) - 1] = '\0';
|
||||
|
||||
/* Some clients interpret '\r' the same as { '\r' '\n' }, so the original way of just
|
||||
replacing '\n' with '\0' would appear as 2 new lines following the action */
|
||||
for (i = 0; buf[i] != '\0'; i++)
|
||||
if (buf[i] == '\r' || buf[i] == '\n') {
|
||||
buf[i] = '\0';
|
||||
break;
|
||||
}
|
||||
|
||||
return (strdup(buf));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue