作者hpo14.bbs@bbs.csie.ntust.edu.tw (雨) 看板: itoc
標題[功能] 搜尋推文分數
時間資工清流站 (2008/08/15 Fri 01:10:42)
搜尋文章推文分數的功能, 快速鍵請自行依需求定義
: post.c:post_cb[] , xpost_cb[]
'L', XoXlocal, /* itoc.010822: 搜尋本地文章 */
+#ifdef HAVE_SCORE
+ 'Z', XoXscore, /* itoc.030530: hpo14.080814: 搜尋推文分數 */
+#endif
: etc/help/post/post.hlp
+ (Z) 搜尋評分文章
: post.c XoXlocal() 後面加入這一整段
#ifdef HAVE_SCORE
/* --------------------------------------------------- */
/* 搜尋 評分 */
/* --------------------------------------------------- */
static int /* 0:不滿足條件 !=0:滿足條件 */
filter_score(head, hdr)
HDR *head; /* 待測物 */
HDR *hdr; /* 條件 */
{
if (!(head->xmode & POST_SCORE))
return 0;
return (hdr->score >= 0) ?
((head->score >= hdr->score) ? 1 : 0) :
((head->score <= hdr->score) ? 1 : 0);
}
int
XoXscore(xo)
XO *xo;
{
HDR hdr;
char score[5];
#ifdef EVERY_Z
if (z_status && xz[XZ_XPOST - XO_ZONE].xo) /* itoc.020308: 不得累積進入二次
*/
{
vmsg(MSG_XYDENY);
return XO_FOOT;
}
#endif
if (!vget(b_lines, 0, "搜尋推文數高於多少 (<0 則搜噓文數) 的文章:",
score, 5, DOECHO))
return XO_FOOT;
hdr.score = atoi(score);
sprintf(HintWord, score > 0 ? "推文數高於 %d" : "噓文數低於 %d", score);
HintAuthor[0] = '\0';
return XoXpost(xo, &hdr, 0, INT_MAX, filter_score);
}
#endif /* HAVE_SCORE */
: maple.p
/* xpost.c */
int XoXlocal(XO *xo);
+ int XoXscore(XO *xo);
--
收回了手 留下的 是自由?是寂寞?
--
>> 台灣科技大學 資工清流站 # bbs.csie.ntust.edu.tw #
>> From: 61-59-78-243.static.seed.net.tw