diff options
author | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2007-06-09 23:18:38 +0800 |
---|---|---|
committer | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2007-06-09 23:18:38 +0800 |
commit | f863ff9c4e82ee8fc0f79617967530e2f6f39465 (patch) | |
tree | 70b35b5f161e28dd6c3cb6f8d378b4e3d51be2f7 | |
parent | 09e0aedae72379659916667ba31f15e46dd86797 (diff) | |
download | pttbbs-f863ff9c4e82ee8fc0f79617967530e2f6f39465.tar pttbbs-f863ff9c4e82ee8fc0f79617967530e2f6f39465.tar.gz pttbbs-f863ff9c4e82ee8fc0f79617967530e2f6f39465.tar.bz2 pttbbs-f863ff9c4e82ee8fc0f79617967530e2f6f39465.tar.lz pttbbs-f863ff9c4e82ee8fc0f79617967530e2f6f39465.tar.xz pttbbs-f863ff9c4e82ee8fc0f79617967530e2f6f39465.tar.zst pttbbs-f863ff9c4e82ee8fc0f79617967530e2f6f39465.zip |
delete obsolete utilities.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3534 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | sample/crontab | 1 | ||||
-rw-r--r-- | util/Makefile | 6 | ||||
-rw-r--r-- | util/checkdir.c | 73 | ||||
-rw-r--r-- | util/checkmoney.c | 40 | ||||
-rw-r--r-- | util/gamble_fix.c | 26 | ||||
-rw-r--r-- | util/parse_news.c | 69 |
6 files changed, 3 insertions, 212 deletions
diff --git a/sample/crontab b/sample/crontab index a732f926..71521202 100644 --- a/sample/crontab +++ b/sample/crontab @@ -12,7 +12,6 @@ 1 * * * * bin/account # 每個小時 10 分執行熱門話題統計 -#50 * * * * bin/parse_news 10 * * * * bin/poststat /home/bbs # 每天 5:30 執行使用者排行榜更新 diff --git a/util/Makefile b/util/Makefile index 1e997e41..33f3726b 100644 --- a/util/Makefile +++ b/util/Makefile @@ -21,11 +21,11 @@ CPROG_WITH_UTIL= \ boardlist BM_money post poststat \ jungo account birth deluserfile \ expire mandex horoscope broadcast \ - openvice parse_news openticket topusr \ + openvice openticket topusr \ yearsold toplazyBM toplazyBBM writemoney \ reaper buildAnnounce inndBM mailangel \ - outmail chkhbf checkmoney merge_dir \ - transman angel gamblegive checkdir \ + outmail chkhbf merge_dir \ + transman angel gamblegive \ wretch_man \ chesscountry tunepasswd buildir xchatd diff --git a/util/checkdir.c b/util/checkdir.c deleted file mode 100644 index fb02f43a..00000000 --- a/util/checkdir.c +++ /dev/null @@ -1,73 +0,0 @@ -/* $Id$ */ -/* -typedef struct fileheader_t { - char filename[FNLEN]; - char recommend; - char owner[IDLEN + 2]; - char date[6]; - char title[TTLEN + 1]; - int money; - unsigned char filemode; -} fileheader_t; - -*/ -#include "bbs.h" -void dumpfh(fileheader_t fh) -{ - char *c; - printf("dumping fh\n"); - for( c= (char*)&fh; (c-(char*)&fh)<sizeof(fh); c++) - if(isprint(*c)) printf("%c",*c); - else printf("[%02d]",(unsigned int)*c); - printf("\n"); -} -int main(int argc, char **argv) { - int count=0; - fileheader_t pfh, fh; - FILE *fp, *fo=NULL; - int offset=0; - - if(argc < 2) { - fprintf(stderr, "Usage: %s \n", argv[0]); - return 1; - } - - if(!(fp=fopen(argv[1],"r"))) - {printf("fileopen error!\n"); - return 0;} - if(argc >2) - fo=fopen(argv[2],"w"); - - for(count=0; fread(&fh, sizeof(fh), 1, fp) >0; count++) - { - if(fh.owner[0]=='M' && fh.owner[1]=='.') - { - count--; - fseek(fp,FNLEN+1-sizeof(fh),SEEK_CUR); - printf("%d,offset forth!---dump\n", count); - dumpfh(pfh); - dumpfh(fh); - offset=1; - continue; - } - if(fh.filename[1]!='.' && offset==1) - { - fseek(fp,-FNLEN-1-sizeof(fh),SEEK_CUR); - printf("%d,offset back!\n", count); - offset=0; - continue; - } - if(fh.filename[0]==0 || fh.owner[0]==0 || fh.owner[0]=='-') - { - if(fh.filename[0]==0) unlink(fh.filename); - continue; - } - pfh=fh; -fh.recommend =0; - if(fo) - fwrite(&fh, sizeof(fh), 1, fo); - } - fclose(fp); - if(fo) fclose(fo); - return 0; -} diff --git a/util/checkmoney.c b/util/checkmoney.c deleted file mode 100644 index a9ad9773..00000000 --- a/util/checkmoney.c +++ /dev/null @@ -1,40 +0,0 @@ -/* $Id$ */ -#define _UTIL_C_ -#include "bbs.h" - - -int main(int argc, char*argv[]) { - userec_t user; - char userhomepwd[256]; - char *userid; - int i, money; - - if(argc<2) - printf("user %s <PASSWD file to compare>", argv[0]); - attach_SHM(); - - if(passwd_init()) - exit(1); - for(i = 1; i <= MAX_USERS; i++) { - userid=SHM->userid[i-1]; - money =SHM->money[i-1]; - if(!userid[0] || money==-1 ) continue; - if(get_record(argv[1], &user, sizeof(user), i) == -1)continue; - if(money-user.money > 1000000 ||( money<100 && user.money>2000)) - { - sprintf(userhomepwd, BBSHOME "/%c/%s/.passwd", user.userid[0], - user.userid); - printf("%s %d ", userid, money); - money= user.money; - SHM->money[i-1] = money; - if(get_record(userhomepwd, &user, sizeof(user), 1) == -1) - get_record(BBSHOME"/.PASSWD", &user, sizeof(user), i); - user.money = money; - printf("become %d\n", money); - substitute_record(BBSHOME"/.PASSWD", &user, sizeof(user), i); - substitute_record(userhomepwd, &user, sizeof(user), 1); - } - } - - return 0; -} diff --git a/util/gamble_fix.c b/util/gamble_fix.c deleted file mode 100644 index 05d536e5..00000000 --- a/util/gamble_fix.c +++ /dev/null @@ -1,26 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> - -int main(int argc, char *argv[]) -{ - FILE *fp; - char buf[100]; - int i, j, count[8]={0,0,0,0,0,0,0,0}; - if(argc<2) - { - printf("useage example:%s ticket.user\n", argv[0]); - return 0; - } - fp=fopen(argv[1], "r"); - if(!fp) return 0; - while(fscanf(fp,"%s %d %d", buf, &i, &j)!=EOF ) - { - count[i]+=j; - } - for(i=0; i<8; i++) - { - printf("%d) %d\n",i+1, count[i]); - } - return 0; -} - diff --git a/util/parse_news.c b/util/parse_news.c deleted file mode 100644 index 6ea75454..00000000 --- a/util/parse_news.c +++ /dev/null @@ -1,69 +0,0 @@ -/* $Id$ */ -#include "bbs.h" - -#define NEWSDIRECT BBSHOME "/boards/n/newspaper" -#define MOVIEDIRECT BBSHOME "/etc/NEWS" - -int main(int argc, char **argv) -{ - int fd; - fileheader_t fh, news; - struct stat st; - register int numfiles, n; - FILE *fp = NULL; - char buf[200]; - - if (stat(NEWSDIRECT "/.DIR", &st) < 0) - return 0; - - system("rm -f " MOVIEDIRECT "/*"); - system("rm -f " MOVIEDIRECT "/.DIR"); - - numfiles = st.st_size / sizeof(fileheader_t); - n = 0; - if ((fd = open(NEWSDIRECT "/.DIR", O_RDONLY)) > 0) - { - lseek(fd, st.st_size - sizeof(fileheader_t), SEEK_SET); - while (numfiles-- && n < 100) - { - read(fd, &fh, sizeof(fileheader_t)); - if (!strcmp(fh.owner, "CNA-News.")) - { - if (!strstr(fh.title, "活動預告") && !strstr(fh.title, "中央氣象局") - && !strstr(fh.title, "歷史上的今天") && !strstr(fh.title, "頭條新聞標題") - && !strstr(fh.title, "Summary") && !strstr(fh.title, "全球氣象一覽") - && !strstr(fh.title, "校正公電")) - { - if (!(n % 10)) - { - if (n) - { - fclose(fp); - append_record(MOVIEDIRECT "/.DIR", &news, sizeof(news)); - } - strcpy(buf, MOVIEDIRECT); - stampfile(buf, &news); - sprintf(news.title, "中央社即時新聞 %s", fh.date); - strcpy(news.owner, "CNA-News."); - if (!(fp = fopen(buf, "w"))) - return (0); - fprintf(fp, "[34m ─────────[47;30m 中央社即時新聞[31m (%s)[m[34m──────────\n", - fh.date); - } - fprintf(fp, " ─────[33m◇[m [1;3%dm%s [m[34m%.*s\n", - (n % 6 + 4) % 7 + 1, fh.title, - (int)(46 - strlen(fh.title)), - "───────────────────"); - n++; - printf("[%d]\n", n); - - } - } - lseek(fd, -(off_t) 2 * sizeof(fileheader_t), SEEK_CUR); - } - close(fd); - fclose(fp); - append_record(MOVIEDIRECT "/.DIR", &news, sizeof(news)); - } - return 0; -} |