From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Fri, 2 Jun 1995 14:44:13 -0400 From: rob@plan9.att.com rob@plan9.att.com Subject: No subject Topicbox-Message-UUID: 0eb8acb6-eac8-11e9-9e20-41e7f4b1d025 Message-ID: <19950602184413.xptfEGJz_Ly8GqnbxuMI6_2IWa4wRqeeZVM4NFk6YbM@z> here is a more thorough but still rudimentary fix to the eqn problem. david hogan's fix solves the problem but doesn't address the issue. as a side note, the textc() routine illustrates why plan 9 doesn't by default use ansi's specification for multibyte and wide characters. eqn% diff text.c /n/dump/1995/0401/sys/src/cmd/eqn 40,57d39 < int textc(void) /* read next UTF rune from psp */ < { < wchar_t r; < int w; < < w = mbtowc(&r, psp, 3); < if(w == 0){ < psp++; < return 0; < } < if(w < 0){ < psp += 1; < return 0x80; /* Plan 9-ism */ < } < psp += w; < return r; < } < 92c74 < for (psp = p1; (c = textc()) != '\0'; ) { --- > for (psp = p1; (c = *psp++) != '\0'; ) { 115,124d96 < int isalpharune(int c) < { < return ('a'<=c && c<='z') || ('A'<=c && c<='Z'); < } < < int isdigitrune(int c) < { < return ('0'<=c && c<='9'); < } < 129c101 < if (isalpharune(c) && ft == ITAL && c != 'f' && c != 'j') { /* italic letter */ --- > if (isalpha(c) && ft == ITAL && c != 'f' && c != 'j') { /* italic letter */ 134c106 < if (isalpharune(c) && ft != ITAL) { /* other letter */ --- > if (isalpha(c) && ft != ITAL) { /* other letter */ 139c111 < if (isdigitrune(c)) { --- > if (isdigit(c)) { 290c262 < void cadd(int c) /* add character c to end of cs */ --- > void cadd(int c) /* add char c to end of cs */ 293d264 < int w; 315,317c286 < w = wctomb(csp, c); < if(w > 0) /* ignore bad characters */ < csp += w; --- > *csp++ = c;