summaryrefslogtreecommitdiffstats
path: root/daemon/utmpd/utmpsync.c
blob: 69d1c62318c9f42b20cfa21f9aa1234a0e8dc7c1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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;
}