forked from kyonshi/grenzland-mud
Fixed a client issue that was causing duplicate new lines
This commit is contained in:
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));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user