ref: 78b55b64c8a64974b072972c269106cbc4276bdc
parent: 45a25abc3e2070ce0bdaaa76e786b8343839ece6
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Sun Nov 14 15:16:30 EST 2021
mklatin: fix compose sequences starting with a space char (␣ and ı)
--- a/sys/src/cmd/aux/kbdfs/mklatin.c
+++ b/sys/src/cmd/aux/kbdfs/mklatin.c
@@ -158,6 +158,7 @@
char *seq;
int inseq;
int lineno;
+ int len;
Rune r;
if((b = Bopen(fname, OREAD)) == 0) {
@@ -168,18 +169,19 @@
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)) {