回精華區
作者itoc, 信區: itoc
標題[功能] rec_article.c 轉信的文章加入檔頭 Path
時間03/08/17
作者: itoc (風調雨順,國泰民安) 看板: plan
標題: [功能] 轉信的文章加入檔頭 Message-ID
時間: Tue Jun 24 14:45:31 2003                          Updated: 2005/11/25

  在文章的內文前加入額外的檔頭資料 Path

: global.h
: 看你有幾個檔頭,LINE_HEADER 這數字就寫幾

- #define LINE_HEADER     3               /* more.c bhttpd.c 檔頭有三列 */
+ #define LINE_HEADER     4               /* more.c bhttpd.c 檔頭有三列 */

: rec_article.c:bbspost_add(()

    fprintf(fp, "發信人: %.50s 看板: %s\n", FROM, board);
    fprintf(fp, "標  題: %.70s\n", SUBJECT);
-   fprintf(fp, "發信站: %.27s (%.40s)\n\n", SITE, DATE);
+   fprintf(fp, "發信站: %.27s (%.40s)\n", SITE, DATE);
+   fprintf(fp, "轉信站: %.70s\n", PATH);
+   fprintf(fp, "\n");

: more.c:outs_header()

static int              /* 1:是檔頭 */
outs_header(buf, header_len)
  char *buf;
  int header_len;
{
  static char header1[LINE_HEADER][LEN_AUTHOR1] =
    {"作者",   "標題",   "時間",   "路徑"};
  static char header2[LINE_HEADER][LEN_AUTHOR2] =
    {"發信人", "標  題", "發信站", "轉信站"};

: bhttpd.c:txt2htm()

static void
txt2htm(fp)
  FILE *fp;
{
  int i;
  char buf[ANSILINELEN], encodebuf[LSTRLEN];
  static const char header1[LINE_HEADER][LEN_AUTHOR1] =
    {"作者",   "標題",   "時間",   "路徑"};
  static const char header2[LINE_HEADER][LEN_AUTHOR2] =
    {"發信人", "標  題", "發信站", "轉信站"};
  char *headvalue, *pbrd, board[128];

: rec_article.c:receive_article()

  以下這可做可不做

int                             /* 0:success  -1:fail */
receive_article()
{
  newsfeeds_t *nf;
  char myaddr[128], mynick[128], mysubject[128], myfrom[128], mydate[80];
  char poolx[256];
+ char mypath[128], *pathptr;

  ...
  ...

  str_ncpy(poolx, FROM, 255);
  str_decode(poolx);
  str_ansi(myfrom, poolx, 128);
  FROM = myfrom;

+ str_ncpy(poolx, PATH, 255);
+ str_decode(poolx);
+ str_ansi(mypath, poolx, 128);
+ /* itoc.030115.註解: PATH 如果有 .edu.tw 就截掉 */
+ for (pathptr = mypath; pathptr = strstr(pathptr, ".edu.tw");)
+   strcpy(pathptr, pathptr + 7);
+ mypath[70] = '\0';
+ PATH = mypath;

--
□ 本文章由 itocitoc.Dorm-GD2.NCTU.edu.tw 發表
精華選讀←離開[主題上]主題下(k)上篇(j)下篇S/a搜尋 G串列 TAB精華 ↑↓捲 Pg/Space翻