From 78b55b64c8a64974b072972c269106cbc4276bdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sigrid=20Solveig=20Hafl=C3=ADnud=C3=B3ttir?= Date: Sun, 14 Nov 2021 20:16:30 +0000 Subject: [PATCH] =?UTF-8?q?mklatin:=20fix=20compose=20sequences=20starting?= =?UTF-8?q?=20with=20a=20space=20char=20(=E2=90=A3=20and=20=C4=B1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sys/src/cmd/aux/kbdfs/mklatin.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sys/src/cmd/aux/kbdfs/mklatin.c b/sys/src/cmd/aux/kbdfs/mklatin.c index 3bed2b612..059140e89 100644 --- a/sys/src/cmd/aux/kbdfs/mklatin.c +++ b/sys/src/cmd/aux/kbdfs/mklatin.c @@ -158,6 +158,7 @@ readfile(char *fname) char *seq; int inseq; int lineno; + int len; Rune r; if((b = Bopen(fname, OREAD)) == 0) { @@ -168,18 +169,19 @@ readfile(char *fname) lineno = 0; while((line = Brdline(b, '\n')) != 0) { lineno++; - if(line[0] == '#') + len = Blinelen(b) - 1; + if(len < 1 || line[0] == '#') continue; - r = strtol(line, nil, 16); - p = strchr(line, ' '); - if(r == 0 || p == 0) { + p = line + len; + r = strtol(line, &p, 16); + if(r == 0 || *p != ' ' || len < 21) { fprint(2, "%s:%d: cannot parse line\n", fname, lineno); continue; } - while(*p == ' ') - p++; + line[len] = 0; + p = line + 6; /* 00AE Or rO ® registered trade mark sign */ for(inseq=1, seq=p; (uchar)*p < Runeself; p++) { if(*p == '\0' || isspace(*p)) {