/******************************************************************* * 顯示佈告相關 TAG (一般區 & 精華區 & 信件 通用) * * *******************************************************************/ void ShowPost(char *tag, BOARDHEADER * board, POST_FILE * pf) { char *p, *para = NULL; int pagesize, start, end; char value[256]; if (request_rec->URLParaType != PostRead && request_rec->URLParaType != TreaRead && request_rec->URLParaType != MailRead && request_rec->URLParaType != SkinModify) { return; } if ((p = strchr(tag, ' ')) != NULL) { *p = '\0'; para = p + 1; } #if 0 fprintf(fp_out, "<%d>, tag=[%s], \n", request_rec->URLParaType, tag); fflush(fp_out); #endif if (!strcasecmp(tag, "Num")) { fprintf(fp_out, "%d", pf->num); } else if (!strcasecmp(tag, "Date")) { fprintf(fp_out, "%s", pf->date); } else if (!strcasecmp(tag, "Sender")) { fprintf(fp_out, "%s", pf->fh.owner); } else if (!strcasecmp(tag, "BackList")) { #ifdef TORNADO_OPTIMIZE if (isTORNADO) return; #endif GetPara3(value, "PAGE", para, 4, "-1"); pagesize = atoi(value); find_list_range(&start, &end, pf->num, pagesize, pf->total_rec); GetPara3(value, "VALUE", para, sizeof(value), MSG_PostBackList); fprintf(fp_out, "<A HREF=\"%d-%d\">%s</A>", start, end, value); } else if (!strcasecmp(tag, "BackListNum")) { GetPara3(value, "PAGE", para, 3, "-1"); pagesize = atoi(value); find_list_range(&start, &end, pf->num, pagesize, pf->total_rec); fprintf(fp_out, "%d-%d", start, end); } else if (!strcasecmp(tag, "Last")) { #if 0 if (isTORNADO) return; #endif GetPara3(value, "VALUE", para, sizeof(value), MSG_PostLast); if (!strcmp(pf->lfname, "-1")) { fprintf(fp_out, "%s", value); } else { if (pf->type & LAST_POST_IS_HTML) fprintf(fp_out, "<A HREF=\"%s/PostHtml.html\" target=\"new\">%s</A>", pf->lfname, value); else fprintf(fp_out, "<A HREF=\"%s.html\">%s</A>", pf->lfname, value); } } else if (!strcasecmp(tag, "Next")) { #if 0 if (isTORNADO) return; #endif GetPara3(value, "VALUE", para, sizeof(value), MSG_PostNext); if (!strcmp(pf->nfname, "-1")) { fprintf(fp_out, "%s", value); } else { if (pf->type & NEXT_POST_IS_HTML) fprintf(fp_out, "<A HREF=\"%s/PostHtml.html\" Target=\"new\">%s</A>", pf->nfname, value); else fprintf(fp_out, "<A HREF=\"%s.html\">%s</A>", pf->nfname, value); } } #ifdef TTT else if (!strcasecmp(tag, "LastRelated")) { GetPara3(value, "VALUE", para, sizeof(value), MSG_PostLastRelated); if (!strcmp(pf->lrfname, "-1")) { fprintf(fp_out, "%s", value); } else { fprintf(fp_out, "<A HREF=\"%s.html\">%s</A>", pf->lrfname, value); } } else if (!strcasecmp(tag, "NextRelated")) { GetPara3(value, "VALUE", para, sizeof(value), MSG_PostNextRelated); if (!strcmp(pf->nrfname, "-1")) { fprintf(fp_out, "%s", value); } else { fprintf(fp_out, "<A HREF=\"%s.html\">%s</A>", pf->nrfname, value); } } #endif else if (!strcasecmp(tag, "Reply")) { #ifdef TORNADO_OPTIMIZE if (isTORNADO) return; #endif GetPara3(value, "VALUE", para, sizeof(value), MSG_PostReply); fprintf(fp_out, "<A HREF=\"%s/%s\">%s</A>", pf->fh.filename, (request_rec->URLParaType == MailRead) ? HTML_MailReply : HTML_PostReply, value); } else if (!strcasecmp(tag, "Send")) { #ifdef TORNADO_OPTIMIZE if (isTORNADO) return; #endif GetPara3(value, "VALUE", para, sizeof(value), MSG_PostSend); fprintf(fp_out, "<A HREF=\"%s\">%s</A>", HTML_PostSend, value); } else if (!strcasecmp(tag, "Edit")) { #ifdef TORNADO_OPTIMIZE if (isTORNADO) return; #endif if (PSCorrect != Correct) return; GetPara3(value, "VALUE", para, sizeof(value), MSG_PostEdit); fprintf(fp_out, "<A HREF=\"%s/%s\">%s</A>", pf->fh.filename, HTML_PostEdit, value); } else if (!strcasecmp(tag, "Forward")) { #ifdef TORNADO_OPTIMIZE if (isTORNADO) return; #endif if (request_rec->URLParaType != MailRead && PSCorrect != Correct) return; GetPara3(value, "VALUE", para, sizeof(value), MSG_PostForward); fprintf(fp_out, "<A HREF=\"%s/%s\">%s</A>", pf->fh.filename, (request_rec->URLParaType == MailRead) ? HTML_MailForward : HTML_PostForward, value); } else if (!strcasecmp(tag, "Delete")) { #ifdef TORNADO_OPTIMIZE if (isTORNADO) return; #endif if (request_rec->URLParaType != MailRead && PSCorrect != Correct) return; GetPara3(value, "VALUE", para, sizeof(value), MSG_PostDelete); fprintf(fp_out, "<A HREF=\"%s/%s\">%s</A>", pf->fh.filename, (request_rec->URLParaType == MailRead) ? HTML_MailDelete : HTML_PostDelete, value); } else if (!strcasecmp(tag, "Content")) { if (request_rec->URLParaType == MailRead && PSCorrect != Correct) return; if (request_rec->URLParaType == SkinModify) ShowArticle(pf->POST_NAME, FALSE, FALSE); else ShowArticle(pf->POST_NAME, FALSE, TRUE); } else if (!strcasecmp(tag, "Title") || !strcasecmp(tag, "Subject")) { #ifdef QP_BASE64_DECODE if (strstr(pf->fh.title, "=?")) /* title maybe encoded */ { char source[STRLEN]; strcpy(source, pf->fh.title); decode_line(pf->fh.title, source); } #endif souts(pf->fh.title, STRLEN); fprintf(fp_out, "%s", pf->fh.title); } else if (!strcasecmp(tag, "ReplyContent")) { if (request_rec->URLParaType == MailRead && PSCorrect != Correct) return; include_ori(pf->POST_NAME, NULL); /* lthuang */ } else if (!strcasecmp(tag, "ReplyTitle") || !strcasecmp(tag, "ReplySubject")) { #ifdef QP_BASE64_DECODE if (strstr(pf->fh.title, "=?")) /* title maybe encoded */ { strcpy(value, pf->fh.title); decode_line(pf->fh.title, value); } #endif souts(pf->fh.title, STRLEN); if (strncmp(pf->fh.title, STR_REPLY, REPLY_LEN)) fprintf(fp_out, "%s", STR_REPLY); fprintf(fp_out, "%s", pf->fh.title); } else if (!strcasecmp(tag, "Body")) { if (request_rec->URLParaType == MailRead && PSCorrect != Correct) return; if (strstr(skin_file->filename, "PostHtml.html") || strstr(skin_file->filename, HTML_PostEdit)) { ShowArticle(pf->POST_NAME, TRUE, FALSE); } else ShowArticle(pf->POST_NAME, TRUE, TRUE); } else if (!strcasecmp(tag, "FileName")) { fprintf(fp_out, "%s", pf->fh.filename); } else if (!strcasecmp(tag, "LastFileName")) { fprintf(fp_out, "%s.html", pf->lfname); } else if (!strcasecmp(tag, "NextFileName")) { fprintf(fp_out, "%s.html", pf->nfname); } }
static int ListPostRecord(char *tag, BOARDHEADER * board, POST_FILE * pf, char *format, int start, int end) { FORMAT_ARRAY format_array[32]; #ifdef USE_MMAP FILEHEADER *fip; #endif int recidx, fd; FILEHEADER fileinfo; BOOL hasUpperDir = FALSE; char senderid[STRLEN], sender[STRLEN], date[STRLEN]; char title[STRLEN + PATHLEN + 1]; char UpperDir[PATHLEN]; char *p; char *type; char *tags[6] = {"Num", "Sender", "Date", "Title", "SenderID", "READ"}; char *strings[6]; char recidx_string[10]; if (request_rec->URLParaType == MailList && PSCorrect != Correct) return FALSE; if (pf->total_rec <= 0) return TRUE; if (strlen(format) == 0) return FALSE; #if 11 fprintf(fp_out, "\r\ntest[%s]!!<br>\r\n", pf->POST_NAME); #endif /* set pf->POST_NAME to current dir */ if ((p = strrchr(pf->POST_NAME, '/')) == NULL) return FALSE; /* invalid format */ *p = '\0'; if ((fd = open(pf->POST_NAME, O_RDONLY)) < 0) { return FALSE; } /* check if treasure has upper dir */ if (request_rec->URLParaType == TreaList) { xstrncpy(UpperDir, pf->POST_NAME, sizeof(UpperDir)); if ((p = strrchr(UpperDir, '/')) != NULL) *p = '\0'; if ((p = strrchr(UpperDir + 9, '/')) != NULL) /* find sub dir */ { *p = '\0'; hasUpperDir = TRUE; } else hasUpperDir = FALSE; } #if 11 fprintf(fp_out, "Start=%d, End=%d, B_totla=%d", start, end, pf->total_rec); fflush(fp_out); #endif #ifdef USE_MMAP fip = (FILEHEADER *) mmap((caddr_t) 0, (size_t) (pf->total_rec * FH_SIZE), PROT_READ, MAP_SHARED, fd, (off_t) 0); if (fip == MAP_FAILED) { close(fd); #if 11 fprintf(fp_out, "\r\ntest2!![%d]<br>\r\n", errno); #endif return FALSE; } close(fd); #else if (lseek(fd, (long) (FH_SIZE * (start - 1)), SEEK_SET) == -1) { close(fd); return FALSE; } #endif #if 11 fprintf(fp_out, "\r\ntest3!!<br>\r\n"); #endif bzero(format_array, sizeof(format_array)); if (build_format_array(format_array, format, "%", "%", 32) == -1) { #if 11 fprintf(fp_out, "\r\ntest4!!<br>\r\n"); #endif return FALSE; } #if 11 { int i; for (i = 0; format_array[i].type; i++) fprintf(fp_out, "<%d:[%c,%d]>\r\n", i, format_array[i].type, format_array[i].offset); fflush(fp_out); } #endif for (recidx = start; recidx <= end; recidx++) { int i; if (fileinfo.accessed & FILE_REPD) type = "r"; else if (fileinfo.accessed & FILE_READ) type = "-"; else type = "N"; if (hasUpperDir) { strcpy(sender, MSG_TreaDir); strcpy(senderid, MSG_TreaDir); sprintf(title, "<A HREF=\"/%s%s/\">%s</A> ", BBS_SUBDIR, UpperDir, MSG_TreaUpperDir); /* add space at last prevent html tag error */ strcpy(date, "--/--/--"); hasUpperDir = FALSE; recidx = start - 1; } else { time_t fdate; #ifdef USE_MMAP memcpy(&fileinfo, fip + recidx - 1, FH_SIZE); #else if (read(fd, &fileinfo, FH_SIZE) != FH_SIZE) break; #endif /* check FILEHEADER data overflow */ if (invalid_fileheader(&fileinfo)) { strcpy(sender, "unknow"); strcpy(senderid, "unknow"); strcpy(title, "<< Invalid Entry >> "); /* add space at last prevent html tag error */ } else if (fileinfo.accessed & FILE_TREA) /* file is treasure dir */ { if (request_rec->URLParaType == TreaList) { strcpy(sender, MSG_TreaDir); /* transform special chars to html code */ souts(fileinfo.title, sizeof(fileinfo.title)); sprintf(title, "<A HREF=\"/%s%s/%s/\">%s </A> ", BBS_SUBDIR, pf->POST_NAME, fileinfo.filename, fileinfo.title); /* add space at last prevent html tag error */ } else { strcpy(sender, "unknow"); strcpy(title, "<< Invalid Entry >> "); /* add space at last prevent html tag error */ } } else /* file is post */ { #ifdef QP_BASE64_DECODE if (strstr(fileinfo.owner, "=?")) /* maybe encoded */ { char source[STRLEN]; xstrncpy(source, fileinfo.owner, STRLEN); decode_line(fileinfo.owner, source); } #endif if (*fileinfo.owner == '#') /* outsite post */ { strtok(fileinfo.owner, ".@"); sprintf(sender, " %.12s", fileinfo.owner); } else if (request_rec->URLParaType == MailList && strchr(fileinfo.owner, '@') != NULL) /* outsit email */ { strtok(fileinfo.owner, ".@"); sprintf(sender, " #%.12s", fileinfo.owner); } else { #ifdef USE_IDENT sprintf(sender, "%s<A HREF=\"/%susers/%.12s\">%.12s</A>", fileinfo.ident == 7 ? MSG_IdentMark : " ", BBS_SUBDIR, fileinfo.owner, fileinfo.owner); #else sprintf(sender, "<A HREF=\"/%susers/%s\">%s</A>", BBS_SUBDIR, fileinfo.owner, fileinfo.owner); #endif xstrncpy(senderid, fileinfo.owner, sizeof(senderid)); } if ((fileinfo.accessed & FILE_DELE)) sprintf(title, "<<本篇已被 %s 刪除>> ", fileinfo.delby); /* add space at last prevent html tag error */ else { #ifdef QP_BASE64_DECODE if (strstr(fileinfo.title, "=?")) /* maybe encoded */ { char source[STRLEN * 2]; strcpy(source, fileinfo.title); decode_line(fileinfo.title, source); } #endif if (strlen(fileinfo.title) > 40) /* title too long */ { fileinfo.title[39] = '\0'; fileinfo.title[40] = '\0'; strcat(fileinfo.title, "....."); } /* transform special chars to html code */ souts(fileinfo.title, sizeof(fileinfo.title)); if (fileinfo.accessed & FILE_HTML) sprintf(title, "<A HREF=\"/%s%s/%s/PostHtml.html\" Target=\"new\">%s </A> ", BBS_SUBDIR, request_rec->URLParaType == MailList ? "mail" : pf->POST_NAME, fileinfo.filename, fileinfo.title); /* add space at last prevent html tag error */ else sprintf(title, "<A HREF=\"/%s%s/%s.html\">%s </A> ", BBS_SUBDIR, request_rec->URLParaType == MailList ? "mail" : pf->POST_NAME, fileinfo.filename, fileinfo.title); /* add space at last prevent html tag error */ } } if ((fdate = (time_t) atol((fileinfo.filename) + 2)) == 0) strcpy(date, "unknow"); else mk_timestr1(date, (time_t) fdate); } /* output data according to format */ sprintf(recidx_string, "%d", recidx); strings[0] = recidx_string; strings[1] = sender; strings[2] = date; strings[3] = title; strings[4] = senderid; strings[5] = type; /* used in MailList */ for (i = 0; format_array[i].type; i++) { int offset1 = format_array[i].offset; int offset2 = format_array[i+1].offset; if (format_array[i].type == 'S') /* not BBS TAG */ { fwrite(&(format[offset1]), sizeof(char), offset2 - offset1, fp_out); } else { int j; /* BBS TAG */ for (j = 0; j < 6; j++) { if (!strncasecmp(&(format[offset1 + 1]), tags[j], offset2 - offset1 - 2)) { fprintf(fp_out, "%s", strings[j]); break; } } } } fprintf(fp_out, "\r\n"); } #ifdef USE_MMAP munmap((void *) fip, pf->total_rec * FH_SIZE); #else close(fd); #endif return TRUE; }
int ShowArticle(char *filename, BOOL body_only, BOOL process) { /* body only .. */ FILE *fp; char *p, *data; BOOL inHeader = TRUE; #ifdef PARSE_ANSI char *HTMLColor[] = { "000000", "8f0000", "008f00", "8f8f00", "00008f", "8f008f", "008f8f", "cfcfcf", /* HiColor */ "8f8f8f", "ff0000", "00ff00", "ffff00", "0000ff", "ff00ff", "00ffff", "ffffff" }; char *BgColor[] = {"000000", "a00000", "00a000", "a0a000", "0000a0", "a000a0", "00a0a0", "cfcfcf"}; int font_fg_color, font_bg_color; BOOL font_hilight, font_blink; static char ANSI[] = "\033["; /* lthuang */ char FontStr[STRLEN]; #endif #ifdef PARSE_HYPERLINK HYPER_LINK hlink[] = { /* format: hyperlink keyword, keyword length, hyperlink legal character , open target */ {"http", 4, "./:~?'=-_!&#%*+@\\", " TARGET=\"new\""}, {"ftp", 3, "./:@-_&%", " TARGET=\"new\""}, {"news", 4, "./:", "\0"}, {"telnet", 6, ".:", "\0"}, {"gopher", 6, ".:/", "\0"} }; #endif char pbuf[2048], buffer[2028]; #ifdef PARSE_ANSI int color_set_count = 0, reset_ansi = FALSE; font_fg_color = font_bg_color = 0; font_hilight = font_blink = FALSE; #endif if ((fp = fopen(filename, "r")) == NULL) return FALSE; if (!process && !body_only) { if (strstr(skin_file->filename, HTML_SkinModify)) { while (fgets(pbuf, sizeof(pbuf), fp)) { if ((p = strchr(pbuf, '\n')) != NULL) *p = '\0'; data = pbuf; /* find </TEXTAREA> */ if ((p = strstr(data, "</")) != NULL && !strncasecmp(p + 2, "TEXTAREA>", 9)) { *p = '\0'; fprintf(fp_out, "%s</TEXT-AREA>", data); data = p + 11; /* strlen("</TEXTAREA>") */ } else fprintf(fp_out, "%s\n", data); } } else { int size; while ((size = fread(pbuf, 1, sizeof(pbuf), fp)) != 0) fwrite(pbuf, 1, size, fp_out); } fclose(fp); return TRUE; } if (request_rec->URLParaType != PostRead && request_rec->URLParaType != TreaRead && request_rec->URLParaType != MailRead) inHeader = FALSE; while (fgets(pbuf, sizeof(pbuf), fp)) { if ((p = strchr(pbuf, '\n')) != NULL) *p = '\0'; buffer[0] = '\0'; data = pbuf; if (inHeader && *data == '\0') { inHeader = FALSE; fprintf(fp_out, "\r\n"); continue; } if (body_only) /* skip article header and footer */ { if (inHeader) continue; #if 0 /* break if find "--\r\n" when PostRead (signature below --) TreaRead and MailRead should continue */ if (request_rec->URLParaType == PostRead && !strcmp(data, "--")) break; #endif if (!process) { if (!strcmp(data, "--")) { break; } else { fprintf(fp_out, "%s\n", data); continue; } } } if (inHeader) { souts(data, sizeof(pbuf)); } #ifdef QP_BASE64_DECODE if ((p = strstr(data, "=?")) != NULL) /* content maybe encoded */ { decode_line(buffer, data); xstrncpy(data, buffer, sizeof(pbuf)); buffer[0] = '\0'; } #endif #ifdef PARSE_ANSI /* search article content for ANSI CODE and convert to HTML code */ while ((p = strstr(data, ANSI)) != NULL) { int i; char ansi_code[32]; int color; int end = FALSE, skip = FALSE, set_fg_color = FALSE, set_bg_color = FALSE, had_set_bg_color = FALSE; char *ansi_str = ansi_code; #if 0 fprintf(fp_out, "<!--DATA=%s-->\n", data); fflush(fp_out); #endif *p = '\0'; p += 2; xstrcat(buffer, data, sizeof(buffer)); for (i = 0; i < sizeof(ansi_code); i++) if (*(p + i) == 'm') break; if (i >= sizeof(ansi_code)) { fprintf(fp_out, "\r\n<!--BBS ANSI CODE FORMAT ERROR-->\r\n"); data += 2; continue; } xstrncpy(ansi_str, p, i + 1); #if 0 { char buffer1[STRLEN]; sprintf(buffer1, "<!--ANSI=%s LEN=%d-->", ansi_code, strlen(ansi_code)); xstrcat(buffer, buffer1, sizeof(buffer)); } #endif data = p + i + 1; if (i == 0 /* case: \033[m */ || (i == 1 && *(p)=='0')) /* case: \033[0m */ { #if 0 set_bg_color = FALSE; #endif font_fg_color = 7; font_bg_color = 0; font_hilight = FALSE; reset_ansi = TRUE; } /* parse ansi control code */ while (*ansi_str) { if ((p = strchr(ansi_str, ';')) != NULL) *p = 0x00; else end = TRUE; color = atoi(ansi_str); #if 0 { char buffer1[STRLEN]; sprintf(buffer1, "<!--token=%d-->", color); xstrcat(buffer, buffer1, sizeof(buffer)); } #endif /* 1: hi light, 5: blink, 7: reverse */ if (color == 0) { font_fg_color = 7; font_bg_color = 0; font_hilight = FALSE; reset_ansi = TRUE; #if 0 set_bg_color = FALSE; #endif } else if (color == 1) { if(font_hilight==FALSE) { font_hilight = TRUE; set_fg_color = TRUE; } } else if (color == 5) { } else if (color == 7) { } else if (color >= 30 && color <= 37) /* set fg color */ { if(font_fg_color != color - 30) { set_fg_color = TRUE; font_fg_color = color - 30; } } else if(color >= 40 && color <= 47) /* set bg color */ { if(font_bg_color != color - 40) { set_bg_color = TRUE; font_bg_color = color - 40; } } else skip = TRUE; if (end == FALSE) ansi_str = p + 1; else break; } if (skip == FALSE) { /* reset_ansi should return all </font> and set new font attrib (if any) */ if(reset_ansi == TRUE) { while(color_set_count>0) { xstrcat(buffer, "</FONT>", sizeof(buffer)); color_set_count--; } reset_ansi = FALSE; #if 0 continue; #endif } if(set_bg_color == TRUE) { sprintf(FontStr, "<FONT COLOR=\"#%s\" STYLE=\"Background-Color:#%s\">", HTMLColor[font_fg_color + (font_hilight == TRUE ? 8 : 0)], BgColor[font_bg_color]); had_set_bg_color = TRUE; } else if(set_fg_color == TRUE) { if(had_set_bg_color == TRUE) { /* reset bg-color style */ sprintf(FontStr, "<FONT COLOR=\"#%s\" STYLE=\"\">", HTMLColor[font_fg_color + (font_hilight == TRUE ? 8 : 0)]); had_set_bg_color = FALSE; } else { sprintf(FontStr, "<FONT COLOR=\"#%s\">", HTMLColor[font_fg_color + (font_hilight == TRUE ? 8 : 0)]); } set_fg_color = FALSE; } else { continue; } xstrcat(buffer, FontStr, sizeof(buffer)); color_set_count++; } } xstrcat(buffer, data, sizeof(buffer)); xstrncpy(pbuf, buffer, sizeof(pbuf)); data = pbuf; buffer[0] = '\0'; #endif /* PARSE_ANSI */ #ifdef PARSE_HYPERLINK #if 0 printf("\n["); for (i = 0; i < strlen(data) + 10; i++) printf("%d,", data[i]); printf("]\n"); #endif while ((p = strstr(data, "://")) != NULL) { int type; for (type = 0; type < HyperLinkType; type++) if (!strncasecmp(p - (hlink[type].len), hlink[type].type, hlink[type].len)) break; /* exam article content for hyperlink */ if (type < HyperLinkType) { p -= hlink[type].len; /* ignore '<a href' HTML Tag ie: <a href="http://www.nsysu.edu.tw"> www homepage</a> ie: <a href=http://www.nsysu.edu.tw> www homepage</a> ignore '<img src' HTML Tag ie: <img src="http://www.nsysu.edu.tw/title.jpg"> ie: <img src=http://www.nsysu.edu.tw/title.jpg> ignore '<body background' HTML Tag ie: <body background="http://www.wow.org.tw/show/m-9.jpg" ignore 'URL' HTML Tag */ if (!strncasecmp((p - 5), "href", 4) || !strncasecmp((p - 6), "href", 4) || !strncasecmp((p - 4), "src", 3) || !strncasecmp((p - 5), "src", 3) || !strncasecmp((p - 11), "background", 10) || !strncasecmp((p - 12), "background", 10) || !strncasecmp((p - 4), "URL=", 4)) { *(p + hlink[type].len + 2) = '\0'; fprintf(fp_out, "%s/", data); data = p + hlink[type].len + 3; } else { /* now, converting... */ char url[HTTP_REQUEST_LINE_BUF]; int i = hlink[type].len + 3; /* 3=strlen("://") */ while (((*(p + i) > 0x00) && ((isalnum((int) *(p + i)) || (strchr(hlink[type].allow, (int) *(p + i)) != NULL))))) { #if 0 printf("{%d}", *(p + i)); #endif i++; } if (i > hlink[type].len + 3 && i < sizeof(url)) { xstrncpy(url, p, i + 1); #if 0 printf("[*p=%c,*(p+%d)=%d]", *p, i, *(p + i)); #endif *p = '\0'; fprintf(fp_out, "%s<A HREF=\"%s\"%s>%s</A>", data, url, hlink[type].target, url); } data = p + i; #if 0 printf("[data5=%d, %d, %d, %d, %d, %d, %d]\n", *(data - 4), *(data - 3), *(data - 2), *(data - 1), *data, *(data + 1), *(data + 2)); #endif } } else { *p = '\0'; fprintf(fp_out, "%s://", data); data = p + 3; } } #endif /* PARSE_HYPERLINK */ fprintf(fp_out, "%s\n", data); } while(color_set_count>0) { xstrcat(buffer, "</FONT>", sizeof(buffer)); color_set_count--; } fclose(fp); return TRUE; }