tr2post: rename charlib files to not be case-dependent (OS X)

This commit is contained in:
Russ Cox 2008-01-31 16:58:38 -05:00
parent 57a6108c76
commit 9daa3ca74e
21 changed files with 413 additions and 2 deletions

View file

@ -36,3 +36,7 @@ CFLAGS=$CFLAGS -c -D'PROGRAMVERSION="0.1"' -D'DOROUND=1' -I$COMMONDIR
%.$O: $COMMONDIR/%.c
$CC $CFLAGS $COMMONDIR/$stem.c
test.ps:V: $O.tr2post
9 troff -ms test.tr | $O.tr2post | psfonts >test.ps

View file

@ -0,0 +1,65 @@
.fp 8 S
~= \f8\(~=\fP
.sp
.sp
12 \(12
.sp
14 \(14
.sp
34 \(34
.sp
bx \(bx
.sp
ci \fS\(ci\fP
.sp
DG \(DG
.sp
FA \(FA
.sp
.ig
ff \(ff
.sp
Fi \f7\(Fi\fP
.sp
Fl \(Fl
.sp
..
L1 \(L1
.sp
LA \(LA
.sp
lc \(lc
.sp
lf \(lf
.sp
lh \(lh
.sp
lH \(lH
.sp
LH \(LH
.sp
LV \(LV
.sp
ob \(ob
.sp
PC \(PC
.sp
pw \(pw
.sp
rc \(rc
.sp
.ig
RC \(RC
.sp
..
rf \(rf
.sp
rh \(rh
.sp
rH \(rH
.sp
Sl \(Sl
.sp
sq \(sq
.sp

View file

@ -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);