mbfile now uses new charmap functions

This commit is contained in:
Michiel Broek
2004-02-29 12:47:03 +00:00
parent 7a7b810aec
commit 2f83de2991
4 changed files with 73 additions and 84 deletions

View File

@@ -61,29 +61,6 @@ static char *months[]= {(char *)"Jan",(char *)"Feb",(char *)"Mar",
(char *)"Oct",(char *)"Nov",(char *)"Dec"};
/*
* Translation table from Hi-USA-ANSI to low ASCII and HTML codes,
*/
char htmltab[] = {
"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017"
"\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
"\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057"
"\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077"
"\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117"
"\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137"
"\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157"
"\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177"
"\103\374\351\342\344\340\345\143\352\353\350\357\357\354\304\305" /* done */
"\311\346\306\364\366\362\374\371\171\326\334\244\243\245\120\146" /* done */
"\341\355\363\372\361\321\141\157\277\055\055\275\274\241\074\076" /* done */
"\043\043\043\174\053\053\053\053\053\043\174\043\043\053\053\053" /* done */
"\053\053\053\053\053\053\053\053\043\043\043\043\043\075\043\053" /* done */
"\053\053\053\053\053\053\053\053\053\053\053\043\043\043\043\043" /* done */
"\141\102\114\156\105\157\265\370\060\060\060\157\070\330\145\156" /* doesn't look good */
"\075\261\076\074\146\146\367\075\260\267\267\126\262\262\267\040" /* almost */
};
/*
* Translate a string from ANSI to safe HTML characters
@@ -93,19 +70,28 @@ char *To_Html(char *inp)
{
static char temp[256];
int i;
char *xl;
memset(&temp, 0, sizeof(temp));
strncpy(temp, inp, 80);
for (i = 0; i < strlen(temp); i++)
temp[i] = htmltab[temp[i] & 0xff];
for (i = 0; i < strlen(inp); i++) {
if (inp[i] & 0x80) {
if ((xl = charset_map_c(inp[i], FALSE))) {
while (*xl) {
temp[i] = *xl++;
if (*xl)
i++;
}
}
} else
temp[i] = inp[i];
}
return temp;
}
void tidy_index(Findex **);
void tidy_index(Findex **fap)
{
@@ -593,6 +579,11 @@ void HtmlIndex(char *Lang)
fileptr = ftell(fi);
}
/*
* Setup the correct tabel to produce file listings for the www.
*/
charset_set_in_out((char *)"x-ibmpc", (char *)"iso-8859-1");
for (i = 1; i <= iAreas; i++) {
fseek(pAreas, ((i-1) * areahdr.recsize) + areahdr.hdrsize, SEEK_SET);