Lines 940-946
Link Here
|
940 |
} |
940 |
} |
941 |
} |
941 |
} |
942 |
|
942 |
|
943 |
#ifdef SH_EX /* for MIME */ |
|
|
944 |
#ifdef NEWS_DEBUG |
943 |
#ifdef NEWS_DEBUG |
945 |
/* for DEBUG 1997/11/07 (Fri) 17:20:16 */ |
944 |
/* for DEBUG 1997/11/07 (Fri) 17:20:16 */ |
946 |
void debug_print(unsigned char *p) |
945 |
void debug_print(unsigned char *p) |
Lines 962-1005
Link Here
|
962 |
} |
961 |
} |
963 |
#endif |
962 |
#endif |
964 |
|
963 |
|
965 |
static char *decode_mime(char *str) |
964 |
static char *decode_mime(char **str) |
966 |
{ |
965 |
{ |
967 |
char temp[LINE_LENGTH]; /* FIXME: what determines the actual size? */ |
966 |
#ifdef SH_LEX |
968 |
char *p, *q; |
|
|
969 |
|
970 |
if (str == NULL) |
971 |
return ""; |
972 |
|
973 |
if (HTCJK != JAPANESE) |
967 |
if (HTCJK != JAPANESE) |
974 |
return str; |
968 |
return *str; |
975 |
|
|
|
976 |
LYstrncpy(temp, str, sizeof(temp) - 1); |
977 |
q = temp; |
978 |
while ((p = strchr(q, '=')) != 0) { |
979 |
if (p[1] == '?') { |
980 |
HTmmdecode(p, p); |
981 |
q = p + 2; |
982 |
} else { |
983 |
q = p + 1; |
984 |
} |
985 |
} |
986 |
#ifdef NEWS_DEBUG |
987 |
printf("new=["); |
988 |
debug_print(temp); |
989 |
#endif |
969 |
#endif |
990 |
HTrjis(temp, temp); |
970 |
HTmmdecode(str, *str); |
991 |
strcpy(str, temp); |
971 |
return HTrjis(str, *str) ? *str : ""; |
992 |
|
|
|
993 |
return str; |
994 |
} |
972 |
} |
995 |
#else /* !SH_EX */ |
|
|
996 |
static char *decode_mime ARGS1(char *, str) |
997 |
{ |
998 |
HTmmdecode(str, str); |
999 |
HTrjis(str, str); |
1000 |
return str; |
1001 |
} |
1002 |
#endif |
1003 |
|
973 |
|
1004 |
|
974 |
|
1005 |
/* Read in an Article read_article |
975 |
/* Read in an Article read_article |
Lines 1087-1108
Link Here
|
1087 |
|
1057 |
|
1088 |
} else if (match(full_line, "SUBJECT:")) { |
1058 |
} else if (match(full_line, "SUBJECT:")) { |
1089 |
StrAllocCopy(subject, HTStrip(strchr(full_line,':')+1)); |
1059 |
StrAllocCopy(subject, HTStrip(strchr(full_line,':')+1)); |
1090 |
decode_mime(subject); |
1060 |
decode_mime(&subject); |
1091 |
} else if (match(full_line, "DATE:")) { |
1061 |
} else if (match(full_line, "DATE:")) { |
1092 |
StrAllocCopy(date, HTStrip(strchr(full_line,':')+1)); |
1062 |
StrAllocCopy(date, HTStrip(strchr(full_line,':')+1)); |
1093 |
|
1063 |
|
1094 |
} else if (match(full_line, "ORGANIZATION:")) { |
1064 |
} else if (match(full_line, "ORGANIZATION:")) { |
1095 |
StrAllocCopy(organization, |
1065 |
StrAllocCopy(organization, |
1096 |
HTStrip(strchr(full_line,':')+1)); |
1066 |
HTStrip(strchr(full_line,':')+1)); |
1097 |
decode_mime(organization); |
1067 |
decode_mime(&organization); |
1098 |
|
1068 |
|
1099 |
} else if (match(full_line, "FROM:")) { |
1069 |
} else if (match(full_line, "FROM:")) { |
1100 |
StrAllocCopy(from, HTStrip(strchr(full_line,':')+1)); |
1070 |
StrAllocCopy(from, HTStrip(strchr(full_line,':')+1)); |
1101 |
decode_mime(from); |
1071 |
decode_mime(&from); |
1102 |
|
1072 |
|
1103 |
} else if (match(full_line, "REPLY-TO:")) { |
1073 |
} else if (match(full_line, "REPLY-TO:")) { |
1104 |
StrAllocCopy(replyto, HTStrip(strchr(full_line,':')+1)); |
1074 |
StrAllocCopy(replyto, HTStrip(strchr(full_line,':')+1)); |
1105 |
decode_mime(replyto); |
1075 |
decode_mime(&replyto); |
1106 |
|
1076 |
|
1107 |
} else if (match(full_line, "NEWSGROUPS:")) { |
1077 |
} else if (match(full_line, "NEWSGROUPS:")) { |
1108 |
StrAllocCopy(newsgroups, HTStrip(strchr(full_line,':')+1)); |
1078 |
StrAllocCopy(newsgroups, HTStrip(strchr(full_line,':')+1)); |
Lines 1711-1718
Link Here
|
1711 |
int, last_required) |
1681 |
int, last_required) |
1712 |
{ |
1682 |
{ |
1713 |
char line[LINE_LENGTH+1]; |
1683 |
char line[LINE_LENGTH+1]; |
1714 |
char author[LINE_LENGTH+1]; |
1684 |
char *author = NULL; |
1715 |
char subject[LINE_LENGTH+1]; |
1685 |
char *subject = NULL; |
1716 |
char *date = NULL; |
1686 |
char *date = NULL; |
1717 |
int i; |
1687 |
int i; |
1718 |
char *p; |
1688 |
char *p; |
Lines 1723-1731
Link Here
|
1723 |
char *reference = NULL; /* Href for article */ |
1693 |
char *reference = NULL; /* Href for article */ |
1724 |
int art; /* Article number WITHIN GROUP */ |
1694 |
int art; /* Article number WITHIN GROUP */ |
1725 |
int status, count, first, last; /* Response fields */ |
1695 |
int status, count, first, last; /* Response fields */ |
1726 |
/* count is only an upper limit */ |
|
|
1727 |
|
1696 |
|
1728 |
author[0] = '\0'; |
|
|
1729 |
START(HTML_HEAD); |
1697 |
START(HTML_HEAD); |
1730 |
PUTC('\n'); |
1698 |
PUTC('\n'); |
1731 |
START(HTML_TITLE); |
1699 |
START(HTML_TITLE); |
Lines 1946-1953
Link Here
|
1946 |
case 'S': |
1914 |
case 'S': |
1947 |
case 's': |
1915 |
case 's': |
1948 |
if (match(line, "SUBJECT:")) { |
1916 |
if (match(line, "SUBJECT:")) { |
1949 |
LYstrncpy(subject, line+9, sizeof(subject)-1);/* Save subject */ |
1917 |
StrAllocCopy(subject, line + 9); |
1950 |
decode_mime(subject); |
1918 |
decode_mime(&subject); |
1951 |
} |
1919 |
} |
1952 |
break; |
1920 |
break; |
1953 |
|
1921 |
|
Lines 1964-1973
Link Here
|
1964 |
case 'F': |
1932 |
case 'F': |
1965 |
if (match(line, "FROM:")) { |
1933 |
if (match(line, "FROM:")) { |
1966 |
char * p2; |
1934 |
char * p2; |
1967 |
LYstrncpy(author, |
1935 |
StrAllocCopy(author, strchr(line, ':') + 1); |
1968 |
author_name(strchr(line,':')+1), |
1936 |
decode_mime(&author); |
1969 |
sizeof(author)-1); |
|
|
1970 |
decode_mime(author); |
1971 |
p2 = author + strlen(author) - 1; |
1937 |
p2 = author + strlen(author) - 1; |
1972 |
if (*p2==LF) |
1938 |
if (*p2==LF) |
1973 |
*p2 = '\0'; /* Chop off newline */ |
1939 |
*p2 = '\0'; /* Chop off newline */ |
Lines 1988-1998
Link Here
|
1988 |
|
1954 |
|
1989 |
PUTC('\n'); |
1955 |
PUTC('\n'); |
1990 |
START(HTML_LI); |
1956 |
START(HTML_LI); |
1991 |
#ifdef SH_EX /* for MIME */ |
1957 |
p = decode_mime(&subject); |
1992 |
HTSprintf0(&temp, "\"%s\"", decode_mime(subject)); |
1958 |
HTSprintf0(&temp, "\"%s\"", NonNull(p)); |
1993 |
#else |
|
|
1994 |
HTSprintf0(&temp, "\"%s\"", subject); |
1995 |
#endif |
1996 |
if (reference) { |
1959 |
if (reference) { |
1997 |
write_anchor(temp, reference); |
1960 |
write_anchor(temp, reference); |
1998 |
FREE(reference); |
1961 |
FREE(reference); |
Lines 2001-2018
Link Here
|
2001 |
} |
1964 |
} |
2002 |
FREE(temp); |
1965 |
FREE(temp); |
2003 |
|
1966 |
|
2004 |
if (author[0] != '\0') { |
1967 |
if (author != NULL) { |
2005 |
PUTS(" - "); |
1968 |
PUTS(" - "); |
2006 |
if (LYListNewsDates) |
1969 |
if (LYListNewsDates) |
2007 |
START(HTML_I); |
1970 |
START(HTML_I); |
2008 |
#ifdef SH_EX /* for MIME */ |
1971 |
PUTS(decode_mime(&author)); |
2009 |
PUTS(decode_mime(author)); |
|
|
2010 |
#else |
2011 |
PUTS(author); |
2012 |
#endif |
2013 |
if (LYListNewsDates) |
1972 |
if (LYListNewsDates) |
2014 |
END(HTML_I); |
1973 |
END(HTML_I); |
2015 |
author[0] = '\0'; |
1974 |
FREE(author); |
2016 |
} |
1975 |
} |
2017 |
if (date) { |
1976 |
if (date) { |
2018 |
if (!diagnostic) { |
1977 |
if (!diagnostic) { |
Lines 2055-2060
Link Here
|
2055 |
MAYBE_END(HTML_LI); |
2014 |
MAYBE_END(HTML_LI); |
2056 |
} /* Handle response to HEAD request */ |
2015 |
} /* Handle response to HEAD request */ |
2057 |
} /* Loop over article */ |
2016 |
} /* Loop over article */ |
|
|
2017 |
FREE(author); |
2018 |
FREE(subject); |
2058 |
} /* If read headers */ |
2019 |
} /* If read headers */ |
2059 |
PUTC('\n'); |
2020 |
PUTC('\n'); |
2060 |
if (LYListNewsNumbers) |
2021 |
if (LYListNewsNumbers) |