nyancat

Unnamed repository; edit this file 'description' to name the repository.
git clone https://git.inz.fi/nyancat
Log | Files | Refs | README

commit d9a28456b2727bf0d8ca6bf46686fc1aef9c4737
parent 3c4ea4c02aa74682db94a754d11a39a949d4396f
Author: Santtu Lakkala <inz@inz.fi>
Date:   Wed, 23 Feb 2022 16:50:03 +0200

Fix set-position off-by-one

Diffstat:
Mnyancat.c | 6++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/nyancat.c b/nyancat.c @@ -248,8 +248,6 @@ struct lolcat *lolcat_init(bool (*write_cb)(const char *buffer, size_t buflen, static char *strcpy_alter(char *to, const char *from, char f, char t) { char *w = to; - while (*w) - w++; for (; *from; from++) { if (*from == f) *w++ = t; @@ -678,14 +676,14 @@ ssize_t lc_process(struct lolcat *lc, const char *buffer, size_t len) strnsplit_int(buffer + i + 1, len - i - 1, ';', 1, &x); - lc->x = x; + lc->x = x - 1; } if (cmd == 'd') { int y; strnsplit_int(buffer + i + 1, len - i - 1, ';', 1, &y); - lc->y = y; + lc->y = y - 1; } if (cmd == 'J') { if (atoi(buffer + i + 1) == 2) {