107 static Bool ResizeReverseMap (); |
110 static Bool ResizeReverseMap (); |
108 static NameEqual (char *, char *,int ); |
111 static NameEqual (char *, char *,int ); |
109 static Hash(char *, int); |
112 static Hash(char *, int); |
110 static ResizeHashTable(); |
113 static ResizeHashTable(); |
111 static void put_PSbitmap(ucs4_t , pcf_bm_t *, pcf_charmet_t *, pcf_SCcharmet_t *); |
114 static void put_PSbitmap(ucs4_t , pcf_bm_t *, pcf_charmet_t *, pcf_SCcharmet_t *); |
|
115 static int gzcatfile(char *); |
112 void init_putPS(void); |
116 void init_putPS(void); |
113 unsigned long * Xrealloc(unsigned long *, int); |
117 unsigned long * Xrealloc(unsigned long *, int); |
114 unsigned long * Xalloc(int); |
118 unsigned long * Xalloc(int); |
115 int BufFileRead (BufFilePtr, char *, int); |
119 int BufFileRead (BufFilePtr, char *, int); |
116 void pcf_postscript(ucs4_t c, pcf_bm_t *, pcf_charmet_t *, pcf_SCcharmet_t *); |
120 void pcf_postscript(ucs4_t c, pcf_bm_t *, pcf_charmet_t *, pcf_SCcharmet_t *); |
1108 BufCompressedFill, |
1112 BufCompressedFill, |
1109 BufCompressedSkip, |
1113 BufCompressedSkip, |
1110 BufCompressedClose); |
1114 BufCompressedClose); |
1111 } |
1115 } |
1112 |
1116 |
|
1117 static |
|
1118 int gzcatfile(char *name) { |
|
1119 int fd[2]; |
|
1120 |
|
1121 if (pipe (fd) < 0) |
|
1122 return -1; |
|
1123 |
|
1124 switch (fork ()) |
|
1125 { |
|
1126 case -1: |
|
1127 return -1; |
|
1128 case 0: |
|
1129 close (fd[0]); |
|
1130 close (1); |
|
1131 if (dup (fd[1]) != 1) |
|
1132 return -1; |
|
1133 close (fd[1]); |
|
1134 execlp ("gzcat", "gzcat", name, 0); |
|
1135 return -1; |
|
1136 default: |
|
1137 close (fd[1]); |
|
1138 break; |
|
1139 } |
|
1140 return fd[0]; |
|
1141 } |
1113 |
1142 |
1114 static FontFilePtr |
1143 static FontFilePtr |
1115 FontFileOpen (char *name) { |
1144 FontFileOpen (char *name) { |
1116 int fd; |
1145 int fd; |
1117 int len; |
1146 int len; |
1118 BufFilePtr raw, cooked; |
1147 BufFilePtr raw, cooked; |
1119 |
1148 |
1120 fd = open (name, 0); |
1149 len = strlen (name); |
|
1150 |
|
1151 /* |
|
1152 * A little hack for .gz file support. |
|
1153 * We gzcat the file and will treat the |
|
1154 * resultant fd as a regular file's. |
|
1155 */ |
|
1156 |
|
1157 if (len > 3 && !strcmp (name + len - 3, ".gz")) |
|
1158 fd = gzcatfile (name); |
|
1159 else |
|
1160 fd = open (name, 0); |
|
1161 |
1121 if (fd < 0) |
1162 if (fd < 0) |
1122 return 0; |
1163 return 0; |
1123 raw = BufFileOpenRead (fd); |
1164 raw = BufFileOpenRead (fd); |
1124 if (!raw) |
1165 if (!raw) |
1125 { |
1166 { |
1126 close (fd); |
1167 close (fd); |
1127 return 0; |
1168 return 0; |
1128 } |
1169 } |
1129 len = strlen (name); |
|
1130 if (len > 2 && !strcmp (name + len - 2, ".Z")) { |
1170 if (len > 2 && !strcmp (name + len - 2, ".Z")) { |
1131 cooked = BufFilePushCompressed (raw); |
1171 cooked = BufFilePushCompressed (raw); |
1132 if (!cooked) { |
1172 if (!cooked) { |
1133 BufFileClose (raw, TRUE); |
1173 BufFileClose (raw, TRUE); |
1134 return 0; |
1174 return 0; |