diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-04-04 17:59:40 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-04-04 17:59:40 +0800 |
commit | 983a7b8ef01b03cc7596751f431277ed7540c713 (patch) | |
tree | 9330d2b190001e4f884a8cf8fd58db84094ac39e /cacheserver/utmpsync.c | |
parent | eb86d8ff553917f392c556ef3a4b846910b1a17a (diff) | |
download | pttbbs-983a7b8ef01b03cc7596751f431277ed7540c713.tar pttbbs-983a7b8ef01b03cc7596751f431277ed7540c713.tar.gz pttbbs-983a7b8ef01b03cc7596751f431277ed7540c713.tar.bz2 pttbbs-983a7b8ef01b03cc7596751f431277ed7540c713.tar.lz pttbbs-983a7b8ef01b03cc7596751f431277ed7540c713.tar.xz pttbbs-983a7b8ef01b03cc7596751f431277ed7540c713.tar.zst pttbbs-983a7b8ef01b03cc7596751f431277ed7540c713.zip |
merge from outtacache branch
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1689 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'cacheserver/utmpsync.c')
-rw-r--r-- | cacheserver/utmpsync.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/cacheserver/utmpsync.c b/cacheserver/utmpsync.c new file mode 100644 index 00000000..13ffcf4e --- /dev/null +++ b/cacheserver/utmpsync.c @@ -0,0 +1,27 @@ +/* $Id$ */ +#include "bbs.h" +#include <err.h> + +extern SHM_t *SHM; +int towrite(int fd, void *buf, int len); +int toconnect(char *host, int port); + +int main(int argc, char **argv) +{ + int sfd, index, i; + attach_SHM(); + if( (sfd = toconnect(OUTTACACHEHOST, OUTTACACHEPORT)) < 0 ) + return 1; + + index = -1; + towrite(sfd, &index, sizeof(index)); + for( i = 0 ; i < USHM_SIZE ; ++i ) + if( towrite(sfd, &SHM->uinfo[i].uid, sizeof(SHM->uinfo[i].uid)) < 0 || + towrite(sfd, SHM->uinfo[i].friend, + sizeof(SHM->uinfo[i].friend)) < 0 || + towrite(sfd, SHM->uinfo[i].reject, + sizeof(SHM->uinfo[i].reject)) < 0 ){ + fprintf(stderr, "sync error %d\n", i); + } + return 0; +} |