summaryrefslogtreecommitdiffstats
path: root/daemon/utmpd/utmpsync.c
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-03-26 13:47:01 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-03-26 13:47:01 +0800
commit2a2078146f1e079732cd1a471e064d34a4399890 (patch)
tree79317a4ab4ed6a610033ed914a2c8782c3a37790 /daemon/utmpd/utmpsync.c
parentb860b474520a4f30b20c829d507d60a90338aadc (diff)
downloadpttbbs-2a2078146f1e079732cd1a471e064d34a4399890.tar
pttbbs-2a2078146f1e079732cd1a471e064d34a4399890.tar.gz
pttbbs-2a2078146f1e079732cd1a471e064d34a4399890.tar.bz2
pttbbs-2a2078146f1e079732cd1a471e064d34a4399890.tar.lz
pttbbs-2a2078146f1e079732cd1a471e064d34a4399890.tar.xz
pttbbs-2a2078146f1e079732cd1a471e064d34a4399890.tar.zst
pttbbs-2a2078146f1e079732cd1a471e064d34a4399890.zip
- (internal) directory layout structure finetune
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4022 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'daemon/utmpd/utmpsync.c')
-rw-r--r--daemon/utmpd/utmpsync.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/daemon/utmpd/utmpsync.c b/daemon/utmpd/utmpsync.c
new file mode 100644
index 00000000..69d1c623
--- /dev/null
+++ b/daemon/utmpd/utmpsync.c
@@ -0,0 +1,27 @@
+/* $Id$ */
+#include "bbs.h"
+#include <err.h>
+
+extern SHM_t *SHM;
+
+int main(int argc, char **argv)
+{
+ int sfd, index, i;
+ attach_SHM();
+ if( (sfd = toconnect(OUTTACACHEHOST, OUTTACACHEPORT)) < 0 ) {
+ printf("connect fail\n");
+ 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].myfriend,
+ sizeof(SHM->uinfo[i].myfriend)) < 0 ||
+ towrite(sfd, SHM->uinfo[i].reject,
+ sizeof(SHM->uinfo[i].reject)) < 0 ){
+ fprintf(stderr, "sync error %d\n", i);
+ }
+ return 0;
+}