Adjust existing functions to new tables

This commit is contained in:
Michiel Broek
2007-02-19 18:50:11 +00:00
parent c569a92b8d
commit ca06511fe9
3 changed files with 112 additions and 131 deletions

View File

@@ -59,71 +59,6 @@ static CharsetTable *charset_table_list;
#define POST_MAXSIZE 10000
/*
* Returns index of charset or -1 if not found.
*/
int find_ftn_charset(char *ftnkludge)
{
static int i;
int j;
char *ftn, *cmp;
Syslog('n', "find_ftn_charset(%s)", ftnkludge);
ftn = calloc(80, sizeof(char));
cmp = calloc(80, sizeof(char));
snprintf(ftn, 80, "%s", ftnkludge);
for (i = 0; i < strlen(ftn); i++) {
if (ftn[i] == ' ') {
ftn[i] = '\0';
break;
}
}
for (i = 0; charalias[i].alias; i++) {
if (strcasecmp(ftn, charalias[i].alias) == 0)
break;
}
if (charalias[i].alias == NULL) {
Syslog('n', "no alias found");
} else {
Syslog('n', "found alias %s", charalias[i].ftnkludge);
snprintf(ftn, 80, "%s", charalias[i].ftnkludge);
}
/*
* Now search real entry
*/
for (i = 0; charmap[i].ftnkludge; i++) {
snprintf(cmp, 80, "%s", charmap[i].ftnkludge);
for (j = 0; j < strlen(cmp); j++) {
if (cmp[j] == ' ') {
cmp[j] = '\0';
break;
}
}
if (strcasecmp(ftn, cmp) == 0)
break;
}
free(ftn);
free(cmp);
if (charmap[i].ftnkludge == NULL) {
WriteError("find_ftn_charset(%s) not found", ftnkludge);
return -1;
}
Syslog('n', "get_rfc_charset(%s) result %d", ftnkludge, i);
return i;
}
/*
* Safe sending to the client with charset translation.
*/