Fix for mbfile index crash, better ANSI to ascii translation

This commit is contained in:
Michiel Broek 2002-05-15 21:34:57 +00:00
parent f143865c24
commit af5b3c397a
3 changed files with 50 additions and 3 deletions

View File

@ -4782,6 +4782,8 @@ v0.33.20 10-Feb-2002
The mbfile move command now also moves the thumbnails.
Better console error reporting when files are copied.
Removed nonsense error message when stopped on a signal.
The html file indexes now have better translation from ANSI
to low ascii and html codes.
mball:
Will not crash anymore when it needs more then 10 minutes to

View File

@ -276,7 +276,7 @@ void html_massage(char *inbuf, char *outbuf)
case 174: sprintf(outptr, "®"); break;
case 175: sprintf(outptr, "¯"); break;
case 176: sprintf(outptr, "°"); break;
case 177: sprintf(outptr, "&plumn;"); break;
case 177: sprintf(outptr, "&plumin;"); break;
case 178: sprintf(outptr, "²"); break;
case 179: sprintf(outptr, "³"); break;
case 180: sprintf(outptr, "´"); break;

View File

@ -61,6 +61,51 @@ 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
*/
char *To_Html(char *);
char *To_Html(char *inp)
{
static char temp[256];
int i;
memset(&temp, 0, sizeof(temp));
strncpy(temp, inp, 80);
for (i = 0; i < strlen(temp); i++)
temp[i] = htmltab[temp[i] & 0xff];
return temp;
}
void tidy_index(Findex **);
void tidy_index(Findex **fap)
{
@ -293,7 +338,7 @@ void Index(void)
int Total = 0, aTotal = 0, inArea = 0, filenr;
int fbAreas = 0, fbFiles = 0;
char *sAreas, *fAreas, *newdir = NULL, *sIndex, *fn, *temp;
char linebuf[1024], outbuf[1024], desc[1500];
char linebuf[1024], outbuf[1024], desc[6400];
time_t last = 0L, later;
Findex *fdx = NULL;
Findex *tmp;
@ -548,7 +593,7 @@ void Index(void)
sprintf(desc+k, "\n");
k += 1;
}
sprintf(linebuf, "%s", strkconv(file.Desc[j], CHRS_DEFAULT_FTN, CHRS_DEFAULT_RFC));
sprintf(linebuf, "%s", To_Html(file.Desc[j]));
html_massage(linebuf, outbuf);
sprintf(desc+k, "%s", outbuf);
k += strlen(outbuf);