diff options
Diffstat (limited to 'not-maintained')
43 files changed, 0 insertions, 2340 deletions
diff --git a/not-maintained/ColaBBS_to_PttBBS/README b/not-maintained/ColaBBS_to_PttBBS/README deleted file mode 100644 index 1002e489..00000000 --- a/not-maintained/ColaBBS_to_PttBBS/README +++ /dev/null @@ -1,40 +0,0 @@ -There're some tools for transfering data from ColaBBS -(http://lh.twbbs.org/) to PttBBS (http://ptt.cc). Since ColaBBS -doesn't provide its source code or any file spec, there's no shortcut -for this. I hacked the data structures with only VERY LITTLE -information directly from files, and these may NOT work. You sould NOT -use if you don't have programming background, or contact(make an -offer?) me in2 _AT_ in2home.org. -the Id of this file is $Id$ . - -please follow the step: -1. backup your ColaBBS. -2. install a new PttBBS - (see https://opensvn.csie.org/pttbbs/trunk/pttbbs/docs/INSTALL for - details) - please do NOT do the following to a existed bbs! -3. shutdown the bbs and clean all shared-memory if it's running. -4. copy all .c and .pl programs into your ~bbs/pttbbs/util/. then - compile them: `make cntDIR cntbrd cnthomeDIR cntpasswd` -5. transfer boards: - cd _COLABBS_/boards/; \ - perl -e "system('mv $_ ~/boards/'. - substr($_, 0, 1).'/'.$_) foreach( <*> )" - - cd /home/bbs/boards; perl cntarticle.pl boards/*/*; \ - apply "mv %1/.DIR %1/.DIR.colabbs; cntDIR < %1/.DIR.colabbs > - %1/.DIR" */* - cntbrd < _COLABBS_/boards/.BOARDS > ~/.BRD -6. transfer mails - cd _COLABBS_/home; cnthomedir.pl - cd ~/home/; - apply "mv %1/mail/* %1/" */*; \ - apply "mv %1/mail/.DIR %1/.DIR.colabbs" */*; \ - apply "rmdir %1/mail" */*; \ - apply "cnthomeDIR < %1/.DIR.colabbs > %1/.DIR" */* ; \ - cntarticle.pl */* -7. transfer password file: - cntpasswd home/*/*/USERDATA.DAT > ~/.PASSWDS; \ - tunepasswd -8. tranfer man - use cntDIR to convert .DIR and cntarticle.pl for articles. diff --git a/not-maintained/ColaBBS_to_PttBBS/cntDIR.c b/not-maintained/ColaBBS_to_PttBBS/cntDIR.c deleted file mode 100644 index bdbbe340..00000000 --- a/not-maintained/ColaBBS_to_PttBBS/cntDIR.c +++ /dev/null @@ -1,41 +0,0 @@ -/* $Id$ */ -#include "bbs.h" -/* - usage: apply "mv %1/.DIR %1/.DIR.colabbs; - ./cntDIR < %1/.DIR.colabbs > %1/.DIR; - rm %1/.DIR.colabbs" - ~/boards/ * / * - ^ ^ ^ <- please ignore the spaces -*/ - -typedef struct { - char filename[FNLEN]; /* M.9876543210.A */ - char pad0[80-FNLEN]; - char owner[IDLEN + 2]; /* uid[.] */ - char pad1[66]; - char title[65]; - char pad2[31]; -} ffh_t; -int main(int argc, char **argv) -{ - ffh_t ffh; - fileheader_t fh; - - time_t t; - struct tm *tm; - - memset(&fh, 0, sizeof(fh)); - while( read(0, &ffh, sizeof(ffh)) == sizeof(ffh) ){ - if( !ffh.filename[0] ) - continue; - strlcpy(fh.filename, ffh.filename, sizeof(fh.filename)); - strlcpy(fh.title, ffh.title, sizeof(fh.title)); - strlcpy(fh.owner, ffh.owner, sizeof(fh.owner)); - - t = atoi(&fh.filename[2]); - tm = localtime(&t); - sprintf(fh.date, "%2d/%02d", tm->tm_mon + 1, tm->tm_mday); - write(1, &fh, sizeof(fh)); - } - return 0; -} diff --git a/not-maintained/ColaBBS_to_PttBBS/cntarticle.pl b/not-maintained/ColaBBS_to_PttBBS/cntarticle.pl deleted file mode 100644 index 649aff00..00000000 --- a/not-maintained/ColaBBS_to_PttBBS/cntarticle.pl +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/perl -# $Id$ -use IO::All; -die "usage: cntarticle.pl [base dir]" - if( !@ARGV ); - -@proc = @ARGV; -while( $dir = pop @proc ){ - print "converting: $dir\n"; - while( <$dir/*> ){ - next if( /^\./ ); - if( -d $_ ){ - push @proc, $_; - } elsif( /M\..*\.A/ ){ - convert($_); - } - } -} - -sub convert -{ - my($fn) = @_; - $content < io($fn); - $content =~ s/\r//gs; - $content =~ s/^.*?m 作者 .*?m (.*\))\s+\S+? 信區 .*?m (\S+).*/作者: $1 看板: $2/m; - $content =~ s/^.*?m 作者 .*?m (.*\))/作者: $1/m; - $content =~ s/^.*?m 標題 .*?m (.*?)\s+\S+m/標題: $1/m; - $content =~ s/^.*?m 時間 .*?m (.*?)\s+\S+m/時間: $1/m; - $content =~ s/^\e\[36m────────────────────────────────────────\e\[m\n//m; - "$content\n" > io($fn); -} diff --git a/not-maintained/ColaBBS_to_PttBBS/cntbrd.c b/not-maintained/ColaBBS_to_PttBBS/cntbrd.c deleted file mode 100644 index 946018e7..00000000 --- a/not-maintained/ColaBBS_to_PttBBS/cntbrd.c +++ /dev/null @@ -1,115 +0,0 @@ -/* $Id$ */ -#include "bbs.h" -/* usage: ./cntbrd < ColaBBS/.BOARDS > ~/.BRD */ - -typedef struct { - char brdname[13]; - char pad[148]; - char title[49]; - char pad2[46]; -} fbrd_t; - -int main(int argc, char **argv) -{ - fbrd_t fbh; - boardheader_t bh; -#if 0 - int i; - read(0, &fbh, sizeof(fbh)); - for( i = 0 ; i < sizeof(fbh) ; ++i ) - printf("%03d: %d(%c)\n", i, fbh.pad[i], fbh.pad[i]); - return 0; -#endif - - memset(&bh, 0, sizeof(bh)); - strcpy(bh.brdname, "SYSOP"); - strcpy(bh.title, "嘰哩 ◎站長好!"); - bh.brdattr = BRD_POSTMASK | BRD_NOTRAN | BRD_NOZAP; - bh.level = 0; - bh.gid = 2; - write(1, &bh, sizeof(bh)); - - strcpy(bh.brdname, "1..........."); - strcpy(bh.title, ".... Σ中央政府 《高壓危險,非人可敵》"); - bh.brdattr = BRD_GROUPBOARD; - bh.level = PERM_SYSOP; - bh.gid = 1; - write(1, &bh, sizeof(bh)); - - strcpy(bh.brdname, "junk"); - strcpy(bh.title, "發電 ◎雜七雜八的垃圾"); - bh.brdattr = BRD_NOTRAN; - bh.level = PERM_SYSOP; - bh.gid = 2; - write(1, &bh, sizeof(bh)); - - strcpy(bh.brdname, "Security"); - strcpy(bh.title, "發電 ◎站內系統安全"); - bh.brdattr = BRD_NOTRAN; - bh.level = PERM_SYSOP; - bh.gid = 2; - write(1, &bh, sizeof(bh)); - - strcpy(bh.brdname, "2..........."); - strcpy(bh.title, ".... Σ市民廣場 報告 站長 ㄜ!"); - bh.brdattr = BRD_GROUPBOARD; - bh.level = 0; - bh.gid = 1; - write(1, &bh, sizeof(bh)); - - strcpy(bh.brdname, "ALLPOST"); - strcpy(bh.title, "嘰哩 ◎跨板式LOCAL新文章"); - bh.brdattr = BRD_POSTMASK | BRD_NOTRAN; - bh.level = PERM_SYSOP; - bh.gid = 5; - write(1, &bh, sizeof(bh)); - - strcpy(bh.brdname, "deleted"); - strcpy(bh.title, "嘰哩 ◎資源回收筒"); - bh.brdattr = BRD_NOTRAN; - bh.level = PERM_BM; - bh.gid = 5; - write(1, &bh, sizeof(bh)); - - strcpy(bh.brdname, "Note"); - strcpy(bh.title, "嘰哩 ◎動態看板及歌曲投稿"); - bh.brdattr = BRD_NOTRAN; - bh.level = 0; - bh.gid = 5; - write(1, &bh, sizeof(bh)); - - strcpy(bh.brdname, "Record"); - strcpy(bh.title, "嘰哩 ◎我們的成果"); - bh.brdattr = BRD_NOTRAN | BRD_POSTMASK; - bh.level = 0; - bh.gid = 5; - write(1, &bh, sizeof(bh)); - - strcpy(bh.brdname, "WhoAmI"); - strcpy(bh.title, "嘰哩 ◎呵呵,猜猜我是誰!"); - bh.brdattr = BRD_NOTRAN; - bh.level = 0; - bh.gid = 5; - write(1, &bh, sizeof(bh)); - - strcpy(bh.brdname, "EditExp"); - strcpy(bh.title, "嘰哩 ◎範本精靈投稿區"); - bh.brdattr = BRD_NOTRAN; - bh.level = 0; - bh.gid = 5; - write(1, &bh, sizeof(bh)); - - while( read(0, &fbh, sizeof(fbh)) == sizeof(fbh) ){ - if( !fbh.brdname[0] || strcasecmp(fbh.brdname, "sysop") == 0 ) - continue; - memset(&bh, 0, sizeof(bh)); - strlcpy(bh.brdname, fbh.brdname, sizeof(bh.brdname)); - strlcpy(bh.title, "轉換 ◎", sizeof(bh.title)); - strlcpy(&bh.title[7], fbh.title, sizeof(bh.title)); - bh.brdattr = BRD_NOTRAN; - bh.level = 0; - bh.gid = 2; - write(1, &bh, sizeof(bh)); - } - return 0; -} diff --git a/not-maintained/ColaBBS_to_PttBBS/cnthomeDIR.c b/not-maintained/ColaBBS_to_PttBBS/cnthomeDIR.c deleted file mode 100644 index a94cac6e..00000000 --- a/not-maintained/ColaBBS_to_PttBBS/cnthomeDIR.c +++ /dev/null @@ -1,46 +0,0 @@ -/* $Id$ */ -#include "bbs.h" -/* please run cnthomedir.pl first! - cd home/; apply "mv %1/mail/* %1/" * / * - apply "mv %1/mail/.DIR %1/.DIR.colabbs" * / * - apply "rmdir %1/mail" * / * - apply "cnthomeDIR < %1/.DIR.colabbs > %1/.DIR" * / * -*/ - -typedef struct { - char filename[FNLEN]; /* M.9876543210.A */ - char pad0[80-FNLEN]; - char owner[IDLEN + 2]; /* uid[.] */ - char pad1[66]; - char title[65]; - char pad2[31]; -} ffh_t; -int main(int argc, char **argv) -{ - ffh_t ffh; - fileheader_t fh; - - time_t t; - struct tm *tm; - int i; - - memset(&fh, 0, sizeof(fh)); - while( read(0, &ffh, sizeof(ffh)) == sizeof(ffh) ){ - if( !ffh.filename[0] ) - continue; - strlcpy(fh.filename, ffh.filename, sizeof(fh.filename)); - strlcpy(fh.title, ffh.title, sizeof(fh.title)); - strlcpy(fh.owner, ffh.owner, sizeof(fh.owner)); - for( i = 0 ; i < sizeof(fh.owner) ; ++i ) - if( fh.owner[i] == ' ' ){ - fh.owner[i] = 0; - break; - } - - t = atoi(&fh.filename[2]); - tm = localtime(&t); - sprintf(fh.date, "%2d/%02d", tm->tm_mon + 1, tm->tm_mday); - write(1, &fh, sizeof(fh)); - } - return 0; -} diff --git a/not-maintained/ColaBBS_to_PttBBS/cnthomedir.pl b/not-maintained/ColaBBS_to_PttBBS/cnthomedir.pl deleted file mode 100644 index 64695a21..00000000 --- a/not-maintained/ColaBBS_to_PttBBS/cnthomedir.pl +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/perl -# $Id$ -# usage: cd ColaBBS/home; perl cnthomedir.pl -use IO::All; -`mkdir -p ~/home/$_` foreach( 'a'..'z', 'A'..'Z' ); - -foreach( <*> ){ - next if( !-d $_ || /\./ || /^[A-Za-z]$/ ); - $USERDATA < io("$_/USERDATA.DAT"); - ($userid) = $USERDATA =~ /^(\w+)/; - $c = substr($userid, 0, 1); - - `mv ~/home/$c/$userid ~/tmp/; mv $_ ~/home/$c/$userid`; - print "$_ => $userid\n"; -} diff --git a/not-maintained/ColaBBS_to_PttBBS/cntmail.pl b/not-maintained/ColaBBS_to_PttBBS/cntmail.pl deleted file mode 100644 index bb67f49a..00000000 --- a/not-maintained/ColaBBS_to_PttBBS/cntmail.pl +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/perl -# $Id$ -use IO::All; -die "usage: cntarticle.pl [base dir]" - if( !@ARGV ); - -foreach( @ARGV ){ - print "converting: $_\n"; - convert($_) - foreach( <$_/M.*.A> ); -} - -sub convert -{ - my($fn) = @_; - $content < io($fn); - $content =~ s/\r//gs; - $content =~ s/\^R//gs; - $content =~ s/^.*?m 作者 .*?m (.*\))\s+$/作者: $1/m; - $content =~ s/^.*?m 標題 .*?m (.*?)\s+\S+m/標題: $1/m; - $content =~ s/^.*?m 時間 .*?m (.*?)\s+\S+m/時間: $1/m; - $content =~ s/^\e\[36m────────────────────────────────────────\e\[m\n//m; - "$content\n" > io($fn); -} diff --git a/not-maintained/ColaBBS_to_PttBBS/cntpasswd.c b/not-maintained/ColaBBS_to_PttBBS/cntpasswd.c deleted file mode 100644 index 40a97ac1..00000000 --- a/not-maintained/ColaBBS_to_PttBBS/cntpasswd.c +++ /dev/null @@ -1,35 +0,0 @@ -/* $Id$ */ -#include "bbs.h" -// usage: cd home/; cntpasswd */*/USERDATA.DAT > ~/.PASSWDS ; tunepasswd - -typedef struct { - char userid[IDLEN + 1]; - char pad0[1]; - char passwd[PASSLEN]; - char nick[24]; - char pad1[16]; - char name[20]; - char pad2[424]; -} fuserect_t; - -int main(int argc, char **argv) -{ - fuserect_t fu; - userec_t u; - int fd, i; - - for( i = 1 ; i < argc ; ++i ){ - if( (fd = open(argv[i], O_RDONLY)) > 0 && - read(fd, &fu, sizeof(fu)) == sizeof(fu) && - fu.userid[0] ){ - - memset(&u, 0, sizeof(u)); - strlcpy(u.userid, fu.userid, sizeof(u.userid)); - strlcpy(u.passwd, fu.passwd, sizeof(u.passwd)); - strlcpy(u.realname, fu.name, sizeof(u.realname)); - strlcpy(u.username, fu.nick, sizeof(u.username)); - write(1, &u, sizeof(u)); - } - } - return 0; -} diff --git a/not-maintained/mbbsd.icc/.cvsignore b/not-maintained/mbbsd.icc/.cvsignore deleted file mode 100644 index 7eaf2809..00000000 --- a/not-maintained/mbbsd.icc/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -*.o -mbbsd.icc -*.il diff --git a/not-maintained/mbbsd.icc/Makefile b/not-maintained/mbbsd.icc/Makefile deleted file mode 100644 index bbbe1a7a..00000000 --- a/not-maintained/mbbsd.icc/Makefile +++ /dev/null @@ -1,72 +0,0 @@ -.PATH: ../mbbsd - -BBSHOME=/home/bbs -PROG= mbbsd.icc -OBJS= admin.o announce.o args.o bbs.o board.o cache.o cal.o card.o\ - chat.o chc_draw.o chc_net.o chc_play.o chc_rule.o chicken.o dark.o\ - edit.o friend.o gamble.o gomo.o gomo1.o guess.o indict.o io.o\ - kaede.o lovepaper.o mail.o mbbsd.o menu.o more.o name.o osdep.o\ - othello.o page.o read.o record.o register.o screen.o stuff.o\ - talk.o term.o topsong.o user.o vice.o vote.o xyz.o\ - voteboard.o syspost.o var.o toolkit.o passwd.o\ - calendar.o - -ICCFLAGS= -O -march=pentiumiii -Ob2 -tpp6 -mcpu=pentiumpro -march=pentiumiii \ - -ipo -ipo_obj -GCCFLAGS= -O -march=pentium3 - -CFLAGS= -DHAVE_SETPROCTITLE -DBBSHOME='"$(BBSHOME)"' -DFreeBSD -I../include -LDFLAGS= -lutil -lkvm -lcrypt - -.if defined(GDB) || defined(DEBUG) -CFLAGS+= -g -FDFLAGS+= -g -.else -CFLAGS+= -O -LDFLAGS+= -O -.endif - -.if defined(DEBUG) -CFLAGS+= -DDEBUG -LDFLAGS+= -DDEBUG -.endif - -.if defined(NO_FORK) -CFLAGS+= -DNO_FORK -.endif - -CFLAGS+= "-DCOMPILE_TIME=\"`date`\"" -GCCUSE=gcc -pipe -Wall $(CFLAGS) -c - -.SUFFIXES: .c .o -.c.o: ../include/var.h - icc -D__FreeBSD__ -D__FreeBSD $(CFLAGS) $(ICCFLAGS) -c ../mbbsd/$*.c - -all: $(PROG) - -$(PROG): $(OBJS) - icc $(LDFLAGS) $(ICCFLAGS) -o $(PROG) $(OBJS) - -../include/var.h: var.c - perl ../util/parsevar.pl < ../mbbsd/var.c > ../include/var.h - -cache.o: cache.c - $(GCCUSE) $(GCCFLAGS) ../mbbsd/$*.c - -topsong.o: topsong.c - $(GCCUSE) $(GCCFLAGS) ../mbbsd/$*.c - -install: $(PROG) - install -d $(BBSHOME)/bin/ - install -c -m 755 $(PROG) $(BBSHOME)/bin/ - rm -f $(BBSHOME)/bin/mbbsd - ln -sv $(BBSHOME)/bin/$(PROG) $(BBSHOME)/bin/mbbsd - -test: $(PROG) - killall -9 testmbbsd || true - cp $(PROG) testmbbsd - ./testmbbsd 9000 - rm -f testmbbsd - -clean: - rm -f $(OBJS) $(PROG) diff --git a/not-maintained/pttpi/README b/not-maintained/pttpi/README deleted file mode 100644 index 8f60ff6c..00000000 --- a/not-maintained/pttpi/README +++ /dev/null @@ -1,4 +0,0 @@ -PTT Programming Interface - -這目前還是一個實驗性的東西, -它還不穩定, 沒有效率, 沒有經過完整測試, 並且 spec 還在編修中. diff --git a/not-maintained/pttpi/cgi/Makefile b/not-maintained/pttpi/cgi/Makefile deleted file mode 100644 index 42613de3..00000000 --- a/not-maintained/pttpi/cgi/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# $Id: Makefile,v 1.1 2003/05/19 01:33:00 in2 Exp $ - -.include "../../pttbbs.mk" - -CFLAGS+= -I../../include `xmlrpc-c-config cgi-server --cflags` -LDFLAGS+= `xmlrpc-c-config cgi-server --libs` - -UTIL_OBJS= \ - ../../util/util_cache.o ../../util/util_record.o ../../util/util_passwd.o -all: pttpi.cgi - -pttpi.cgi: pttpi.c - $(CC) $(CFLAGS) $(LDFLAGS) -o pttpi.cgi pttpi.c $(UTIL_OBJS) - -clean: - rm -f *.cgi *~ diff --git a/not-maintained/pttpi/cgi/pttpi.c b/not-maintained/pttpi/cgi/pttpi.c deleted file mode 100644 index 1e452f68..00000000 --- a/not-maintained/pttpi/cgi/pttpi.c +++ /dev/null @@ -1,249 +0,0 @@ -/* $Id: pttpi.c,v 1.5 2003/05/19 05:15:36 in2 Exp $ */ -#include "bbs.h" -#include "pierr.h" -#include <xmlrpc.h> -#include <xmlrpc_cgi.h> - -extern SHM_t *SHM; -typedef xmlrpc_int32 int32; - -#define errorexit() if( env->fault_occurred ) return NULL -int check_board_and_permission(int bid) -{ - return (bid < 0 || bid > MAX_BOARD || - !bcache[bid].brdname[0] || - (bcache[bid].brdattr & BRD_HIDE) || - (bcache[bid].level && !(bcache[bid].brdattr & BRD_POSTMASK) && - (bcache[bid].level & - ~(PERM_BASIC|PERM_CHAT|PERM_PAGE|PERM_POST|PERM_LOGINOK)))); -} - -#define check_bp_return(bid) \ - if( check_board_and_permission(bid) ) \ - return xmlrpc_build_value(env, "{s:i}", \ - "errno", PIERR_NOBRD); - -#define errorreturn(returncode) \ - return xmlrpc_build_value(env, "{s:i}", \ - "errno", returncode) - -xmlrpc_value * -getBid(xmlrpc_env *env, xmlrpc_value *param_array, void *user_data) -{ - /* !!! overwrite util_cache.c !!! */ - char *brdname; - int bid; - - xmlrpc_parse_value(env, param_array, "(s)", &brdname); - errorexit(); - - bid = getbnum(brdname); - return xmlrpc_build_value(env, "{s:i,s:s,s:i}", - "errno", (bid == -1 ? PIERR_NOBRD : PIERR_OK), - "brdname", brdname, - "bid", (int32)bid); -} - -xmlrpc_value * -getBrdInfo(xmlrpc_env *env, xmlrpc_value *param_array, void *user_data) -{ - int32 bid; - - xmlrpc_parse_value(env, param_array, "(i)", &bid); - errorexit(); - check_bp_return(bid); - - return xmlrpc_build_value(env, "{s:i,s:s,s:i,s:6,s:6,s:i}", - "errno", PIERR_OK, - "brdname", bcache[bid].brdname, - "bid", (int32)bid, - "title", bcache[bid].title, strlen(bcache[bid].title), - "BM", bcache[bid].BM, strlen(bcache[bid].BM), - "nuser", bcache[bid].nuser); -} - -char *getpath(int bid, char *fn) -{ - static char fpath[MAXPATHLEN]; - if( fn == NULL ) - fn = ""; - snprintf(fpath, sizeof(fpath), "boards/%c/%s/%s", - bcache[bid].brdname[0], bcache[bid].brdname, fn); - return fpath; -} - -int getfilesize(int bid, char *fn, int *fd) -{ - struct stat sb; - if( fd == NULL ){ - if( stat(getpath(bid, fn), &sb) < 0 ) - return -1; - } - else { - if( (*fd = open(getpath(bid, fn), O_RDONLY)) < 0 ) - return -1; - if( fstat(*fd, &sb) < 0 ){ - close(*fd); - return -1; - } - } - return sb.st_size; -} - -xmlrpc_value * -getNarticle(xmlrpc_env *env, xmlrpc_value *param_array, void *user_data) -{ - int bid, nas; - - xmlrpc_parse_value(env, param_array, "(i)", &bid); - errorexit(); - check_bp_return(bid); - nas = getfilesize(bid, ".DIR", NULL); - - return xmlrpc_build_value(env, "{s:i,s:i}", - "errno", (nas == -1 ? PIERR_INT : PIERR_OK), - "narticle", nas / sizeof(fileheader_t)); -} - -xmlrpc_value * -class_list(xmlrpc_env *env, xmlrpc_value *param_array, void *user_data) -{ - int bid; - boardheader_t *bptr; - xmlrpc_value *ret, *t; - - xmlrpc_parse_value(env, param_array, "(i)", &bid); - errorexit(); - - if( bid != 0 ) - check_bp_return(bid); - - if( bid != 0 && !(bcache[bid].brdattr & BRD_GROUPBOARD) ) - errorreturn(PIERR_NOTCLASS); - - ret = xmlrpc_build_value(env, "()"); - for( bptr = bcache[bid].firstchild[0] ; - bptr != (boardheader_t*)~0 ; - bptr = bptr->next[0] ){ - if( check_board_and_permission(bptr - bcache) ) - continue; - t = xmlrpc_build_value(env, "{s:i,s:s,s:6,s:i,s:6,s:i,s:b}", - "bid", (int32)(bptr - bcache), - "brdname", bptr->brdname, - "title", bptr->title + 5, strlen(bptr->title) - 5, - "gid", bptr->gid, - "BM", bptr->BM, strlen(bptr->BM), - "nuser", (int32)bptr->nuser, - "isclass", (xmlrpc_bool) - (bptr->brdattr & BRD_GROUPBOARD) ? 1 : 0 - ); - xmlrpc_array_append_item(env, ret, t); - } - return ret; -} - -xmlrpc_value * -article_list(xmlrpc_env *env, xmlrpc_value *param_array, void *user_data) -{ -#define MAXGETARTICLES 20 - xmlrpc_value *ret, *t; - fileheader_t art[MAXGETARTICLES]; - int32 bid, from, nArticles, fd, nGets, i; - - xmlrpc_parse_value(env, param_array, "(ii)", &bid, &from); - errorexit(); - check_bp_return(bid); - - if( (nArticles = getfilesize(bid, ".DIR", &fd)) < 0 ) - errorreturn(PIERR_INT); - nArticles /= sizeof(fileheader_t); - - if( from < 0 ) - from += nArticles; - if( from < 0 || from > nArticles ){ - close(fd); - errorreturn(PIERR_NOMORE); - } - - nGets = (((from + MAXGETARTICLES) < nArticles) ? - MAXGETARTICLES : (nArticles - from)); - if( (nGets = read(fd, art, nGets * sizeof(fileheader_t))) < 0 ){ - close(fd); - errorreturn(PIERR_INT); - } - close(fd); - nGets /= sizeof(fileheader_t); - - ret = xmlrpc_build_value(env, "()"); - for( i = 0 ; i < nGets ; ++i ){ - t = xmlrpc_build_value(env, "{s:i,s:s,s:i,s:s,s:s,s:6}", - "articleid", (int32)(from + i), - "filename", art[i].filename, - "recommend", (int32)art[i].recommend, - "owner", art[i].owner, - "date", art[i].date, - "title", art[i].title, strlen(art[i].title) - ); - xmlrpc_array_append_item(env, ret, t); - } - return ret; -} - -xmlrpc_value * -_article_readfn(xmlrpc_env *env, int bid, char *fn) -{ - char *content; - int fd, size; - xmlrpc_value *ret; - if( (size = getfilesize(bid, fn, &fd)) < 0 ) - errorreturn(PIERR_INT); - - content = (char *)malloc(sizeof(char) * size); - read(fd, content, size); - close(fd); - ret = xmlrpc_build_value(env, "{s:6}", "content", content, size); - free(content); - - return ret; -} - -xmlrpc_value * -article_readfn(xmlrpc_env *env, xmlrpc_value *param_array, void *user_data) -{ - int bid; - char *fn; - - xmlrpc_parse_value(env, param_array, "(is)", &bid, &fn); - errorexit(); - - if( fn == NULL || (fn[0] != 'M' && fn[0] != 'G') || fn[1] != '.' ) - errorreturn(PIERR_NOBRD); - check_bp_return(bid); - - return _article_readfn(env, bid, fn); -} - -int main(int argc, char **argv) -{ - attach_SHM(); - chdir(BBSHOME); - xmlrpc_cgi_init(XMLRPC_CGI_NO_FLAGS); - xmlrpc_cgi_add_method_w_doc("board.getBid", &getBid, NULL, "?", - "get bid from brdname"); - xmlrpc_cgi_add_method_w_doc("board.getBrdInfo", &getBrdInfo, NULL, "?", - "get board information"); - xmlrpc_cgi_add_method_w_doc("board.getNarticle", &getNarticle, NULL, "?", - "get # articles in the board"); - - xmlrpc_cgi_add_method_w_doc("class.list", &class_list, NULL, "?", - "list (C)lass"); - - xmlrpc_cgi_add_method_w_doc("article.list", &article_list, NULL, "?", - "article list"); - xmlrpc_cgi_add_method_w_doc("article.readfn", &article_readfn, NULL, "?", - "read the article by filename"); - - xmlrpc_cgi_process_call(); - xmlrpc_cgi_cleanup(); - return 0; -} diff --git a/not-maintained/pttpi/cgi/t/.cvsignore b/not-maintained/pttpi/cgi/t/.cvsignore deleted file mode 100644 index 9f20a79c..00000000 --- a/not-maintained/pttpi/cgi/t/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -host.pl diff --git a/not-maintained/pttpi/cgi/t/article.list.pl b/not-maintained/pttpi/cgi/t/article.list.pl deleted file mode 100644 index 27370aa1..00000000 --- a/not-maintained/pttpi/cgi/t/article.list.pl +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/perl -# $Id: article.list.pl,v 1.1 2003/05/19 02:04:14 in2 Exp $ -use Frontier::Client; -use Frontier::RPC2; -use MIME::Base64; -use Data::Dumper; -do 'host.pl'; - -$bid = $ARGV[0] || 0; - -$server = Frontier::Client->new(url => $server_url); -$result = $server->call('article.list', - $bid, # bid - 0); # from # article - -print Dumper($result); diff --git a/not-maintained/pttpi/cgi/t/article.readfn.pl b/not-maintained/pttpi/cgi/t/article.readfn.pl deleted file mode 100644 index e2d0bc27..00000000 --- a/not-maintained/pttpi/cgi/t/article.readfn.pl +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/perl -# $Id: article.readfn.pl,v 1.1 2003/05/19 02:06:34 in2 Exp $ -use Frontier::Client; -use Frontier::RPC2; -use MIME::Base64; -use Data::Dumper; -do 'host.pl'; - -$bid = $ARGV[0] || 0; -$fn = $ARGV[1] || 'M.1047292518.A.48E'; - -$server = Frontier::Client->new(url => $server_url); -$result = $server->call('article.readfn', $bid, $fn); - -print decode_base64($result->{content}->value()); diff --git a/not-maintained/pttpi/cgi/t/board.getBid.pl b/not-maintained/pttpi/cgi/t/board.getBid.pl deleted file mode 100644 index a628da4e..00000000 --- a/not-maintained/pttpi/cgi/t/board.getBid.pl +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/perl -# $Id: board.getBid.pl,v 1.1 2003/05/19 01:57:22 in2 Exp $ -use Frontier::Client; -use Data::Dumper; -do 'host.pl'; - -$brdname = $ARGV[0] || 'SYSOP'; -$server = Frontier::Client->new(url => $server_url); -$result = $server->call('board.getBid', $brdname); - -print "board.getBid($brdname) from $server_url:\n"; -print Dumper($result); diff --git a/not-maintained/pttpi/cgi/t/board.getBrdInfo.pl b/not-maintained/pttpi/cgi/t/board.getBrdInfo.pl deleted file mode 100644 index 7870e386..00000000 --- a/not-maintained/pttpi/cgi/t/board.getBrdInfo.pl +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/perl -# $Id: board.getBrdInfo.pl,v 1.1 2003/05/19 01:58:27 in2 Exp $ -use Frontier::Client; -use Frontier::RPC2; -use MIME::Base64; -use Data::Dumper; -do 'host.pl'; - -$bid = $ARGV[0] || 0; - -$server = Frontier::Client->new(url => $server_url); -$result = $server->call('board.getBrdInfo', $bid); - -print Dumper($result); -print decode_base64($result->{title}->value()); diff --git a/not-maintained/pttpi/cgi/t/board.getNarticle.pl b/not-maintained/pttpi/cgi/t/board.getNarticle.pl deleted file mode 100644 index a5fb56a1..00000000 --- a/not-maintained/pttpi/cgi/t/board.getNarticle.pl +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/perl -# $Id: board.getNarticle.pl,v 1.1 2003/05/19 02:01:15 in2 Exp $ -use Frontier::Client; -use Frontier::RPC2; -use MIME::Base64; -use Data::Dumper; -do 'host.pl'; - -$bid = $ARGV[0] || 0; - -$server = Frontier::Client->new(url => $server_url); -$result = $server->call('board.getNarticle', $bid); - -print Dumper($result); diff --git a/not-maintained/pttpi/cgi/t/class.list.pl b/not-maintained/pttpi/cgi/t/class.list.pl deleted file mode 100644 index 9e10932b..00000000 --- a/not-maintained/pttpi/cgi/t/class.list.pl +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/perl -# $Id: class.list.pl,v 1.1 2003/05/19 02:02:52 in2 Exp $ -use Frontier::Client; -use Frontier::RPC2; -use MIME::Base64; -use Data::Dumper; -do 'host.pl'; - -$bid = $ARGV[0] || 0; - -$server = Frontier::Client->new(url => $server_url); -$result = $server->call('class.list', $bid); - -print Dumper($result); diff --git a/not-maintained/pttpi/cgi/t/host.pl.sample b/not-maintained/pttpi/cgi/t/host.pl.sample deleted file mode 100644 index 72669230..00000000 --- a/not-maintained/pttpi/cgi/t/host.pl.sample +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/perl -$server_url = 'http://host_to_pttpi/path_to_pttpi/pttpi.cgi' diff --git a/not-maintained/pttpi/doc/spec b/not-maintained/pttpi/doc/spec deleted file mode 100644 index e1460030..00000000 --- a/not-maintained/pttpi/doc/spec +++ /dev/null @@ -1,50 +0,0 @@ -board.getBid get bid from board name -input (s) - (board name) -output ({s:i, s:s, s:i}) - {errno => errno, - brdname => boardname, - bid => boardid} (bid = -1 if error) - - -board.getBrdInfo -get board information (by bid) -input (i) - (bid) -output ({s:i,s:s,s:i,s:6,s:6,s:i}) - {errno => errno, - brdname => boardname - bid => bid, - title => title (Base64), - BM => board manager(s) (Base64), - nuser => #users in this board, - } - -board.getNarticle -get # articles in the board -input (i) - (bid) -output ({s:i, s:s, s:i}) - {errno => errno, - narticle => #articles in the board} - -article.list -get article list of bid -input (ii) - (bid, from # article) -output: ({s:i,s:s,s:i,s:s,s:s,s:6}...) - [{articleid => article id, - filename => file name, - recommend => recommend, - owner => owner's userid, - date => date (format: mm/dd), - title => article title (Base64)}, - {...},...] - -article.readfn -read article by bid and filename -input (is) - (bid, filename) -output ({s:6}) - {content => content} - diff --git a/not-maintained/pttpi/include/pierr.h b/not-maintained/pttpi/include/pierr.h deleted file mode 100644 index da462a36..00000000 --- a/not-maintained/pttpi/include/pierr.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _PIERR_H_ -#define _PIERR_H_ - -#define PIERR_OK (int32)0 /* no error */ -#define PIERR_INT (int32)1 /* internal error (ex: syscall failure) */ -#define PIERR_NOBRD (int32)2 /* no such board or permission denied */ -#define PIERR_NOMORE (int32)3 /* no more data */ -#define PIERR_NOTCLASS (int32)4 /* this bid is NOT class */ -#endif diff --git a/not-maintained/web/.cvsignore b/not-maintained/web/.cvsignore deleted file mode 100644 index 33ec1741..00000000 --- a/not-maintained/web/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -*.o -*.so -*.a diff --git a/not-maintained/web/Makefile b/not-maintained/web/Makefile deleted file mode 100644 index 095610b3..00000000 --- a/not-maintained/web/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -all: mod_ptt.c mod_ptt.h - apxs -I ../include -c mod_ptt.c ../util/util_cache.c ../util/util_passwd.c ../util/util_record.c - cp mod_ptt.so /usr/local/libexec/apache/mod_ptt.so - chmod 775 /usr/local/libexec/apache/mod_ptt.so -clean: - rm -f *.o *.a *.so diff --git a/not-maintained/web/Makefile.old b/not-maintained/web/Makefile.old deleted file mode 100644 index db2735bf..00000000 --- a/not-maintained/web/Makefile.old +++ /dev/null @@ -1,120 +0,0 @@ -## -## Apache Makefile, automatically generated by Configure script. -## Hand-edited changes will be lost if the Configure script is re-run. -## Sources: - ../../Makefile.config (via Configuration) -## - ./Makefile.tmpl -## - -## -## Inherited Makefile options from Configure script -## (Begin of automatically generated section) -## -SRCDIR=../.. -EXTRA_CFLAGS= -EXTRA_LDFLAGS= -EXTRA_LIBS= -EXTRA_INCLUDES= -EXTRA_DEPS= -OSDIR=$(SRCDIR)/os/unix -INCDIR=$(SRCDIR)/include -INCLUDES0=-I$(OSDIR) -I$(INCDIR) -I../$(INCDIR) -SHELL=/bin/sh -OS=FreeBSD 4.6 -CC=gcc -CPP=gcc -E -TARGET=httpd -OPTIM= -CFLAGS1= -funsigned-char -DUSE_EXPAT -I$(SRCDIR)/lib/expat-lite -DNO_DL_NEEDED -INCLUDES1= -LIBS_SHLIB= -LDFLAGS1= -MFLAGS_STATIC= -REGLIB= -EXPATLIB=lib/expat-lite/libexpat.a -RANLIB=ranlib -LIBS1= -lcrypt -## -## (End of automatically generated section) -## - -## -## Default Makefile options from Configure script -## (Begin of automatically generated section) -## -CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS) -LIBS=$(EXTRA_LIBS) $(LIBS1) -INCLUDES=$(INCLUDES1) $(INCLUDES0) $(EXTRA_INCLUDES) -LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS) -INCDIR=$(SRCDIR)/include -OBJS=mod_ptt.o parse_html.o -BBSLIBS=util_cache.o util_passwd.o util_record.o -LIB=libptt.a -SHLIBS= -OBJS_PIC= - -all: lib shlib - -lib: $(LIB) - -shlib: $(SHLIBS) - -dummy $(LIB): $(OBJS) - rm -f $@ - ar cr $@ $(OBJS) $(BBSLIBS) - $(RANLIB) $@ - -.SUFFIXES: .o .so .dll - -.c.o: - $(CC) -c $(INCLUDES) $(CFLAGS) $< - -.c.so: - $(CC) -c $(INCLUDES) $(CFLAGS) $(CFLAGS_SHLIB) $< && mv $*.o $*.lo - $(LD_SHLIB) $(LDFLAGS_SHLIB) -o $@ $*.lo $(LIBS_SHLIB) - -clean: - rm -f $(LIB) $(OBJS) $(SHLIBS) $(OBJS_PIC) - -distclean: clean - rm -f Makefile - -# NOT FOR END USERS! -depend: - cp Makefile.tmpl Makefile.tmpl.bak \ - && sed -ne '1,/^# DO NOT REMOVE/p' Makefile.tmpl > Makefile.new \ - && gcc -MM $(INCLUDES) $(CFLAGS) *.c >> Makefile.new \ - && sed -e '1,$$s: $(INCDIR)/: $$(INCDIR)/:g' \ - -e '1,$$s: $(OSDIR)/: $$(OSDIR)/:g' Makefile.new \ - > Makefile.tmpl \ - && rm Makefile.new - -## -## (End of automatically generated section) -## - -#Dependencies - -$(OBJS) $(OBJS_PIC): Makefile - -# DO NOT REMOVE -mod_ptt.o: mod_ptt.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_main.h $(INCDIR)/http_protocol.h \ - $(INCDIR)/util_script.h \ - /home/bbs/pttbbs/include/bbs.h - -parse_html.o: parse_html.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_main.h $(INCDIR)/http_protocol.h \ - $(INCDIR)/util_script.h \ - /home/bbs/pttbbs/include/bbs.h diff --git a/not-maintained/web/Makefile.tmpl b/not-maintained/web/Makefile.tmpl deleted file mode 100644 index 83ed1e84..00000000 --- a/not-maintained/web/Makefile.tmpl +++ /dev/null @@ -1,16 +0,0 @@ - -#Dependencies - -$(OBJS) $(OBJS_PIC): Makefile - -BBSLIBS= util_cache.o util_record.o util_passwd.o - -# DO NOT REMOVE -mod_ptt.o: mod_ptt.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ - $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_main.h $(INCDIR)/http_protocol.h \ - $(INCDIR)/util_script.h diff --git a/not-maintained/web/Makefile.tmpl.bak b/not-maintained/web/Makefile.tmpl.bak deleted file mode 100644 index e686b7a9..00000000 --- a/not-maintained/web/Makefile.tmpl.bak +++ /dev/null @@ -1,17 +0,0 @@ - -#Dependencies - -$(OBJS) $(OBJS_PIC): Makefile - -BBSLIBS= util_cache.o util_record.o util_passwd.o - -# DO NOT REMOVE -mod_ptt.o: mod_ptt.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_main.h $(INCDIR)/http_protocol.h \ - $(INCDIR)/util_script.h diff --git a/not-maintained/web/args.c b/not-maintained/web/args.c deleted file mode 100755 index 02e0fad0..00000000 --- a/not-maintained/web/args.c +++ /dev/null @@ -1,228 +0,0 @@ -/* 使用方法: 自己先用 r->method_number 判斷是 M_GET 或 M_POST - */ -#include "mod_ptt.h" - -unsigned char xtoc(char ch1, char ch2) { - unsigned char d, up1, up2; - - if (!isxdigit(ch1) || !isxdigit(ch2)) return ' '; - - up1 = toupper(ch1); - up2 = toupper(ch2); - - if (up1>='0' && up1<='9') d = up1-'0'; - else d = up1-'A'+10; - d <<= 4; - if (up2>='0' && up2<='9') d += up2-'0'; - else d += up2-'A'+10; - - return d; -} - -char * cstoxs(pool *p, char *str) -{ - char * newstr = pstrdup(p,""), *po = str; - - for(po = str; *po; po++) - { - if(isprint(*po) && *po!=' ') newstr=psprintf(p, "%s%c", newstr,*po); - else newstr=psprintf(p, "%s%%%X", newstr, *po& 0xFF); - } - return newstr; -} - -int // Ptt: 我重寫拿掉mygetchar 並加上fileupload的功能 -inital_postdata(request_rec *r, int *fileupload, char *boundary, - char **data) -{ - char *buf, *mb; - int size, off = 0, len_read; - void (*handler)(); - - buf = table_get(r->subprocess_env,"CONTENT_TYPE"); - if(!buf || - (strncasecmp(buf,"application/x-www-form-urlencoded",33) && - strncasecmp(buf,"multipart/form-data",19))) - return -1; - - if(!strncasecmp(buf,"multipart/form-data",19)) { - if(!fileupload) return -1; - *fileupload=1; - mb = strchr(buf,'='); - if(mb) { - strcpy(boundary,mb+1); - strtok(boundary, " ;\n"); - } - else return -1; - } - - buf = table_get(r->subprocess_env,"CONTENT_LENGTH"); - if(buf==NULL) return -1; - - size = atoi(buf); - mb = (char *)palloc(r->pool,(size+1)*sizeof(char)); - - if(!mb || - (setup_client_block(r ,REQUEST_CHUNKED_ERROR) != 0) || - (should_client_block(r) == 0)) - return -1; - - hard_timeout("args.c copy script args", r); - handler = signal(SIGPIPE, SIG_IGN); - - while(size-off > 0 && (len_read = get_client_block - (r, mb + off, size - off)) > 0) { - off += len_read; - } - - signal(SIGPIPE, handler); - kill_timeout(r); - - if(len_read < 0) return -1; // 讀的中途有中斷 - mb[size]=0; // Ptt:截掉不需要吧 因為不是用字串處理方式 - (*data) = mb; - return size; -} - -#define ENCODED_NAME " name=\"" -#define ENCODED_FILENAME " filename=\"" -#define ENCODED_CONTENT "Content-Type: " - -//#define FILEDATAFILE DATABASEDIR "/" FDATA - -int -unescape(request_rec *r, char** name, char** value) { - static char *sp=NULL, boundary[150]; - static int fileupload, boundarylen, dsize; - pool *p = r->pool; - char ch, ch1, *dp, *p0, *p1, *temp_sp, *ftype; - int type; - - if (sp==NULL) { - fileupload=0; - switch (r->method_number) { - case M_GET: - if (r->args) sp = pstrdup(p, r->args); - else {sp=NULL; return -1;} - break; - case M_POST: - if ((dsize = - inital_postdata(r, &fileupload, boundary,&sp))<0) - {sp=NULL; return -1; } - if(fileupload) boundarylen = strlen(boundary); - break; - default: - sp=NULL; - return -1; - } - } - - if(fileupload) - { - if(dsize >0 && (temp_sp = memstr(sp, boundary, dsize))) - { - temp_sp += boundarylen; - p0 = strstr(temp_sp, "\r\n\r\n"); - p1 = strstr(temp_sp, "\n\n"); - - if(!((*name) = strstr(temp_sp, ENCODED_NAME))) - {sp=NULL; return -1; } - (*name) += strlen(ENCODED_NAME); - strtok((*name) + 1 , "\""); - if( (!p0 && p1) || (p0 && p1 && p1<p0)) - { - (*value) = sp = p1 + 2; - type = 2; - } - else if(p0) - { - (*value) = sp = p0 + 4; - type = 4; - } - else - { - sp=NULL; - return -1; - } - - if((p1 = memstr(temp_sp, boundary, dsize - boundarylen))) - temp_sp = p1; - else - temp_sp = sp + dsize; - - *(temp_sp - type) = 0; - - // 檢查是不是file 若是就給fileinfo - if((dp=memstr( - (*name) + strlen(*name) +1, ENCODED_FILENAME, dsize)) && - dp < *value) - { - dp += strlen(ENCODED_FILENAME); - p0 = strchr(dp,'"'); - *p0 = 0; - if(p0 - dp>3) - { - fileheader_t *file=(fileheader_t *)pcalloc(p, sizeof(fileheader_t)); - if((ftype = strstr(p0 + 1, ENCODED_CONTENT))) - { - ftype += strlen(ENCODED_CONTENT); - strtok(ftype, "\r\n"); - } - while(p0 > dp && *p0 !='/' && *p0 !='\\') p0--; - strcpy(file->name, p0+1); - strcpy(file->content_type, ftype); - file->icontent_type = filetype(ftype); - // if(file->icontent_type & (FILE_TXT | FILE_HTML)) - // file->size = strlen(sp); - // else - file->size = temp_sp - sp - type; - file->uploadtime = time(NULL); - file->data = (*value); - (*value) = (char *)file; - } - else - { - (*value) = NULL; - } - } - - dsize -= (temp_sp - sp); - sp = temp_sp; - return 1; - } - else - { - sp=NULL; - return -1; - } - } - - dp = (*name) = sp; - while(1) { - ch = *sp++; - switch(ch) { - case '+': - *dp++ = ' '; - break; - case '=': - *dp++ = '\0'; - (*value) = dp; - break; - case '&': case '|': - *dp++ = '\0'; - return 1; - case '\0': case EOF: - *dp = '\0'; - sp=NULL; - return 0; - case '%': - ch = *sp++; ch1 = *sp++; - *dp++ = xtoc(ch, ch1); - break; - default: - *dp++=ch; - break; - } - } -} - diff --git a/not-maintained/web/board.c b/not-maintained/web/board.c deleted file mode 100644 index 43347912..00000000 --- a/not-maintained/web/board.c +++ /dev/null @@ -1,39 +0,0 @@ -#include "mod_ptt.h" - -extern int numboards; -extern boardheader_t *bcache; -extern int ptt_handler(request_rec *r, void *args); - -int bbs_board(request_rec *r, void *args) -{ - int i; - r->content_type = "text/xml"; - ap_send_http_header(r); - ap_rputs("<hr> Ptt \n", r); -return ptt_handler (r,args); - - ap_rprintf(r,"r->filename : %s <br>",r->filename); - ap_rprintf(r,"r->request_time : %s <br>",ctime(&r->request_time)); - ap_rprintf(r,"r->method : %s <br>",r->method); - ap_rprintf(r,"r->method_number : %d <br>",r->method_number); - ap_rprintf(r,"r->path_info : %s <br>",r->path_info); - ap_rprintf(r,"r->args : %s <br>",r->args); - ap_rprintf(r,"r->unparsed_uri : %s <br>",r->unparsed_uri); - ap_rprintf(r,"r->uri : %s <br>",r->uri); - ap_rprintf(r,"r->handler : %s <br>",r->handler); - ap_rprintf(r,"r->content_type : %s <br>",r->content_type); - ap_rprintf(r, "Server built: \"%s\"\n", ap_get_server_built()); - - ap_rputs("<hr> Ptt \n", r); - - ap_rputs("<XML>",r); -/* - for(i = 0; i++ < numboards; i++) - { - ap_rputs("<board>",r); - ap_rputs("</board>",r); - } -*/ - - return OK; -} diff --git a/not-maintained/web/chmod b/not-maintained/web/chmod deleted file mode 100644 index a91df6d5..00000000 --- a/not-maintained/web/chmod +++ /dev/null @@ -1 +0,0 @@ -ftasfdsf diff --git a/not-maintained/web/l b/not-maintained/web/l deleted file mode 100755 index 5feafa93..00000000 --- a/not-maintained/web/l +++ /dev/null @@ -1 +0,0 @@ -lynx -dump ptt.cc/menu diff --git a/not-maintained/web/mail.c b/not-maintained/web/mail.c deleted file mode 100644 index 9f226afe..00000000 --- a/not-maintained/web/mail.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "mod_ptt.h" - -int bbs_mail(request_rec *r, void *args) -{ - return OK; -} diff --git a/not-maintained/web/mod_ptt.c b/not-maintained/web/mod_ptt.c deleted file mode 100644 index 3c4309ed..00000000 --- a/not-maintained/web/mod_ptt.c +++ /dev/null @@ -1,284 +0,0 @@ -#include "mod_ptt.h" -extern SHM_t *SHM; -extern int *GLOBALVAR; - -extern int numboards; -extern boardheader_t *bcache; -typedef struct excfg { - int cmode; /* Environment to which record applies (directory, - * server, or combination). - */ -#define CONFIG_MODE_SERVER 1 -#define CONFIG_MODE_DIRECTORY 2 -#define CONFIG_MODE_COMBO 3 /* Shouldn't ever happen. */ - int local; /* Boolean: "Example" directive declared here? */ - int congenital; /* Boolean: did we inherit an "Example"? */ - char *trace; /* Pointer to trace string. */ - char *loc; /* Location to which this record applies. */ -} excfg; - -static const char *trace = NULL; -static table *static_calls_made = NULL; - -static pool *ptt_pool = NULL; -static pool *ptt_subpool = NULL; - - -module MODULE_VAR_EXPORT ptt_module; -excfg * our_dconfig(request_rec *r) -{ - - return (excfg *) ap_get_module_config(r->per_dir_config, &ptt_module); -} - -static void setup_module_cells() -{ - if (ptt_pool == NULL) { - ptt_pool = ap_make_sub_pool(NULL); - }; - if (static_calls_made == NULL) { - static_calls_made = ap_make_table(ptt_pool, 16); - }; -} - - -static int xml_header(request_rec *r) -{ - r->content_type = "text/xml"; - ap_send_http_header(r); - ap_rputs("<?xml version=\"1.0\" encoding=\"Big5\"?> \n", r); - ap_rprintf(r, "<!-- HTTP-Server-version=\"%s\"\n", - ap_get_server_version()); - ap_rprintf(r," r-filename=\"%s\"\n",r->filename); - ap_rprintf(r," r-request_time=\"%s\"\n",ctime(&r->request_time)); - ap_rprintf(r," r-method=\"%s\"\n",r->method); - ap_rprintf(r," r-method_number=\"%d\"\n",r->method_number); - ap_rprintf(r," r-path_info=\"%s\"\n",r->path_info); - ap_rprintf(r," r-args=\"%s\"\n",r->args); - ap_rprintf(r," r-unparsed_uri=\"%s\"\n",r->unparsed_uri); - ap_rprintf(r," r-handler=\"%s\"\n",r->handler); - ap_rprintf(r," r-content_type=\"%s\"\n",r->content_type); - ap_rprintf(r, " Serverbuilt=\"%s\" \n", ap_get_server_built()); - ap_rprintf(r, " numboards=\"%d\" \n", numboards); - ap_rprintf(r, " shm=\"%d\" \n", SHM->loaded ); - ap_rprintf(r, " max_user=\"%d\" -->", SHM->max_user ); -} -static int userlist(request_rec *r) -{ - int i,offset=0; - userinfo_t *ptr; - xml_header(r); - if (r->header_only) { - return OK; - } - if(r->args) offset=atoi(r->args); - if(offset<0 || offset>SHM->UTMPnumber)offset=0; - - ap_rprintf(r,"<userlist>"); - for(i=offset;i<SHM->UTMPnumber && i<50+offset;i++) - { - ptr= (userinfo_t *)SHM->sorted[SHM->currsorted][0][i]; - if(!ptr || ptr->userid[0]==0 || ptr->invisible ) continue; - ap_rprintf(r,"<user>\n"); - ap_rprintf(r," <id>%d</id>\n",i+1); - ap_rprintf(r," <total>%d</total>\n",SHM->UTMPnumber); - ap_rprintf(r," <uid>%d</uid>\n",ptr->uid); - ap_rprintf(r," <userid>%s</userid>\n",ptr->userid); - ap_rprintf(r," <username>%s</username>\n", - ap_escape_html(r->pool,ptr->username)); - ap_rprintf(r," <from>%s</from>\n",ptr->from); - ap_rprintf(r," <from_alias>%d</from_alias>\n",ptr->from_alias); - ap_rprintf(r," <mailalert>%d</mailalert>\n",ptr->mailalert); - ap_rprintf(r," <mind>%s</mind>\n",ap_escape_html(r->pool,ptr->mind)); - ap_rprintf(r,"</user>"); - } - ap_rprintf(r,"</userlist>"); -} -static int showboard(request_rec *r, int id) -{ - int i; - boardheader_t *bptr=NULL; - id=id-1; - ap_rprintf(r,"<brdlist>"); - bptr = (boardheader_t *)bcache[id].firstchild[0]; - for(; bptr!= (boardheader_t*)~0; ) - { - if((bcache[id].brdattr&BRD_HIDE)|| - bcache[id].level&& !(bcache[id].brdattr & BRD_POSTMASK )) continue; - ap_rprintf(r,"<brd>\n"); - i=(bptr-bcache); - ap_rprintf(r," <bid>%d</bid>",i+1); - ap_rprintf(r," <brdname>%s</brdname>\n",bptr->brdname); - ap_rprintf(r," <title>%s</title>\n",ap_escape_html(r->pool,bptr->title)); - ap_rprintf(r," <nuser>%d</nuser>\n",bptr->nuser); - ap_rprintf(r," <gid>%d</gid>\n",bptr->gid); - ap_rprintf(r," <childcount>%d</childcount>\n",bptr->childcount); - ap_rprintf(r," <BM>%s</BM>\n",bptr->BM); - ap_rprintf(r," <brdattr>%d</brdattr>\n",bptr->brdattr); - ap_rprintf(r," <total>%d</total>\n",SHM->total[i]); - ap_rprintf(r,"</brd>\n"); - bptr=(boardheader_t*)bptr->next[0]; - } - - ap_rprintf(r,"</brdlist>"); -} - - -static int showpost(request_rec *r,int bid,int id, int num) -{ - int i; - num=256; - id=1; - char path[512]; - fileheader_t headers[256]; - memset(headers,0, sizeof(fileheader_t)*256); - sprintf(path,BBSHOME"/boards/%c/%s/.DIR", - bcache[bid-1].brdname[0],bcache[bid-1].brdname); - get_records(path, headers, sizeof(fileheader_t)*256, id,num); - - ap_rprintf(r,"<postlist>"); - - for(i=0;i<256;i++) - { - ap_rprintf(r,"<post>\n"); - ap_rprintf(r," <id>%d</id>",i+1); - ap_rprintf(r," <filename>%s</filename>\n",headers[i].filename); - ap_rprintf(r," <owner>%s</owner>\n",headers[i].owner); - ap_rprintf(r," <date>%s</date>\n",headers[i].date); - ap_rprintf(r," <title>%s</title>\n", - ap_escape_html(r->pool,headers[i].title)); - ap_rprintf(r," <money>%d</money>\n",headers[i].money); - ap_rprintf(r," <filemode>%c</filemode>\n",headers[i].filemode); - ap_rprintf(r," <recommend>%d</recommend>\n",headers[i].recommend); - ap_rprintf(r,"</post>\n"); - } - ap_rprintf(r,"</postlist>"); -} -static int showmenujs(request_rec *r) -{ - int i; - boardheader_t *bptr; - r->content_type = "text/text"; - ap_send_http_header(r); - ap_rputs("d=new dTree('d');\n",r); - ap_rputs("d.add(0,-1,'Class','');\n",r); - for(i=1;i<=numboards;i++) - { - bptr=&bcache[i-1]; - if(!isalpha(bptr->brdname[0]))continue; - - ap_rprintf(r,"d.add(%d,%d,\"%s %s..\",'/boards?%s');\n", - i,bptr->gid-1, - bptr->gid==1?"":bptr->brdname, - ap_escape_quotes(r->pool, - ap_escape_html(r->pool,bptr->title+7)),i); - } - ap_rputs("d.draw()\n",r); - return OK; -} - -static int showxml(request_rec *r) -{ - int bid=1; - xml_header(r); - if (r->header_only) { - return OK; - } - if(r->args) bid=atoi(r->args); - if(bid<1 || bid>numboards)bid=1; - - if( - !(bcache[bid-1].brdattr&BRD_HIDE)&& - !(bcache[bid-1].level&&!(bcache[bid-1].brdattr & BRD_POSTMASK))) - if( bid==1||bcache[bid-1].brdattr&BRD_GROUPBOARD) - showboard(r,bid); - else - showpost(r,bid,0,0); - return OK; -} -static int ptt_handler(request_rec *r) -{ - excfg *dcfg; - - dcfg = our_dconfig(r); - - ap_soft_timeout("send ptt call trace", r); - - if(!strncmp(r->unparsed_uri,"/menu",5)) - showmenujs(r); - else if(!strncmp(r->unparsed_uri,"/userlist",9)) - userlist(r); - else - showxml(r); - - ap_kill_timeout(r); - return OK; -} - -/* OK Handler accepted the request and did its thing with it. */ -/* DECLINED Handler took no action. */ -/* HTTP_mumble Handler looked at request and found it wanting. */ - -static void ptt_child_init(server_rec *s, pool *p) -{ - - char *note; - char *sname = s->server_hostname; - attach_SHM(); - - - setup_module_cells(); - sname = (sname != NULL) ? sname : ""; - note = ap_pstrcat(p, "ptt_child_init(", sname, ")", NULL); -} - -static void ptt_child_exit(server_rec *s, pool *p) -{ - - char *note; - char *sname = s->server_hostname; - - /* - * The arbitrary text we add to our trace entry indicates for which server - * we're being called. - */ - sname = (sname != NULL) ? sname : ""; - note = ap_pstrcat(p, "ptt_child_exit(", sname, ")", NULL); -} - -static const handler_rec ptt_handlers[] = -{ - {"ptt_h", ptt_handler}, - {NULL} -}; - -module MODULE_VAR_EXPORT ptt_module = -{ - STANDARD_MODULE_STUFF, - NULL, /* module initializer */ - NULL, /* per-directory config creator */ - NULL, /* dir config merger */ - NULL, /* server config creator */ - NULL, /* server config merger */ - NULL, /* command table */ - ptt_handlers, /* [9] list of handlers */ - NULL, /* [2] filename-to-URI translation */ - NULL, /* [5] check/validate user_id */ - NULL, /* [6] check user_id is valid *here* */ - NULL, /* [4] check access by host address */ - NULL, /* [7] MIME type checker/setter */ - NULL, /* [8] fixups */ - NULL, /* [10] logger */ -#if MODULE_MAGIC_NUMBER >= 19970103 - NULL, /* [3] header parser */ -#endif -#if MODULE_MAGIC_NUMBER >= 19970719 - ptt_child_init, /* process initializer */ -#endif -#if MODULE_MAGIC_NUMBER >= 19970728 - ptt_child_exit, /* process exit/cleanup */ -#endif -#if MODULE_MAGIC_NUMBER >= 19970902 - NULL -#endif -}; diff --git a/not-maintained/web/mod_ptt.h b/not-maintained/web/mod_ptt.h deleted file mode 100644 index 125046d6..00000000 --- a/not-maintained/web/mod_ptt.h +++ /dev/null @@ -1,13 +0,0 @@ -#include "httpd.h" -#include "http_config.h" -#include "http_core.h" -#include "http_log.h" -#include "http_main.h" -#include "http_protocol.h" -#include "util_script.h" -#include "bbs.h" - -#include <stdio.h> - - -#define PATHLEN 512 diff --git a/not-maintained/web/mytime.h b/not-maintained/web/mytime.h deleted file mode 100755 index c9e4f29d..00000000 --- a/not-maintained/web/mytime.h +++ /dev/null @@ -1,189 +0,0 @@ -/* Ptt : 常用函式整理 */ - -/* - * 時間處理 - */ -#include <time.h> -#ifdef _BBS_UTIL - #undef pstrdup - #define pstrdup(p, str) strdup(str) -#endif - -int -mygetdate(time_t clock, int *year, int *mon, int *mday, int *week) -{ - struct tm *mytm = localtime(&clock); - if(year) *year = mytm->tm_year; /* 98 */ - if(mon) *mon = mytm->tm_mon + 1; /* 1~12 */ - if(mday) *mday = mytm->tm_mday; /* 1~31 */ - if(week) *week = mytm->tm_wday; /* 0~6 */ - return 0; -} - -char * -Cdatenum_slash(pool *p,time_t *clock) /* 98/04/21 */ -{ - char foo[22]; - struct tm *mytm = localtime(clock); - strftime(foo, 22, "%y/%m/%d", mytm); - return pstrdup(p, foo); -} - -char * -Cdatenum(pool *p,time_t *clock) /* 980421 */ -{ - char foo[22]; - struct tm *mytm = localtime(clock); - strftime(foo, 22, "%y%m%d", mytm); - return pstrdup(p, foo); -} - - -#ifndef _BBS_UTIL -char * -Cdatefullnum(pool *p,time_t *clock) /* 19980421 */ -{ - char foo[22]; - struct tm *mytm = localtime(clock); - strftime(foo, 22, "%Y%m%d", mytm); - return pstrdup(p, foo); -} -#else -char * -Cdatefullnum(char *p,time_t *clock) /* 19980421 */ -{ - static char foo[22]; - struct tm *mytm = localtime(clock); - strftime(foo, 22, "%Y%m%d", mytm); - return foo; -} -#endif - -char * -Cdate(char *p,time_t *clock) -{ - char foo[22]; - struct tm *mytm = localtime(clock); - strftime(foo, 22, "%D %T %a", mytm); - return pstrdup(p, foo); -} - -char * -Cdatelite(char *p,time_t *clock) -{ - char foo[18]; - struct tm *mytm = localtime(clock); - strftime(foo, 18, "%D %T", mytm); - return pstrdup(p, foo); -} - -char * -whattime(char *p,time_t *clock) -{ - char foo[18]; - struct tm *mytm = localtime(clock); - strftime(foo, 18, "%H:%M:%S", mytm); - return pstrdup(p, foo); -} - -char * -whatyear(char *p,time_t *clock) -{ - char foo[6]; - struct tm *mytm = localtime(clock); - strftime(foo, 6, "%Y", mytm); - return pstrdup(p, foo); -} - -char * -whatmonth(char *p,time_t *clock) -{ - char foo[4]; - struct tm *mytm = localtime(clock); - strftime(foo, 4, "%m", mytm); - return pstrdup(p, foo); -} - -char * -whatday(char *p,time_t *clock) -{ - char foo[4]; - struct tm *mytm = localtime(clock); - strftime(foo, 4, "%d", mytm); - return pstrdup(p, foo); -} - -char * -C_week(pool *p, int a) -{ - char foo[5]=""; - switch(a) - { - case 0: - case 7: - strcpy(foo,"日"); - break; - case 1: - strcpy(foo,"一"); - break; - case 2: - strcpy(foo,"二"); - break; - case 3: - strcpy(foo,"三"); - break; - case 4: - strcpy(foo,"四"); - break; - case 5: - strcpy(foo,"五"); - break; - case 6: - strcpy(foo,"六"); - break; - } - return pstrdup(p, foo); -} - -char * -whatweek(char *p,time_t *clock) -{ - struct tm *mytm = localtime(clock); - return C_week(p, mytm->tm_wday); -} - -char * -whathour(char *p,time_t *clock) -{ - char foo[4]=""; - struct tm *mytm = localtime(clock); - strftime(foo, 6, "%H", mytm); - return pstrdup(p, foo); -} - -char * -whatminute(char *p,time_t *clock) -{ - char foo[4]=""; - struct tm *mytm = localtime(clock); - strftime(foo, 6, "%M", mytm); - return pstrdup(p, foo); -} - -char * -whatsecond(char *p,time_t *clock) -{ - char foo[4]=""; - struct tm *mytm = localtime(clock); - strftime(foo, 6, "%S", mytm); - return pstrdup(p, foo); -} - -char * -Wholetime(char *p,time_t *clock) /* 19980421 */ -{ - char foo[40]; - struct tm *mytm = localtime(clock); - strftime(foo, 40, "%Y年%m月%d日%H時%M分%S秒", mytm); - return pstrdup(p, foo); -} diff --git a/not-maintained/web/parse_html.c b/not-maintained/web/parse_html.c deleted file mode 100755 index 402412de..00000000 --- a/not-maintained/web/parse_html.c +++ /dev/null @@ -1,294 +0,0 @@ -#include "mod_ptt.h" -#include <time.h> -#include <math.h> -#define KUSERINFO "$userinfo$" -#define KUSERID "$userid$" -#define KUSERNAME "$username$" -#define KUSERMONEY "$usermoney$" -#define KTIMEYEAR "$timeyear$" -#define KTIMEMONTH "$timemonth$" -#define KTIMEMDAY "$timemday$" -#define KTIMEWEEK "$timeweek$" -#define KSERVERTIME "$servertime$" -#define KTIMEHOUR "$hour$" -#define KTIMEMINUTE "$minute$" -#define KTIMESECOND "$second$" -#define KMSGONLOAD "$MSGonLoad$" -#define KFCSONLOAD "$FCSonLoad$" -#define KHTMLTITLE "$HTMLtitle$" -#define KSCROLLTITLE "$SCROLLtitle$" -#define KBGCOLOR "$BGCOLOR$" -#define KBGSOUND "$BGSOUND$" -#define KINCHTML "$file:" - - - -char * -ap_parseline(request_rec *r, const char *str, char *str_substiute[]) { - int i, off=0; - char *strbuf, *po; - pool *p = r->pool; - strbuf = pstrdup(p, str); - - if(str_substiute == NULL) return strbuf; - for(i=0; str_substiute[i]!=NULL; i+=2) - { - off = 0; - while(po = strstr(strbuf + off, str_substiute[i])) - { - *po = 0; - strbuf = pstrcat(p, strbuf, str_substiute[i+1] !=NULL - ? str_substiute[i+1] : "", po+strlen(str_substiute[i]), NULL); - off += str_substiute[i+1] ? strlen(str_substiute[i+1]) : 0; - } - } - return strbuf; -} - -char * -ap_standard_parseline(request_rec *r, char *str) -{ - time_t now = time(NULL); - pool *p = r->pool; - char *str_substiute[]= // 關鍵字的代換表 - { - KUSERID, "ptt", - KUSERNAME, "name", -/* - KTIMEYEAR, whatyear(p,&now), - KTIMEMONTH,whatmonth(p,&now), - KTIMEMDAY, whatday(p,&now), - KTIMEWEEK, whatweek(p,&now), - KSERVERTIME, whattime(p,&now), - KTIMEHOUR, whathour(p,&now), - KTIMEMINUTE, whatminute(p,&now), - KTIMESECOND, whatsecond(p,&now), -*/ - KUSERINFO, NULL, - KUSERMONEY, "100", - NULL,NULL - }; - return ap_parseline(r, str, str_substiute); -} - -int -ap_showfile(request_rec *r, char *filename, char *table[], char *t2[], FILE *fo) -{ - pool *p = r->pool; - FILE *fp = pfopen(p, filename, "r"); - char *str, *incfile, buf[512]; - - if (!fp) { -#if DEBUG - rputs(filename, r); -#endif - return -1; - } - - while (fgets(buf, 512, fp)) - { - - str = ap_standard_parseline(r, - ap_parseline(r, - ap_parseline(r, buf, table), - t2)); - - if ((incfile = strstr(str, KINCHTML)) != NULL) { - incfile += strlen(KINCHTML); - incfile = strtok(incfile, "$"); -#if 0 - if (*incfile != '/') - incfile = ap_pstrcat(p, TEMPLATEDIR "/", incfile, NULL); -#endif - ap_showfile(r, incfile, table, t2, fo); - } else if(fo) fputs(str, fo); - else rputs(str, r); - } - - pfclose(p, fp); - return 0; -} - -char * -add_href(pool *p, char *l) -{ - char *href[] = {"http://", "ftp://", "gopher://", "file://", - "telnet://", "mailto:", NULL}, - *end, url[PATHLEN], *tl, *po; - int i, urllen, off; - - tl = pstrdup(p, l); - - for(i=0; href[i]!=NULL; i++) - { - off = 0; - //Ptt: while 應該用 while 但 while 有bug - if((po = strstr(tl + off, href[i]))) - { - for(end = po; (*end>='&' && *end<='z')||*end=='~' ; end++); - urllen = end - po; - - if(urllen > PATHLEN) - { - off += PATHLEN; continue; - } - - strncpy(url, po, urllen); - *po= 0; - url[urllen] = 0; - tl = psprintf(p, "%s<a href=\"%s\" target=\"%s\">%s</a>%s", tl, - url, "new", url, end); - off += 2 * urllen + 15; - } - } - - return tl; -} - -/* - format: - char *name, void *ptr, size_t length - char *name, int *ptr, -1 - char *name, char **ptr, 0 -*/ -int -GetQueryDatas(request_rec *r, int **table) -{ - int rc, i, match=0, dlen, maxlen; - char *name, *value, *str; - pool *p = r->pool; - - for(i=1; table[i]!=NULL; i+=3) - { - if((int) table[i+1]) *table[i]=0; - else (char *) (*table[i]) = pstrdup(p, ""); - } - do - { - if((rc = unescape(r, &name, &value))<0) break; - for(i=0; table[i]; i+=3) - { - if(!strcmp((char *)table[i], name)) break; - -#if 0 -/* SiE990313 test: 抓 未定義的變數 */ - if(!strcmp((char *)table[i], "$SPARE$")) - { - (char *) (*table[i + 1]) = pstrdup(p, name); - continue; - } -#endif - } - if(table[i] && table[i+1]) - { - if((maxlen = (int) table[i+2]) > 0) - { - if(!*value) continue; - dlen = strlen((char *)table[i+1]); - str = ap_escape_html(p, value); - if(maxlen > dlen) - strexam( - strncat((char *)table[i+1],str,maxlen-dlen) - ); - } - else if((int) table[i+2] == 0) // for file upload - { -// str = ap_escape_html(p, value); - //if(value) - (*table[i+1]) = (int) value; -// else (*table[i+1]) = (int) pstrdup(p,""); - } - else - { - if(!*value) continue; - *(table[i+1]) += atoi(value); - } - match++; - } - } while(rc>0); - return match; -} - - -int -ap_url_redirect(request_rec *r, char *url) -{ - r->status = REDIRECT; - - ap_table_setn(r->headers_out, "Location", pstrdup(r->pool, url)); - return MOVED; - //return REDIRECT, MOVED 或 HTTP_SEE_OTHER 都可 -} - -char * -pint2str(pool* p, int c) -{ - return ap_psprintf(p,"%d",c); -} - -char* -preplace(request_rec *r, char* src, char* sig, char* rep) -{ - char *ptr; - int siglen=strlen(sig), off=0; - - while((ptr = strstr(src+off,sig))) - { - *ptr = 0; - src = pstrcat(r->pool, src, rep, NULL); - off = strlen(src); - src = pstrcat(r->pool, src, ptr+siglen, NULL); - } - return src; -} - -int -hex2dig(char *str) -{ - int base,ret=0,i,len=strlen(str); - - for(i=0; i<len; i++) - { - if(str[i]>='a' && str[i]<='f') base = str[i]-'a'+10; - else if(str[i]>='A' && str[i]<='F') base = str[i]-'A'+10; - else if(str[i]>='0' && str[i]<='9') base = str[i]-'0'; - else return -1; - - ret += base*pow(16,len-i-1); - } - return ret; -} - -char * -pstrncpy(pool* p, char tmp[], int n) -{ - char *ptr; - ptr=pstrdup(p,tmp); - *(ptr+n)=0; - return psprintf(p,"%s",ptr); -} - -char * -GetPathToken(request_rec *r, int count) -{ - char *str, *token, *sepr = "/\\?&"; - int i; - str = pstrdup(r->pool, r->path_info + 1); - token = strtok(str, sepr); - for( i = 1 ; i < count; i++) - { - token = strtok(NULL, sepr); - if(!token) return "-1"; /* Heat:count超過也要考慮 */ - } - return token; -} - - -/* - 個人信件夾檔保管方式: - - mail/@/rec/FF/F/UUDDTT - mail/@/dat/FF/F/UUDDTT - -*/ - diff --git a/not-maintained/web/post.c b/not-maintained/web/post.c deleted file mode 100644 index 3e67937e..00000000 --- a/not-maintained/web/post.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "mod_ptt.h" - -int bbs_post(request_rec *r, void *args) -{ - return OK; -} diff --git a/not-maintained/web/r b/not-maintained/web/r deleted file mode 100755 index 5e18e14c..00000000 --- a/not-maintained/web/r +++ /dev/null @@ -1 +0,0 @@ -sudo apachectl restart diff --git a/not-maintained/web/s b/not-maintained/web/s deleted file mode 100755 index e1384f10..00000000 --- a/not-maintained/web/s +++ /dev/null @@ -1 +0,0 @@ -sudo apachectl stop diff --git a/not-maintained/web/stuff.c b/not-maintained/web/stuff.c deleted file mode 100755 index b02dbb0d..00000000 --- a/not-maintained/web/stuff.c +++ /dev/null @@ -1,269 +0,0 @@ -/* Ptt : 常用字串函式整理 */ -#include "mod_ptt.h" - -// 缺少 escape_url的東西 - -/* - * 檔案判別 - */ - - /* 傳回:路徑大小 */ - -off_t -dashs(fname) - char *fname; -{ - struct stat st; - - if (!stat(fname, &st)) - return (st.st_size); - else - return 0; /* 無此檔是 size 0 */ -} - - /* 傳回:路徑時間 */ -long -dasht(char *fname) -{ - struct stat st; - - if (!stat(fname, &st)) - return (st.st_mtime); - else - return -1; -} - - /* 傳回:路徑是否為link檔 */ -int -dashl(char *fname) -{ - struct stat st; - return (lstat(fname, &st) == 0 && S_ISLNK(st.st_mode)); -} - - /* 傳回:路徑是否為檔案 */ -dashf(char *fname) -{ - struct stat st; - - return (stat(fname, &st) == 0 && S_ISREG(st.st_mode)); -} - -/* 字串的小寫 */ -#define char_lower(c) ((c >= 'A' && c <= 'Z') ? c|32 : c) - -void -str_lower(t, s) - char *t, *s; -{ - register char ch; - do - { - ch = *s++; - *t++ = char_lower(ch); - } while (ch); -} - -int -str_ncmp(s1, s2, n) - char *s1, *s2; - int n; -{ - int c1, c2; - - while (n--) - { - c1 = *s1++; - if (c1 >= 'A' && c1 <= 'Z') - c1 |= 32; - - c2 = *s2++; - if (c2 >= 'A' && c2 <= 'Z') - c2 |= 32; - - if (c1 -= c2) - return (c1); - - if (!c2) - break; - } - return 0; -} -char * -memstr(char *mem, char *str, int size) -{ - char *loc, *ptr=mem, *end=mem+size; - int len = strlen(str); - while((loc = memchr(ptr, *str, size))) - { - if(!strncmp(loc, str, len)) - return loc; - ptr = loc +1; - size = (end - ptr); - if(size <=0 ) return NULL; - } - return NULL; -} - -/* 傳回: strstr的比較但不計大小寫的結果 */ -/* -char * -strcasestr(str, tag) - char *str, *tag; -{ - char buf[BUFLEN]; - - str_lower(buf, str); - return strstr(buf, tag); -} -*/ - -/* 傳回: 一個checksum 給字串比較用 */ - -int str_checksum(char *str) -{ - int n=1; - if(strlen(str) < 6) return 0; - while(*str) - n += *str++ ^ n; - return n; -} - -int -not_alpha(ch) - register char ch; -{ - return (ch < 'A' || (ch > 'Z' && ch < 'a') || ch > 'z'); -} - -int -not_alnum(ch) - register char ch; -{ - return (ch < '0' || (ch > '9' && ch < 'A') || - (ch > 'Z' && ch < 'a') || ch > 'z'); -} - -char -ch2ph(char ch) -{ - static const - // a b c d e f g h i j k l m n o - char table[]={'2','2','2','3','3','3','4','4','4','5','5','5','6','6','6', - // p q r s t u v w x y z - '7','1','7','7','8','8','8','9','9','9','1'}; - static char d; - d = char_lower(ch); - if(d>='a' && d<='z') d=table[d-'a']; - return d; -} - -void -archiv32(chrono, fname) - time_t chrono; /* 32 bits */ - char *fname; /* 7 chars */ -{ - char *str; - char radix32[32] = { - '0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', - 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', - 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', - }; - - str = fname + 7; - *str = '\0'; - for (;;) - { - *(--str) = radix32[chrono & 31]; - if (str == fname) - return; - chrono >>= 5; - } -} - -/* ARPANET時間格式 */ -char * -Atime(clock) - time_t *clock; -{ - static char datemsg[40]; - /* ARPANET format: Thu, 11 Feb 1999 06:00:37 +0800 (CST) */ - /* strftime(datemsg, 40, "%a, %d %b %Y %T %Z", localtime(clock)); */ - /* time zone的傳回值不知和ARPANET格式是否一樣,先硬給,同sendmail*/ - strftime(datemsg, 40, "%a, %d %b %Y %T +0800 (CST)", localtime(clock)); - return (datemsg); -} - - -/* userid是否合法 */ -int -bad_user_id(userid) - char *userid; -{ - register char ch; - if (strlen(userid) < 2) - return 1; - if (not_alpha(*userid)) - return 1; - if (!strcasecmp(userid, "new") || !strcasecmp(userid, "guest") || - !strcasecmp(userid, "root") || !strcasecmp(userid, "webadm") || - !strncasecmp(userid,"yam",3) - ) - return 1; - - while (ch = *(++userid)) - { - if (not_alnum(ch) || ch == '0') - return 1; - } - return 0; -} - - -int -logfile(pool *p, char *filename,char *buf) -{ - FILE *fp; - time_t now; - if( (fp = ap_pfopen(p, filename, "a" )) ) { - - fputs( buf, fp ); - if(!strchr(buf,'\n')) - { - now = time(NULL); - fputs(ctime(&now), fp); - } - ap_pfclose(p, fp ); - return 0; - } - else{ - printf("error open file"); - return -1; - } -} - -/* 檢查中文斷字問題 */ -char *strexam(char *s) -{ - int i; - int odd; - for (i = 0, odd = 0; s[i]; i++) - if (odd) odd = 0; - else if (s[i] & 128) odd = 1; - if (odd) s[--i] = 0; - return s; -} - -int -maxline(char *data,char *newline, int max) -{ - register int n, nlen=strlen(newline); - register char *po; - - for(n=0, po = data; (po = strstr(po, newline)); po+=nlen) - { - if(++n>=max) {*po=0; return -1;} - } - return n; -} diff --git a/not-maintained/web/t b/not-maintained/web/t deleted file mode 100755 index 6e8b84bc..00000000 --- a/not-maintained/web/t +++ /dev/null @@ -1 +0,0 @@ -tail /var/log/httpd-error.log diff --git a/not-maintained/web/user.c b/not-maintained/web/user.c deleted file mode 100644 index fe5d0696..00000000 --- a/not-maintained/web/user.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "mod_ptt.h" - -int bbs_user(request_rec *r, void *args) -{ - return OK; -} |