diff options
Diffstat (limited to 'util')
-rw-r--r-- | util/smtest.c | 289 | ||||
-rw-r--r-- | util/smtest.c.save | 172 | ||||
-rw-r--r-- | util/smtest.result1 | 191 | ||||
-rw-r--r-- | util/smtest.result2 | 3 | ||||
-rw-r--r-- | util/smtest.temp | 231 |
5 files changed, 0 insertions, 886 deletions
diff --git a/util/smtest.c b/util/smtest.c deleted file mode 100644 index e46157f2..00000000 --- a/util/smtest.c +++ /dev/null @@ -1,289 +0,0 @@ -/* $Id: smtest.c,v 1.5 2002/06/19 13:38:01 lwms Exp $ */ -#include "bbs.h" - -#define WARNFILE BBSHOME "/etc/DeleteBoard.warn" -#define EXECFILE BBSHOME"/etc/DeleteBoard.exec" -#define WARNLIST BBSHOME"/etc/DeleteBoardList.warn" -#define EXECLIST BBSHOME"/etc/DeleteBoardList.exec" - -extern boardheader_t *bcache; -extern int numboards; - -boardheader_t allbrd[MAX_BOARD]; -extern userec_t xuser; - - -int LINK(char* src, char* dst){ - char cmd[200]; - - if( link(src, dst) == 0){ - return 0; - } - - sprintf(cmd, "/bin/cp -R %s %s", src, dst); - return system(cmd); -} - -int outofdate(char *hdrdate, char thedate[], int *zf) -{ - int k = 0; - char *dd; - char latestdate[6]; - int date1[2], date2[2],datetemp; - *zf = 0; - - strcpy(latestdate, thedate); - - dd = strtok(hdrdate,"/"); - if(dd == NULL) return 2; - if(dd) - k = 0; - do{ - if (*dd == '[' ){dd[strlen(dd)-1]='\0'; dd++;} - date1[k] = atoi(dd); - k++; - } while((dd=strtok(NULL,"/ "))!=NULL); - - dd = strtok(latestdate,"/"); - if(dd) - k = 0; - do{ - if (*dd == '[' ){dd[strlen(dd)-1]='\0'; dd++;} - date2[k] = atoi(dd); - k++; - } while((dd=strtok(NULL,"/ "))!=NULL); - - if(date2[0] == date1[0] && date2[1] >= date1[1]) - return 0; - - datetemp = date2[0]; - - for(k = 1;k <= 5;k++) - { - datetemp -= 1; - if((datetemp) <= 0){ - datetemp = 12; - } - if(k < 3 && datetemp == date1[0]) return 0; - if(k == 3 && datetemp == date1[0] && date2[1] <= date1[1]) return 0; - if(k == 3 && datetemp == date1[0] && date2[1] > date1[1]) return 1; - if(k == 4 && datetemp == date1[0] && date2[1] > date1[1]) return 1; - } - *zf = 1; - return 1; -} - -void mailtouser(char *bmname, char *bname, int zf) -{ - fileheader_t mymail; - char genbuf[200]; - - sprintf(genbuf, BBSHOME "/home/%c/%s", bmname[0], bmname); - stampfile(genbuf, &mymail); - strcpy(mymail.owner, "[PTTĵ¹î§½]"); - - if(zf == 0){ - sprintf(mymail.title,"\033[32m [¼oªOĵ§i³qª¾]" - "\033[m %sªO(BM:%s)",bname, bmname); - }else{ - sprintf(mymail.title,"\033[32m [¼oªO³qª¾] " - "\033[m %sªO(BM:%s)",bname, bmname); - } - unlink(genbuf); - if(zf == 0){ - LINK(WARNFILE, genbuf); - }else{ - LINK(EXECFILE, genbuf); - } - - sprintf(genbuf, BBSHOME "/home/%c/%s/.DIR", bmname[0], bmname); - append_record(genbuf, &mymail, sizeof(mymail)); -} - -int main() -{ - int bmid, i, j, k, rd, ood, flag, zapflag = 0,warncount = 0,execcount = 0; - char *p, *bmsname[3], fname[256], hdrdatetemp[6],thedate[6]; - char bname[32],genbuf[200]; - fileheader_t hdr; - FILE *inf, *def; - - ///// set date ////// - time_t t = time(NULL); - struct tm *tm = localtime(&t); - sprintf(thedate, "%2d/%02d", tm->tm_mon + 1, tm->tm_mday); - - ////// board ////// - - resolve_boards(); - if(passwd_mmap()) - exit(1); - memcpy(allbrd,bcache,numboards*sizeof(boardheader_t)); - - ////// write out the target file ////// - inf = fopen(WARNLIST, "w+"); - if(inf == NULL){ - printf("open file error : %s\n", WARNLIST); - exit(1); - } - - def = fopen(EXECLIST, "w+"); - if(def == NULL) - { - printf("open file error : %s\n", EXECLIST); - exit(1); - } - - ////// fprint table title ///// - fprintf(inf,"\n[¼oªOĵ§i]§Y¤é°_¤@Ӥ뤺Y¬ÝªO" - "¨Ï¥Î²v¤´µM¹L§C¡A«h¤©¥H¼o°£¡C\n\n" - "^¤åªO¦W Ãþ§O ¤¤¤åªO¦W ¤é´Á " - " ªO¥D¦W³æ\n\n"); - - fprintf(def,"\n[¼oªO¤½§i]¤U¦C¬ÝªO¦]¨Ï¥Î²v¤´µM¹L§C¡A¬G¤©¥H¼o°£¡C\n\n" - "^¤åªO¦W Ãþ§O ¤¤¤åªO¦W ¤é´Á " - " ªO¥D¦W³æ\n\n"); - - ////// start process ///// - j = 0 ; - for (i = 0; i < numboards; i++) { - rd = 0; - if(allbrd[i].brdname[0] == '\0') continue; - if((allbrd[i].brdattr & BRD_NOZAP) || - (allbrd[i].brdattr & BRD_GROUPBOARD) || - (allbrd[i].brdattr & BRD_WARNDEL) || - (allbrd[i].brdattr & BRD_HIDE) || - (allbrd[i].brdattr & BRD_POSTMASK) || - (allbrd[i].brdattr & BRD_VOTEBOARD) || - (allbrd[i].brdattr & BRD_BAD) || - (allbrd[i].level != 0)) continue; - - sprintf(fname, BBSHOME "/boards/%c/%s/.DIR", allbrd[i].brdname[0], allbrd[i].brdname); - - /* get date to choose junk board */ - /* exception when ood == 2 */ - flag = 30; - rd = get_num_records(fname, sizeof(fileheader_t)); - if(rd <= 30) - { - get_record(fname, &hdr, sizeof (hdr), 1); - strcpy(hdrdatetemp, hdr.date); - ood = outofdate(hdrdatetemp,thedate, &zapflag); - } - else - { - do{ - if(rd == 0) - { - ood = 0; - break; - } - get_record(fname, &hdr, sizeof (hdr), rd - flag); - strcpy(hdrdatetemp, hdr.date); - ood = outofdate(hdrdatetemp,thedate, &zapflag); - flag += 5; - }while(ood == 2 && flag < 60); - } - if(ood == 0) continue; - - warncount++; - /* print to file */ - fprintf(inf,"%-*.*s%-*.*s %-*.*s%-*.*s\n", IDLEN, IDLEN, - allbrd[i].brdname, BTLEN-26, BTLEN-26, allbrd[i].title, - IDLEN - 5, IDLEN-5,hdr.date, IDLEN * 3, IDLEN * 3, allbrd[i].BM); - - /* post warn file to each board */ - sprintf(genbuf,"~/bin/post %s [¼oªOĵ§i³qª¾]" - " [PTTĵ¹î§½] %s",allbrd[i].brdname,WARNFILE); - system(genbuf); - - /* user extract to mail */ - p=strtok(allbrd[i].BM,"/ "); - if(p){ - k = 0; - do - { - if (*p == '[' ){p[strlen(p)-1]='\0'; p++;} - bmid=getuser(p); - bmsname[k] = p; - if(isalpha(allbrd[i].BM[0])&& !(xuser.userlevel &PERM_SYSOP)) - { - mailtouser(bmsname[k],allbrd[i].title, zapflag); - } - k++; - } while((p=strtok(NULL,"/ "))!=NULL); - } - /* set attribute of DeleteBoardWarn Flag */ - bcache[i].brdattr = allbrd[i].brdattr | BRD_WARNDEL; - - /* zap boards */ - if (zapflag == 1) - { - execcount++; - /* print to file */ - fprintf(def,"%-*.*s%-*.*s %-*.*s%-*.*s\n", IDLEN, IDLEN, - allbrd[i].brdname, BTLEN-26, BTLEN-26, allbrd[i].title, - IDLEN - 5, IDLEN-5,hdr.date, IDLEN * 3, IDLEN * 3, allbrd[i].BM); - - /* if you want to unmark these code, - make sure board, man path have changed to [man/]boards/<First char of brdname>/brdname - */ - -// strcpy(bname, allbrd[i].brdname); -// sprintf(genbuf, -// "/bin/tar zcvf ~/tmp/board_%s.tgz boards/%s man/%s>/dev/null 2>&1;" -// "/bin/rm -fr ~/boards/%s man/%s",bname, bname, bname, bname,bname); -// system(genbuf); - -// memset(&allbrd[i], 0, sizeof(allbrd[i])); -// sprintf(allbrd[i].title, "[%s] deleted by System", bname); -// substitute_record(fn_board, &bh, sizeof(allbrd[i]), bid); -// reset_board(bid); - } - - } - - /* post to Record, ViolateLaw */ - if(warncount > 0){ - sprintf(genbuf,"~/bin/post Record [¼oªOĵ§i³qª¾]" - " [PTTĵ¹î§½] %s",WARNLIST); - system(genbuf); - sprintf(genbuf,"~/bin/post ViolateLaw [¼oªOĵ§i³qª¾]" - " [PTTĵ¹î§½] %s",WARNLIST); - system(genbuf); - } - if(execcount > 0){ - sprintf(genbuf,"~/bin/post Record [¼oªO¤½§i]" - " [PTTĵ¹î§½] %s",EXECLIST); - system(genbuf); - sprintf(genbuf,"~/bin/post ViolateLaw [¼oªO¤½§i]" - " [PTTĵ¹î§½] %s",EXECLIST); - system(genbuf); - } - - -/* Below is for test only */ -/* - mailtouser("Smile","test", 1); - mailtouser("Smile","test", 0); - - strcpy(bname, "Test"); - sprintf(genbuf,"~/bin/post %s test Smile ~/etc/test.fileaaa",bname); - system(genbuf); - - - bid = getbnum(bname); - strcpy(bname,"jourslamdunk"); - sprintf(genbuf, - "/bin/tar zcvf ~/tmp/board_%s.tgz boards/%c/%s man/%c/%s>/dev/null 2>&1;" - "/bin/rm -fr ~/boards/%c/%s man/%c/%s", - bname, bname[0], bname, bname[0], bname, bname[0], bname, bname[0], bname); - system(genbuf); - - memset(&bh, 0, sizeof(bh)); - sprintf(bh.title, "[%s] deleted by %s", bname,cuser.userid); - substitute_record(fn_board, &bh, sizeof(bh), bid); - reset_board(bid); -*/ - return 0; -} diff --git a/util/smtest.c.save b/util/smtest.c.save deleted file mode 100644 index 7e678881..00000000 --- a/util/smtest.c.save +++ /dev/null @@ -1,172 +0,0 @@ -#include <stdio.h> -#include <sys/types.h> -#include <unistd.h> -#include <string.h> -#include <stdlib.h> -#include <time.h> -#include <ctype.h> -#include "config.h" -#include "pttstruct.h" -#include "util.h" -#include "perm.h" -#include "common.h" -#include "proto.h" - -#define OUTFILE BBSHOME "/pttbbs/util/smtest.result1" -#define FIREFILE BBSHOME "/pttbbs/util/smtest.result2" - -extern boardheader_t *bcache; -extern int numboards; - -boardheader_t allbrd[MAX_BOARD]; -struct userec_t xuser; - -int getuser(char *userid) { - int uid; - if((uid = searchuser(userid))) - passwd_query(uid, &xuser); - return uid; -} - -int LINK(char* src, char* dst){ - char cmd[200]; - - if( link(src, dst) == 0){ - return 0; - } - - sprintf(cmd, "/bin/cp -R %s %s", src, dst); - return system(cmd); -} - -int main() -{ - int bmid, i, j, k, rd; - char *p, *bmsname[3], bmbuf[IDLEN * 3 + 3], fname[256]; - fileheader_t hdr; - FILE *inf; - - resolve_boards(); - if(passwd_mmap()) - exit(1); - memcpy(allbrd,bcache,numboards*sizeof(boardheader_t)); - - /* write out the target file */ - inf = fopen(OUTFILE, "w+"); - if(inf == NULL){ - printf("open file error : %s\n", OUTFILE); - exit(1); - } - - /*the ouput table title*/ - fprintf(inf,"^¤åª©¦W Ãþ§O ¤¤¤åª©¦W ª©¥D¦W³æ" - " ¤é´Á ³Æµù \n"); - - j = 0 ; - for (i = 0; i < 30; i++) { - rd = 0; - if(allbrd[i].brdname[0] == '\0') continue; - - sprintf(fname, BBSHOME "/boards/%s/.DIR",allbrd[i].brdname); - - rd = get_num_records(fname, sizeof(fileheader_t)); - get_record(fname, &hdr, sizeof (hdr), rd - 30); -// printf(" %s %s\n",hdr.title,hdr.date); - - printf("%-*.*s%-*s%s", IDLEN, IDLEN, allbrd[i].brdname, BTLEN, - allbrd[i].title,allbrd[i].BM); - - p=strtok(allbrd[i].BM,"/ "); - if(p){ - int k = 0; - do - { - if (*p == '[' ){p[strlen(p)-1]='\0'; p++;} - bmid=getuser(p); - bmsname[k] = p; - if(isalpha(allbrd[i].BM[0])&& !(xuser.userlevel &PERM_SYSOP)) - { - // printf("%s", bmsname[k]); - } - k++; - } while((p=strtok(NULL,"/ "))!=NULL); - } - - printf("\n"); - -} - - -/* - - - - if(flag == 1){ - bmbuf[0] = '\0'; - for(k = 0 , n = 0; k < index; k++){ - if(!bms[k].flag){ - if( n++ != 0) strcat(bmbuf, "/"); - strcat(bmbuf, bms[k].bmname); - } - } - strcpy(bcache[i].BM, bmbuf); - } - } - qsort(lostbms, j, sizeof(lostbm), bmlostdays_cmp); - - //write to the etc/toplazyBM - for ( i=0; i<j; i++) - { - if( lostbms[i].lostdays > 60){ - fprintf(firef, "%-*.*s%-*.*s%-*.*s%3d¤Ñ¨S¤W¯¸\n", IDLEN, IDLEN, - lostbms[i].title, BTLEN-10, BTLEN-10, lostbms[i].ctitle, IDLEN,IDLEN, - lostbms[i].bmname,lostbms[i].lostdays); - }else{ - fprintf(inf, "%-*.*s%-*.*s%-*.*s%3d¤Ñ¨S¤W¯¸\n", IDLEN, IDLEN, lostbms[i].title, - BTLEN-10, BTLEN-10, lostbms[i].ctitle, IDLEN,IDLEN, - lostbms[i].bmname,lostbms[i].lostdays); - } - } - fclose(inf); - fclose(firef); - - //printf("Total %d boards.\n", count); - - //mail to the users - for( i=0; i<j; i++) - { - fileheader_t mymail; - char genbuf[200]; - int lostdays; - - lostdays = lostbms[i].lostdays; - - if( (lostdays != 30) && (lostdays != 45) && (lostdays <= 60)) - continue; - - sprintf(genbuf, BBSHOME "/home/%c/%s", lostbms[i].bmname[0], lostbms[i].bmname); - stampfile(genbuf, &mymail); - - strcpy(mymail.owner, "[PTTĵ¹î§½]"); - - if(lostdays <= 60){ - sprintf(mymail.title, - "\033[32m [ª©¥D§K¾ĵ§i³qª¾] \033[m %s BM %s", lostbms[i].title, lostbms[i].bmname); - }else{ - sprintf(mymail.title, - "\033[32m [ª©¥D§K¾³qª¾] \033[m %s BM %s", lostbms[i].title, lostbms[i].bmname); - } - mymail.savemode = 0 ; - unlink(genbuf); - if(lostdays <= 60){ - LINK(OUTFILE, genbuf); - }else{ - LINK(FIREFILE, genbuf); - } - - sprintf(genbuf, BBSHOME "/home/%c/%s/.DIR", lostbms[i].bmname[0], lostbms[i].bmname); - append_record(genbuf, &mymail, sizeof(mymail)); - } -*/ - return 0; -} diff --git a/util/smtest.result1 b/util/smtest.result1 deleted file mode 100644 index 6dee45ff..00000000 --- a/util/smtest.result1 +++ /dev/null @@ -1,191 +0,0 @@ -^¤åª©¦W Ãþ§O ¤¤¤åª©¦W ¤é´Á ª©¥D¦W³æ -ck48th301 «Ø¤¤ ¡·¤jºjÀ°¤§§Ö¼Ö¤Ñ° 3/21 ching/carl/Prosecuted -Bowling ¹B°Ê ¡´¨«¹L2000,ÁÚ¦V30 7/18 Genson/chiche -NTUCH-89 ¤Æ¾Ç ¡·²¦·~°Õ¡I¡I 7/10 badora/furtwangler -SetupBBS BBS ¡·TEST://140.112. 8/08 Libra -Fei-cat ¹Ï¤å ¡·23:56 ·L»Ä¨ý 8/07 tears -CKAWE «Ø¤¤ ¡´«Ø¤¤®Õ¤ÍºÞ¼Ö¹Îª 7/04 ckb/papl/trumpet -jourslamdunk«Ý¼o ¡·¬F¤j·s»D¨tÄx²y¶ 7/04 ¼x¨D¤¤ -ck48th308 «Ø¤¤ ¡·¤Sn²¦·~¤F¡I 7/15 honest -CS84Her ¤¤¤s ¡·¦U©bªF¦è ¤]n©M 7/20 -VM ¬P°¨ ¡´¯k¥ú¨}«~«aªº³d¥ 7/20 zoo -E-Diagrams ®Õ¶é ¡·¤@°_¤K¨ö¤¤d¦~. 6/29 Benjamin -ck48th313 «Ø¤¤ ¡´ª©¥D¤£ºÞ¤F,¨ÓÄé 6/08 fantastic -ck48th324 «Ø¤¤ ¡·«¢«¢«¢... 7/10 -B853023XX ¬Fªv ¡·¤½¦æ·s¥@¬ö 8/15 FireKing -ck48th303 «Ø¤¤ ¡·§Lªº¥@¬É 6/05 Roses999/henrry/flyingdog -CS85ee ¤¤¤s ¡·¤j®a¸q°_©¯ºÖ 8/08 admin/MVPgirl -CS85simple ¤¤¤s ¡·Â²¯Z¤H-¤£Â²³æ 3/29 bbeellaa -TFG95TRUE ¥_¤@ ¡·¯u¯ZªGµæ¶é 3/29 deceanna -ck46th318 «Ø¤¤ ¡· ¯¬ ºÖ ¤j ® 3/16 FengX/barkjor -PTGS50th301 ¤¤¤k ¡·¤Ñ¤U²Ä¤@¯Z--¤¤¤ 8/09 cocoduck/youki -CS85ming ¤¤¤s ¡·"©ú"¤ß¤p¶é 8/08 shan/lovehook/JWR -ck47th333 «Ø¤¤ ¡·³o¼Ë·|¤£·|¼oª©? 7/17 diezoo/Express -TFG97SHOT ¥_¤@ ¡·¦Ì¨º®á¡@¾¾¥Ì°_¤ 8/07 chili/atlantis -Taichung ªA°È ¡·³Ì³Ì²M·s¥i·R°·± 8/09 Jahon -southdoor «nªù ¡·«nªù¤»¥Òªºµ£¨¥µ 8/09 happyjoy -ck47th301 «Ø¤¤ ¡·ÁٳѽְڡH¡H 5/22 huskie/flutii -hsntu ªþ¤¤ ¡´¥x¤jªþ¤Í·| ¨Ó 11/29 koku/Crony -JH23th301 °ê¤¤ ¡·§AÁÙ¬¡µÛ¶Ü? 7/25 momi/mvpman -money ¾Ç³N ¡´Show me the 5/02 kagh -HSNU_807 ªþ¤¤ ¡·®Ã¨Õ¹s¬m¯Z 7/16 yijean/joj -ntubbsops µo¹q ¡´¥x¤j³s½u¯¸°ÈªO 3/23 Ptt -ntuACCT90 ·|p ¡´³o¬O¥Ã»·ªº¥x¤j· 7/19 blackman/aathena -geography90 ¦a²z ¡· 5/23 cog/uray -TFG97Juang ¥_¤@ ¡·§ÚÌ·|¤£·|ª½¨ì± 8/09 seabreeze/notorious/Ving -JHArt10th °ê¤¤ ¡·¶Â¦âªº©ñ®öx 8/14 sadness/noyes -ChanAn26-303ªø¦w ¡·¥s§Ú²Ä¤@¦W 8/07 HunterX -FashionClub ¶h½ì ¡´¶W«lÃz¤§--¥x¤j¦ 1/17 demure/Woodywang/wiki -TFG97KIND ¥_¤@ ¡·³o¸Ì¥i¬O¤¯¶¡¤Ñ° 1/17 Channy -AADIA ¥xÆW ¡·¿Nºuºuªº³Ì¨Î¨kº 8/13 CATHYSHU/dyw -Sunrise12 ¹ÎÅé ¡·´Â¶§¦P¾Ç·|¤Q¤G© 8/14 waiting/doggy -cksh75th09 ¦¨¥\ ¡·¤Í½Ë¾ú"¤E"¤@¼Ë¿ 8/08 chiahei/WeThree/berserk -Evangelion ¤é¥» ¡´¸Û¼xª©¥D:) 6/15 ¼x¨D¤¤ -NTUba87 ¤uºÞ ¡·¤uºÞ¤@¥X ½Ö»P 8/09 ukj/littlewin -ck49th109 «Ø¤¤ ¡·ª©¥Dn¤W¤s«ô®v¥ 3/24 edvi -CS86Honest ¤¤¤s ¡·³o¸Ì¬O¸Û¯Z¡I¸Û¯ 5/24 Nakai/vicke -YP86-307 ©µ¥ ¡·¨È¬w²Ä¤@°Õ! 8/08 DRAGONS/longman -jackstudio µ¼Ö ¡·ªN§J·nºuµ¼Ö¾Ç 8/13 gigimusic -CS85MadWiser¤¤¤s ¡··¬¨g´¼¼z¤H 12/06 NED -LiZin ¸É²ß ¡·¥ß¤H¸É²ß¯Z 6/10 success/adket/foster -HP_86_310 ©M¥ ¡·©M¥°ª¤¤²Ä¤@©¡ 11/26 beautyegg/oops/kyte -Terry ¥xÆW ¡·ªL§Ó¬¯¡uÀ¿Án¦Ó¹ 8/10 jane -Julia ¥xÆW ¡· ¤@¥Í³Ì·Rªº´^¨Î 8/07 esa -PTGS50th305 ¤¤¤k ¡·¦³¹Ú¦³ªB¤Í---¤¤ 8/07 gm -ck49th111 «Ø¤¤ ¡´¥´À»§Å±C¯S§ð¶¤ 3/15 ERWILSON/firebat -ck49th131 «Ø¤¤ ¡·§Ṳ́S²¦·~¤F... 12/26 lanzi/Cliche -Wallace »´ä ¡·¤p¤Ó¶§Áéº~¨}--¥ 8/07 karencc -KJ25MC ¥ú¤¯ ¡·¥ú¤¯«lÃz¬ü¤kª© 7/09 pm -ADS ¨ä¥L ¡´¼s§i¯S°Ï 7/09 chwang/sourit/elixirs -TFSHS57th310¤@¤¤ ¡´§Ṳ́@®a³£¬O¤H 7/09 difficult/lpp/juwu -B84305XXX ªÀ·| ¡·84¯ÅªÀ·|¤H 7/12 ridley -Jeff ¥xÆW ¡·¤Q¤G¤ëªì--±¡ºq¤ 7/24 MisaTanaca/gambol -EricMoo ¬P°¨ ¡·§Å±Ò½åªº·P°Ê 11/27 piercec -NTUIB-PHD °ê¥ø ¡·¥x¤j°ê¥ø©Ò³Õ¤h¯ 5/22 yi03 -cksh75th19 ¦¨¥\ ¡·¤µ¤Ñªº§A,¹L±o¦n 8/17 shiii/eegg -MINGDAO ©ú¹D ¡·ªï±µ·s¥@¬öªº¨ì¨ 3/10 apache/kaening -NTUMBA-87 °Ó¬ã ¡·¥ø·~®aªººÛ 8/13 jonah -ck49th324 «Ø¤¤ ¡´¤@©u®L©]ªº¤ß°Ê 4/03 jase/uuuuuu/brita -TFG96Chung ¥_¤@ ¡·²{¦bµ²±B«Ü¤£¦Eº 8/12 astroboy -Kinmen ÒO¤Í ¡·¥x¤jÒO¤Í·| 4/26 spurs -BANYAN ¥_ªù ¡·¥_ªù°ª¤¤46TH 30 7/09 lusa/wangstar -BADTWINS ¤¤¤Í ¡·¤j¼w°ê¤¤ 7/16 Chilong/ggn/xlight -TFG96WILL ¥_¤@ ¡·¼Ý°ê·±¡ 8/17 because/Galong -HSNU_924 ªþ¤¤ ¡´ºÆ¨g´c¶Õ¤O 7/16 Dukedream -Cyndi ¥xÆW ¡·¨S¦³"¾ÖµØ"¡A´N¥ 1/11 Melinda -test2 -CS86Smile ¤¤¤s ¡´¯º¶Æ¤¤¤s 12/20 HsinYu/sunspring -JI3thN3-3 ¥¿¸q ¡·¥¿¸q°ª¤¤´¶¤T¤T 7/13 screamer/stingypig -CS87KUNG ¤¤¤s ¡·¤½¤§·¶³ 8/12 hayashi/yjiou -NTUBA-837011¥øºÞ ¡·ª©½Þ¬O°¦¤jÃi½Þ 3/10 eemil -TW-explorer ¼v¶° ¡·¤p¤ß³QÅQ¤ýÀs«r³ 8/06 honu -NTUIMA ªZ³N ¡·¤º®a®±ªÀ ³¯¤ó¤Ó 8/16 shadowpen/fu6xjp6 -NthuPhi õ¾Ç ¡·®µ²ø©P¥H¾C¹C 8/07 cerberus -FreeNight ¥xÆW ¡·TROUBLE ±i¾_À® 5/24 gonna/holybell -GlobalECON «Ý¼o ¡·¬F¸g¤K¦Ê(°]¸g°Ý 12/12 ali8/martinboy -cvslog µo¹q ¡·cvs commit mess 4/16 -Momentum «Ý¼o ¡·°Ê¶q¥\³õ¤u§@«Ç 12/03 adnova/chestnut -chess ®T¼Ö ¡·¤]¹ï ³£¬O³s±N 2/01 miserable -ChthoniC ¥xÆW ¡´°{ÆF¼Ö¹Îª© 8/07 Iverigma -shisong304 ¦èªQ ¡·¦èªQ304 5/15 JawTing/JSmoltz -NCCU97_MAT ·|¬ã ¡·¨Ó§a.....¦P¾Ç·| 5/15 kemling/A1997 -ck49th331 «Ø¤¤ ¡·¨g¨F³¥±æ¡C 7/12 MDP/den -HCGH-306 ¦Ë¤k ¡·¦³¤K¨ö¡I¡I¡I 4/19 jennywen/molly -Foolshome ¹ÎÅé ¡·CCC~~~¤dÁH¦~ 1/06 truth/citizen/nathon -MARIAH ¬ü°ê ¡· ¡¹¡¹DON'T STOP 8/11 woowa -KHCHS-87-306·s²ø ¡·³£¶]¨ìþ¸Ì¥h¤F 6/10 -Delphi µ{³] ¡·Delphi¨g·Q¦± 2/13 cying -ciacia_Her ¥xÆW ¡·ciacia¥Î¤å¦r¬D³ 7/26 sherbet -KS86-323 ¶¯¤¤ ¡´§Ú̬O¥Ã»·ªºªüµ 7/05 fayemimi/hanawa -test2 -KS86-322 ¶¯¤¤ ¡·¤j®a¦^¨ÓÄé¤ô§a¡ 8/10 Vygotsky/SpermTiger -35WHOteam ¹ÎÅé ¡·ÂåÀø¥~¥æÀç¤T¤¤ 5/12 winonamars -test2 -ck49th306 «Ø¤¤ ¡·ernesto¡G 306ª 7/18 pongo/dearyou -WuLing40-301«Ý¼o ¡·¦³¹Ú¦³ªB¤Í 10/ 8/11 quert -NTUACCT88 ·|p ¡·¤Ñ ¹D ¹S ¶Ô 6/12 Abbado/yenjui -NTUDRC ¬ã¨s ¡·©Î³\©p¬O¹ïªº 8/10 Kymco/plockock/Jimmyplus -NTUWRC ³°¤W ¡·¥x¤jºL¨¤¬ã¨sªÀ 8/07 BigRed -TFSHS59th318¤@¤¤ ¡´¹L¤F¤@¤Ñ¤S¤@¤Ñ 8/07 prodigy/kinoo/frisk -86literarts ¤å¾Ç ¡·86®v¤j¤åÃÀÀç 8/07 stupidbear/bengthek -NTPU-SOC87 ªÀ·| ¡·«z«¨...·sª©¦¨¥ß 8/12 nettaigyo -NTU94FLLD ¥~¤å ¡·B83102's Wonder 3/27 poppet -ToriAmos ¬ü°ê ¡·SLG¼ö½æ¤¤ 8/14 CornflakeBoy -Bjork ¬ü°ê ¡·¤å³¹³£¤£¨£¤F § 8/09 lunaticlace/sjon -SCU-BM-87C Æ[¹î ¡· ¤Í½Ë¾ú¤[¤@¼Ë¿@ 4/17 joeyoung/linging/YADY -CC-304 ¤¤¥¿ ¡·¤¤¥¿¶W´Î 304 8/14 betty0804/daystar -Robin-Willia«Ý¼o ¡·¥Ã»·¤£¦ÑªºÃ¹»«« 8/09 ¼x¨D¤¤ -NTUEEice ¹ÎÅé ¡·á -- µ² 8/10 hiei81/shouhou -tu-tuoz ¹ÎÅé ¡·¦R¼Ñ°ê¥Á¤p¾Ç 8/10 galilei/seethesky -WesleyS3H-32½Ã²z ¡·³Ì«á¤@Ó´»°²°Õ¡ 8/15 esm -Romi ¥xÆW ¡·§Qºö¡ã¡ãÅé¶K 8/16 flyawayhome/holina -EEacademic ¹q¾÷ ¡´n´Á¤¤¦ÒÅo¡I¡I 5/11 ccchen -ck-newboard ¥Ó½Ð ¡·«Ø¤¤²Õ±M¥Î³s¸pª 2/09 Pets -NTUspecial µLê ¡·¡¸¥xÆW¤j¾ÇµL»Ùà 4/28 t6768 -chienchen §@®a ¡·¤å¦rºëÆF¡X¡XÂ²Ø 8/09 curioussoul/ECOSEED -test2 -test2 -test2 -NTUmed-SC Âå¾Ç ¡·¡¸¤È¶¡µ¼Ö·|µ¥§ 8/13 Evan/boo24 -Visual_Basicµ{³] ¡·«z«z..§A¤£¯à¦Û¤ 8/14 glans -test2 -test2 -AngelicaLee ¬P°¨ ¡·¶W¥i·R§õ¤ß¼ä *^ 8/11 CaptainL -Jackie_Lui »´ä ¡´«L°©¤¯¤ß--§f¹|½ 8/14 pipo/YCJ -HSNU_888 ªþ¤¤ ¡´888¬¾¨ß²Ä¤G¸] 8/10 Viggeran/cidi -ClassicMusicµ¼Ö ¡´§ÚÌ£x°ê¼Ö 8/13 kuger/mml -CM34th03 ´º¬ü ¡·:) 8/13 Snorkel -CS88Jang ¤¤¤s ¡·§Ú̳£¬O¥¿ÂI¬ü¤ 8/08 YANIYANI/cfchien -TFG99JUANG ¥_¤@ ¡·µM«á¤S¬O¬î¤Ñ°Õ. 8/11 yumeko -SrcDiscuss ¯¸ªø ¡·PTT ¥¼¨Óµ{¦¡µo® 5/13 CharlieL/DavidYu -WL-AFFAIRS ¨Æ°È ¡·½Ð¦UªO¥Dª`·N¸s² 6/09 PaiBingTran -SMGJS-80-302¾å©ú ¡·¥Ã»·ªºªì¤T¤A 8/09 chifang -ck51st332 «Ø¤¤ ¡·±¥ Â÷§Ú̦ӥhªº 8/13 JeffreyS/jimmycat/Kampuchea/JIROO -HORT-90 ¶éÃÀ ¡´²¦·~¤F... 8/16 sorng -NCHUPPSB ¨tÂS ¡·«s«s«s «áÄ~µL¤H 4/14 LCUTE/AMDKX -TAE ®õ°ê ¡·¦A¨£,¥[¦{®üÅy 4/14 TulipChiu -LePoete ¥xÆW ¡·¥Ð¶é¸Ö¤H³¯©ú³¹( 4/14 doomcat -NTUPOD ¬ã¨s ¡· 8/16 Galong -ck53rd211 «Ø¤¤ ¡·´«Ó¦W¦r§a.. 8/07 shanvic/BBD -NCHU-SES ¤gÀô ¡·¤j®a¨Óªï·s³á~~ 4/18 yenjan -Tin-Tin ¥xÆW ¡´´@´@·Rªº³Ó§Q 8/09 shinoo -PTGS48th318 ¤¤¤k ¡·ºñ¦âÁ½¸ºÛ 8/15 yungfang -KF302 ¥ú´_ ¡·¶ë¨®¤¤ 8/15 ingela/cadillac -HuangLei ¤j³° ¡·¶À½U¤å¾Çµ¼Ö¤jº 8/09 ssr -NCCU99_EDU «Ý¼o ¡·~±Ð¨|Ä_Ä_ªº_§§ 8/14 ¼x¨D¤¤ -NCHU_zoo °Êª« ¡´¤£¨}¤û¤H¤ñ¸û¦h 4/24 sengir/GENETICS/velella -Bull ¾´Î ¡´¤G¤Q¤@¥@¬ö³Ì«i² 4/24 Nicky41/georgey -KS88-309 ¶¯¤¤ ¡´°¸§i¶D§A...§Ú§@ 4/24 daviy -cksh77th20 ¦¨¥\ ¡·§A§Ú³£¬O·Ï¤õ¤¤ª 8/06 bergee -TFG99Dance ¥_¤@ ¡·µL¬×Jazz«ax 8/07 Tinabear/hee -TFG99Love ¥_¤@ ¡· ¨ä ¹ê 8/07 kelala/SpiceB -Nedio ´CÅé ¡·§Ö¤Whttp://nedi 8/08 SpiceB/Sophia33 -TYHS88-306 ¥ªÀç ¡´¤T¤Ñ¤T©]¨ì¤T§ó¥ 8/09 niniway/Jey -BCT-88 ¬ì§Þ ¡·¤@¸s¦b¥Íª«§Þ³N¤ 8/15 physik/avkao -CARNEGIE0917¹ÎÅé ¡·***ªï±µ°{«Gªº21 8/07 blackmail/mistletoe/tsg -NCCU_PT ªÀ¹Î ¡·¨S¦³¬¡°Êªº«Ì¤Í· 8/11 mib345/randying -NCHU-SKATING·È¦B ¡·¨Ó¥h...¨Ó¥h...¤ 3/18 kaoasaki/littlehome -Tun-Hua-Elem´°¤Æ ¡·TunHua_²Ä32©¡_6 8/07 pup -CS88jing ¤¤¤s ¡·§Ö²¦·~¤FC ·Q 8/08 yianne -LeneMarlin ¬ü°ê ¡·µ¼ÖºëÆF--µY®¦º 8/08 janetwang -KS88-304 ¶¯¤¤ ¡·¤j®a¨ÓÄé¤ô³á~ 8/12 ahwa/oldya/BabyHam -Summer ¥xÆW ¡·§â¼v¤l¯d¤U¡A¦b® 8/08 powerpeople/FINNCHE -Slayers ¤é¥» ¡·¨q³rÅ]¾É¤h ²ú® 8/07 Zelgandes/marcal/Naga -NTU-SwimCamp¤ô¤W ¡·¥x¤j´åªaÀç 6/22 sunnyl -red-sun ªÀ¹Î ¡·¸¨¥Û¨ÓÅo 8/09 renaissance -1995-JH-325 ª÷µØ ¡·ª÷µØ°ê¤¤¤T¦~¤G¤ 8/13 ThisWayIn/Raistlin/ifq -X-game ¹B°Ê ¡··¥¹B°Ê 8/08 rbaggio -88leadercamp¹ÎÅé ¡´ ²×©ó¶}ª©ªº88ªÀ 8/12 elbert/aaati -Curse ¥xÆW ¡·¶A©G¼Ö¹Î(¤Q¤K¤~ 8/07 anticrist -Joi ¬P°¨ ¡·²E²b¨Îµ 8/08 leon19/crazykiller -SHENA-RINGO ¤é¥» ¡·´Õ¦WªLìþ ³Ó¶Dªº 8/08 MayMV -CCJH-FS-27th¤¤¥¿ ¡·£¯ §N²M²M..... 8/12 Ariyari/YehMay -PH-Service ¤½½Ã ¡·¥ÃÄò¸gÀ窺¤½½Ãª 8/07 piayyc/yuskay -1995-JH-309 «Ý¼o ¡·ª÷µØ309°ê¤¤¦P¾Ç 2/11 ¼x¨D¤¤ -Peter ¥xÆW ¡·¨C¦¸·Q¨ì"¦ó¼íªF 3/05 Haas -IPIS µá°ê ¡·Á½¸-§Ñ¤F§Ú¬O½Ö 5/30 -cksh76th22 ¦¨¥\ ¡·¦a²y«Ü¦MÀIªº!©p 8/15 lunasoul -Stella ¬P°¨ ¡·µ¼Ö²¢¤ß-¶À´ð©É 7/12 gutai309/crazykiller -Law-Skate ªk«ß ¡·ªkbª½±Æ½üªÀ ·È 6/12 Rainsalt/gwenlin -cksh78th08 ¦¨¥\ ¡·¤»¦rÀY 308 3/17 smilefacer -ntucomga ºÞ·| ¡·ºÞ°|¬ã¨s¥Í¾Ç¥Í· 5/08 handsome diff --git a/util/smtest.result2 b/util/smtest.result2 deleted file mode 100644 index b84133c2..00000000 --- a/util/smtest.result2 +++ /dev/null @@ -1,3 +0,0 @@ -§K¾ª©¥D -¬ÝªO¦WºÙ ªO¥D ´X¤Ñ¨S¨Ó°Õ ----------------------------------------------------------------------- diff --git a/util/smtest.temp b/util/smtest.temp deleted file mode 100644 index 7daa12ce..00000000 --- a/util/smtest.temp +++ /dev/null @@ -1,231 +0,0 @@ -#include <stdio.h> -#include <sys/types.h> -#include <unistd.h> -#include <string.h> -#include <stdlib.h> -#include <time.h> -#include <ctype.h> -#include "config.h" -#include "pttstruct.h" -#include "util.h" -#include "perm.h" -#include "common.h" -#include "proto.h" - -#define OUTFILE BBSHOME "/pttbbs/util/smtest.result1" -#define FIREFILE BBSHOME "/pttbbs/util/smtest.result2" - -extern boardheader_t *bcache; -extern int numboards; - -boardheader_t allbrd[MAX_BOARD]; -struct userec_t xuser; - -int getuser(char *userid) { - int uid; - if((uid = searchuser(userid))) - passwd_query(uid, &xuser); - return uid; -} - -int LINK(char* src, char* dst){ - char cmd[200]; - - if( link(src, dst) == 0){ - return 0; - } - - sprintf(cmd, "/bin/cp -R %s %s", src, dst); - return system(cmd); -} - -int outofdate(char *hdrdate, char latestdate[]) -{ - int k,rr; - char *dd; - - dd = strtok(hdrdate,"/"); - - if(dd){ - k = 0; - do - { - if (*dd == '[' ){dd[strlen(dd)-1]='\0'; dd++;} - rr = atoi(dd); - printf("%d/", rr); - } while((dd = strtok(NULL,"/")) != NULL); - } - - printf("\n"); - - if(1) - return 1; - else - return 0; -} - -int main() -{ - int bmid, i, j, k, rd,rr; - char *p, *bmsname[3], fname[256], *dd; - fileheader_t hdr; - FILE *inf; - - /* set date */ - char thedate[5]; - time_t t = time(NULL); - struct tm *tm = localtime(&t); - - sprintf(thedate, "%2d/%02d", tm->tm_mon + 1, tm->tm_mday); - - resolve_boards(); - if(passwd_mmap()) - exit(1); - memcpy(allbrd,bcache,numboards*sizeof(boardheader_t)); - /* write out the target file */ - inf = fopen(OUTFILE, "w+"); - if(inf == NULL){ - printf("open file error : %s\n", OUTFILE); - exit(1); - } - - /*the ouput table title*/ - fprintf(inf,"^¤åª©¦W Ãþ§O ¤¤¤åª©¦W ª©¥D¦W³æ" - " ¤é´Á ³Æµù \n"); - - j = 0 ; - for (i = 0; i < 30; i++) { - rd = 0; - if(allbrd[i].brdname[0] == '\0') continue; - if((allbrd[i].brdattr & BRD_NOZAP) == 1) continue; - - sprintf(fname, BBSHOME "/boards/%s/.DIR",allbrd[i].brdname); - - /* get date to choose junk board */ - - rd = get_num_records(fname, sizeof(fileheader_t)); - get_record(fname, &hdr, sizeof (hdr), rd - 30); - - - if(outofdate(hdr.date,thedate)) printf("yest\n"); - -/* - dd = strtok(hdr.date,"/"); - - if(dd){ - k = 0; - do - { - if (*dd == '[' ){dd[strlen(dd)-1]='\0'; dd++;} - rr = atoi(dd); - printf("%d/", rr); - - } while((dd = strtok(NULL,"/")) != NULL); - } - printf("\n"); -*/ - /* print to file */ - printf("%-*.*s%-*.*s%-*.*s%-*.*s", IDLEN, IDLEN, allbrd[i].brdname, - BTLEN-24, BTLEN-26, allbrd[i].title, IDLEN - 5, IDLEN-5,hdr.date, - IDLEN * 3, IDLEN * 3, allbrd[i].BM); - - /* post to board */ - - - - /* user extract to mail */ - - p=strtok(allbrd[i].BM,"/ "); - if(p){ - k = 0; - do - { - if (*p == '[' ){p[strlen(p)-1]='\0'; p++;} - bmid=getuser(p); - bmsname[k] = p; - if(isalpha(allbrd[i].BM[0])&& !(xuser.userlevel &PERM_SYSOP)) - { - // printf("%s", bmsname[k]); - } - k++; - } while((p=strtok(NULL,"/ "))!=NULL); - } - - printf("\n"); - -} - - -/* - - - - if(flag == 1){ - bmbuf[0] = '\0'; - for(k = 0 , n = 0; k < index; k++){ - if(!bms[k].flag){ - if( n++ != 0) strcat(bmbuf, "/"); - strcat(bmbuf, bms[k].bmname); - } - } - strcpy(bcache[i].BM, bmbuf); - } - } - qsort(lostbms, j, sizeof(lostbm), bmlostdays_cmp); - - //write to the etc/toplazyBM - for ( i=0; i<j; i++) - { - if( lostbms[i].lostdays > 60){ - fprintf(firef, "%-*.*s%-*.*s%-*.*s%3d¤Ñ¨S¤W¯¸\n", IDLEN, IDLEN, lostbms[i].title, - BTLEN-10, BTLEN-10, lostbms[i].ctitle, IDLEN,IDLEN, - lostbms[i].bmname,lostbms[i].lostdays); - }else{ - fprintf(inf, "%-*.*s%-*.*s%-*.*s%3d¤Ñ¨S¤W¯¸\n", IDLEN, IDLEN, lostbms[i].title, - BTLEN-10, BTLEN-10, lostbms[i].ctitle, IDLEN,IDLEN, - lostbms[i].bmname,lostbms[i].lostdays); - } - } - fclose(inf); - fclose(firef); - - //printf("Total %d boards.\n", count); - - //mail to the users - for( i=0; i<j; i++) - { - fileheader_t mymail; - char genbuf[200]; - int lostdays; - - lostdays = lostbms[i].lostdays; - - if( (lostdays != 30) && (lostdays != 45) && (lostdays <= 60)) - continue; - - sprintf(genbuf, BBSHOME "/home/%c/%s", lostbms[i].bmname[0], lostbms[i].bmname); - stampfile(genbuf, &mymail); - - strcpy(mymail.owner, "[PTTĵ¹î§½]"); - - if(lostdays <= 60){ - sprintf(mymail.title, - "\033[32m [ª©¥D§K¾ĵ§i³qª¾] \033[m %s BM %s", lostbms[i].title, lostbms[i].bmname); - }else{ - sprintf(mymail.title, - "\033[32m [ª©¥D§K¾³qª¾] \033[m %s BM %s", lostbms[i].title, lostbms[i].bmname); - } - mymail.savemode = 0 ; - unlink(genbuf); - if(lostdays <= 60){ - LINK(OUTFILE, genbuf); - }else{ - LINK(FIREFILE, genbuf); - } - - sprintf(genbuf, BBSHOME "/home/%c/%s/.DIR", lostbms[i].bmname[0], lostbms[i].bmname); - append_record(genbuf, &mymail, sizeof(mymail)); - } -*/ - return 0; -} |