diff options
author | ptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-07-18 01:09:36 +0800 |
---|---|---|
committer | ptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-07-18 01:09:36 +0800 |
commit | 1e3962a742facd5fef7a2166d872a29da7597d0b (patch) | |
tree | 66a1bc02601289908a7041e6834cff7884c3abd5 | |
parent | b743f91a71d1b6713cd06ba4bf0c7d43bb839b2f (diff) | |
download | pttbbs-1e3962a742facd5fef7a2166d872a29da7597d0b.tar pttbbs-1e3962a742facd5fef7a2166d872a29da7597d0b.tar.gz pttbbs-1e3962a742facd5fef7a2166d872a29da7597d0b.tar.bz2 pttbbs-1e3962a742facd5fef7a2166d872a29da7597d0b.tar.lz pttbbs-1e3962a742facd5fef7a2166d872a29da7597d0b.tar.xz pttbbs-1e3962a742facd5fef7a2166d872a29da7597d0b.tar.zst pttbbs-1e3962a742facd5fef7a2166d872a29da7597d0b.zip |
*** empty log message ***
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk@417 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | pttbbs/util/Makefile | 7 | ||||
-rw-r--r-- | pttbbs/util/indexuser.c | 41 |
2 files changed, 46 insertions, 2 deletions
diff --git a/pttbbs/util/Makefile b/pttbbs/util/Makefile index 0fc23f70..bfe6429f 100644 --- a/pttbbs/util/Makefile +++ b/pttbbs/util/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.12 2002/06/06 21:35:23 in2 Exp $ +# $Id: Makefile,v 1.13 2002/07/17 17:09:20 ptt Exp $ BBSHOME?=$(HOME) OSTYPE?=linux @@ -30,7 +30,7 @@ CPROGS= bbsmail BM_money post account birth deluserfile expire mandex\ poststat showboard antispam countalldice webgrep bbsrf\ initbbs outmail xchatd userlist tunepasswd buildir reaper shmsweep\ merge_passwd merge_board inndBM buildAnnounce rmuid \ - toplazyBM jungo toplazyBBM shmctl mdclean splitpasswd + toplazyBM jungo toplazyBBM shmctl mdclean splitpasswd indexuser PROGS= $(CPROGS) BM_money.sh backpasswd.sh mailog.sh opendice.sh\ openticket.sh stock.sh topsong.sh weather.sh stock.perl weather.perl\ @@ -87,6 +87,9 @@ openticket: openticket.c $(OBJS) topusr: topusr.c $(OBJS) $(CC) $(CFLAGS) -o $@ $@.c $(OBJS) +indexuser: indexuser.c $(OBJS) + $(CC) $(CFLAGS) -o $@ $@.c $(OBJS) + yearsold: yearsold.c $(OBJS) $(CC) $(CFLAGS) -o $@ $@.c $(OBJS) diff --git a/pttbbs/util/indexuser.c b/pttbbs/util/indexuser.c new file mode 100644 index 00000000..c626303b --- /dev/null +++ b/pttbbs/util/indexuser.c @@ -0,0 +1,41 @@ +#include "bbs.h" +#define INDEXPATH BBSHOME"/index" + +unsigned string_hash(unsigned char *s) +{ + unsigned int v = 0; + while (*s) + { + v = (v << 8) | (v >> 24); + v ^= toupper(*s++); /* note this is case insensitive */ + } + return (v * 2654435769UL) >> (32 - HASH_BITS); +} + + +int main() +{ + int j; + userec_t u; + char buf[256]; + + if(passwd_mmap()) + { + printf("Sorry, the data is not ready.\n"); + exit(0); + } + system("rm -f "INDEXPATH"/realname/* "); + system("rm -f "INDEXPATH"/email/* "); + system("rm -f "INDEXPATH"/ident/* "); + for(j = 1; j <= MAX_USERS; j++) { + passwd_query(j, &u); + if(!u.userid[0]) continue; + sprintf(buf,INDEXPATH"/realname/%X",string_hash(u.realname)); + append_record(buf, &j, sizeof(j)); + sprintf(buf,INDEXPATH"/email/%X",string_hash(u.email)); + append_record(buf, &j, sizeof(j)); + sprintf(buf,INDEXPATH"/ident/%X",string_hash(u.ident)); + append_record(buf, &j, sizeof(j)); + } + return 0; +} |