diff options
author | Russ Cox <rsc@swtch.com> | 2008-01-31 16:58:38 -0500 |
---|---|---|
committer | Russ Cox <rsc@swtch.com> | 2008-01-31 16:58:38 -0500 |
commit | 9daa3ca74ebd673d00ba52667c50fe4a0046d100 (patch) | |
tree | 1a0f6d6c860f6dbd9cd26223f1a40914ead10013 /src/cmd/postscript/tr2post/tr2post.c | |
parent | 57a6108c76c357cd4f71c26c84baec92a9fb91b5 (diff) | |
download | plan9port-9daa3ca74ebd673d00ba52667c50fe4a0046d100.tar.gz plan9port-9daa3ca74ebd673d00ba52667c50fe4a0046d100.tar.bz2 plan9port-9daa3ca74ebd673d00ba52667c50fe4a0046d100.zip |
tr2post: rename charlib files to not be case-dependent (OS X)
Diffstat (limited to 'src/cmd/postscript/tr2post/tr2post.c')
-rw-r--r-- | src/cmd/postscript/tr2post/tr2post.c | 23 |
1 files changed, 21 insertions, 2 deletions
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; i<build_char_cnt; i++) { - sprint(charlibname, "%s/%s", CHARLIB, build_char_list[i]->name); + // 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<buf+sizeof buf-8; ){ + if((uchar)*r >= 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); |