From 9daa3ca74ebd673d00ba52667c50fe4a0046d100 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 31 Jan 2008 16:58:38 -0500 Subject: tr2post: rename charlib files to not be case-dependent (OS X) --- src/cmd/postscript/tr2post/tr2post.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src/cmd/postscript/tr2post/tr2post.c') diff --git a/src/cmd/postscript/tr2post/tr2post.c b/src/cmd/postscript/tr2post/tr2post.c index 5a22ac72..5ca1b328 100644 --- a/src/cmd/postscript/tr2post/tr2post.c +++ b/src/cmd/postscript/tr2post/tr2post.c @@ -85,9 +85,28 @@ prologues(void) { /* output Build character info from charlib if necessary. */ for (i=0; iname); + // Rewrite file name for case-insensitive or non-UTF-8 file systems. + // _x means a lowercase x; #1234 means Unicode 0x1234. + char buf[100]; + char *r, *w; + for(w=buf, r=build_char_list[i]->name; *r && w= 0x80){ + Rune rr; + r += chartorune(&rr, r); + sprint(w, "#%04x", rr); + w += strlen(w); + continue; + } + if(('a' <= *r && *r <= 'z') || *r == '_') + *w++ = '_'; + if(*r == '#') + *w++ = '#'; + *w++ = *r++; + } + *w = 0; + sprint(charlibname, "%s/%s", CHARLIB, buf); if (cat(unsharp(charlibname))) - Bprint(Bstderr, "cannot open %s\n", charlibname); + Bprint(Bstderr, "cannot open %s\n", charlibname); } Bprint(Bstdout, "%s", ENDSETUP); -- cgit v1.2.3