|
|
} | } |
} | } |
| |
#ifdef SH_EX /* for MIME */ |
|
#ifdef NEWS_DEBUG | #ifdef NEWS_DEBUG |
/* for DEBUG 1997/11/07 (Fri) 17:20:16 */ | /* for DEBUG 1997/11/07 (Fri) 17:20:16 */ |
void debug_print(unsigned char *p) | void debug_print(unsigned char *p) |
|
|
} | } |
#endif | #endif |
| |
static char *decode_mime(char *str) |
static char *decode_mime(char **str) |
{ | { |
char temp[LINE_LENGTH]; /* FIXME: what determines the actual size? */ |
#ifdef SH_EX |
char *p, *q; |
|
|
|
if (str == NULL) |
|
return ""; |
|
|
|
if (HTCJK != JAPANESE) | if (HTCJK != JAPANESE) |
return str; |
return *str; |
|
|
LYstrncpy(temp, str, sizeof(temp) - 1); |
|
q = temp; |
|
while ((p = strchr(q, '=')) != 0) { |
|
if (p[1] == '?') { |
|
HTmmdecode(p, p); |
|
q = p + 2; |
|
} else { |
|
q = p + 1; |
|
} |
|
} |
|
#ifdef NEWS_DEBUG |
|
printf("new=["); |
|
debug_print(temp); |
|
#endif | #endif |
HTrjis(temp, temp); |
HTmmdecode(str, *str); |
strcpy(str, temp); |
return HTrjis(str, *str) ? *str : ""; |
|
|
return str; |
|
} | } |
#else /* !SH_EX */ |
|
static char *decode_mime ARGS1(char *, str) |
|
{ |
|
HTmmdecode(str, str); |
|
HTrjis(str, str); |
|
return str; |
|
} |
|
#endif |
|
|
|
| |
/* Read in an Article read_article | /* Read in an Article read_article |
** ------------------ | ** ------------------ |
|
|
| |
} else if (match(full_line, "SUBJECT:")) { | } else if (match(full_line, "SUBJECT:")) { |
StrAllocCopy(subject, HTStrip(strchr(full_line,':')+1)); | StrAllocCopy(subject, HTStrip(strchr(full_line,':')+1)); |
decode_mime(subject); |
decode_mime(&subject); |
} else if (match(full_line, "DATE:")) { | } else if (match(full_line, "DATE:")) { |
StrAllocCopy(date, HTStrip(strchr(full_line,':')+1)); | StrAllocCopy(date, HTStrip(strchr(full_line,':')+1)); |
| |
} else if (match(full_line, "ORGANIZATION:")) { | } else if (match(full_line, "ORGANIZATION:")) { |
StrAllocCopy(organization, | StrAllocCopy(organization, |
HTStrip(strchr(full_line,':')+1)); | HTStrip(strchr(full_line,':')+1)); |
decode_mime(organization); |
decode_mime(&organization); |
| |
} else if (match(full_line, "FROM:")) { | } else if (match(full_line, "FROM:")) { |
StrAllocCopy(from, HTStrip(strchr(full_line,':')+1)); | StrAllocCopy(from, HTStrip(strchr(full_line,':')+1)); |
decode_mime(from); |
decode_mime(&from); |
| |
} else if (match(full_line, "REPLY-TO:")) { | } else if (match(full_line, "REPLY-TO:")) { |
StrAllocCopy(replyto, HTStrip(strchr(full_line,':')+1)); | StrAllocCopy(replyto, HTStrip(strchr(full_line,':')+1)); |
decode_mime(replyto); |
decode_mime(&replyto); |
| |
} else if (match(full_line, "NEWSGROUPS:")) { | } else if (match(full_line, "NEWSGROUPS:")) { |
StrAllocCopy(newsgroups, HTStrip(strchr(full_line,':')+1)); | StrAllocCopy(newsgroups, HTStrip(strchr(full_line,':')+1)); |
|
|
int, last_required) | int, last_required) |
{ | { |
char line[LINE_LENGTH+1]; | char line[LINE_LENGTH+1]; |
char author[LINE_LENGTH+1]; |
char *author = NULL; |
char subject[LINE_LENGTH+1]; |
char *subject = NULL; |
char *date = NULL; | char *date = NULL; |
int i; | int i; |
char *p; | char *p; |
|
|
int status, count, first, last; /* Response fields */ | int status, count, first, last; /* Response fields */ |
/* count is only an upper limit */ | /* count is only an upper limit */ |
| |
author[0] = '\0'; |
|
START(HTML_HEAD); | START(HTML_HEAD); |
PUTC('\n'); | PUTC('\n'); |
START(HTML_TITLE); | START(HTML_TITLE); |
|
|
case 'S': | case 'S': |
case 's': | case 's': |
if (match(line, "SUBJECT:")) { | if (match(line, "SUBJECT:")) { |
LYstrncpy(subject, line+9, sizeof(subject)-1);/* Save subject */ |
StrAllocCopy(subject, line + 9); |
decode_mime(subject); |
decode_mime(&subject); |
} | } |
break; | break; |
| |
|
|
case 'F': | case 'F': |
if (match(line, "FROM:")) { | if (match(line, "FROM:")) { |
char * p2; | char * p2; |
LYstrncpy(author, |
StrAllocCopy(author, strchr(line, ':') + 1); |
author_name(strchr(line,':')+1), |
decode_mime(&author); |
sizeof(author)-1); |
|
decode_mime(author); |
|
p2 = author + strlen(author) - 1; | p2 = author + strlen(author) - 1; |
if (*p2==LF) | if (*p2==LF) |
*p2 = '\0'; /* Chop off newline */ | *p2 = '\0'; /* Chop off newline */ |
|
|
| |
PUTC('\n'); | PUTC('\n'); |
START(HTML_LI); | START(HTML_LI); |
#ifdef SH_EX /* for MIME */ |
p = decode_mime(&subject); |
HTSprintf0(&temp, "\"%s\"", decode_mime(subject)); |
HTSprintf0(&temp, "\"%s\"", NonNull(p)); |
#else |
|
HTSprintf0(&temp, "\"%s\"", subject); |
|
#endif |
|
if (reference) { | if (reference) { |
write_anchor(temp, reference); | write_anchor(temp, reference); |
FREE(reference); | FREE(reference); |
|
|
} | } |
FREE(temp); | FREE(temp); |
| |
if (author[0] != '\0') { |
if (author != NULL) { |
PUTS(" - "); | PUTS(" - "); |
if (LYListNewsDates) | if (LYListNewsDates) |
START(HTML_I); | START(HTML_I); |
#ifdef SH_EX /* for MIME */ |
PUTS(decode_mime(&author)); |
PUTS(decode_mime(author)); |
|
#else |
|
PUTS(author); |
|
#endif |
|
if (LYListNewsDates) | if (LYListNewsDates) |
END(HTML_I); | END(HTML_I); |
author[0] = '\0'; |
FREE(author); |
} | } |
if (date) { | if (date) { |
if (!diagnostic) { | if (!diagnostic) { |
|
|
MAYBE_END(HTML_LI); | MAYBE_END(HTML_LI); |
} /* Handle response to HEAD request */ | } /* Handle response to HEAD request */ |
} /* Loop over article */ | } /* Loop over article */ |
|
FREE(author); |
|
FREE(subject); |
} /* If read headers */ | } /* If read headers */ |
PUTC('\n'); | PUTC('\n'); |
if (LYListNewsNumbers) | if (LYListNewsNumbers) |