summaryrefslogblamecommitdiffstats
path: root/util/writemoney.c
blob: 4b70a22bb0c3efd58bdd9d35da3c7eb0842a82a5 (plain) (tree)
1
2
3
4
5
6
7
8







                                                


















                                                           
/* $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;
}