作者itoc.bbs@processor.tfcis.org (核心動力) 看板: plan
標題Re: 想要一個程式...
時間動力核心 (2004/10/06 Wed 23:24:46) Updated: 2005/06/12
※ 引述《Frank.bbs@cpp.twbbs.org (貝貝)》之銘言:
> check 如果 .BRD 裡有任何一個看板,沒有出現在 newsfeeds.bbs 中
: src/util/Makefile 加入 check_newsfeeds
EXE = account acl-sort bbsmail check_newsfeeds ...
: src/util/check_newsfeeds.c 新增程式如下
/*-------------------------------------------------------*/
/* util/check_newsfeeds.c ( NTHU CS MapleBBS Ver 3.10 ) */
/*-------------------------------------------------------*/
/* target : 檢查 newsfeeds.bbs 是否有不轉信的看板 */
/* create : 04/10/06 */
/* update : / / */
/* author : itoc.bbs@bbs.tnfsh.tn.edu.tw */
/*-------------------------------------------------------*/
#include "bbs.h"
static int /* 1: brdname 在 newsfeeds.bbs 內 */
in_newsfeeds(brdname)
char *brdname;
{
newsfeeds_t nf;
int fd;
int rc = 0;
if ((fd = open("innd/newsfeeds.bbs", O_RDONLY)) >= 0)
{
while (read(fd, &nf, sizeof(newsfeeds_t)) == sizeof(newsfeeds_t))
{
if (!strcmp(nf.board, brdname))
{
rc = 1;
break;
}
}
close(fd);
}
return rc;
}
int
main()
{
BRD brd;
int fd;
char *str;
chdir(BBSHOME);
if ((fd = open(FN_BRD, O_RDONLY)) >= 0)
{
while (read(fd, &brd, sizeof(BRD)) == sizeof(BRD))
{
str = brd.brdname;
if (!*str) /* 此板已被刪除 */
continue;
if (!(brd.battr & BRD_NOTRAN) && !in_newsfeeds(str))
printf("%s 的屬性要轉信出去,但不在 newsfeeds.bbs 中\n", str);
}
close(fd);
}
return 0;
}
--
╭┼ Origin: Maple-itoc˙動力核心 processor.tfcis.org
╰╖ Modify: 2004/10/06 Wed 23:24:46