sbase

suckless unix tools
git clone git://git.suckless.org/sbase
Log | Files | Refs | README | LICENSE

commit 3de61ef1aa27a4a6b8cb44d169c4d8774eb3845b
parent 2a29857fe92157f6a31b965dc6d70fa3ab128bb4
Author: Elie Le Vaillant <eolien55@disroot.org>
Date:   Thu, 19 Dec 2024 21:56:20 +0100

rev, tail: replace hardcoded code by UTF8_POINT macro

Diffstat:
Mrev.c | 2+-
Mtail.c | 2+-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/rev.c b/rev.c @@ -25,7 +25,7 @@ rev(FILE *fp) lf = n && line[n - 1] == '\n'; i = n -= lf; for (n = 0; i--;) { - if ((line[i] & 0xC0) == 0x80) { + if (UTF8_POINT(line[i])) { n++; } else { fwrite(line + i, 1, n + 1, stdout); diff --git a/tail.c b/tail.c @@ -122,7 +122,7 @@ taketail(int fd, const char *fname, size_t count) case 'm': /* runes */ for (p = buf + len - 1, left = count; p >= buf; p--) { /* skip utf-8 continuation bytes */ - if ((*p & 0xc0) == 0x80) + if (UTF8_POINT(*p)) continue; left--; if (!left)