summaryrefslogtreecommitdiffstats
path: root/util/writemoney.c
blob: 4b70a22bb0c3efd58bdd9d35da3c7eb0842a82a5 (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$ */
/*  SHM 銝剔 money 券典神 .PASSWDS */
#define _UTIL_C_
#include "bbs.h"

time4_t now;
extern SHM_t   *SHM;

int main()
{
    int num, pwdfd, money;
    userec_t u;

    attach_SHM();

    if ((pwdfd = open(fn_passwd, O_WRONLY)) < 0)
    exit(1);
    for (num=1;num <= SHM->number;num++) {
    lseek(pwdfd, sizeof(userec_t) * (num - 1) +
        ((char *)&u.money - (char *)&u), SEEK_SET);
    money = moneyof(num);
    write(pwdfd, &money, sizeof(int));
    }
    close(pwdfd);
    
    return 0;
}