summaryrefslogtreecommitdiffstats
path: root/util/checkmoney.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/checkmoney.c')
-rw-r--r--util/checkmoney.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/util/checkmoney.c b/util/checkmoney.c
index 22170bdb..0f86420b 100644
--- a/util/checkmoney.c
+++ b/util/checkmoney.c
@@ -5,6 +5,7 @@
int main(int argc, char*argv[]) {
userec_t user;
+ char userhomepwd[256];
char *userid;
int i, money;
@@ -17,10 +18,22 @@ int main(int argc, char*argv[]) {
for(i = 1; i <= MAX_USERS; i++) {
userid=SHM->userid[i-1];
money =SHM->money[i-1];
- if(!userid[0]) continue;
+ if(!userid[0] || money==-1 ) continue;
if(get_record(argv[1], &user, sizeof(user), i) == -1)continue;
- printf("%s %d %s %d\n", userid, money, user.userid, user.money);
-
+ if(money-user.money > 1000000 ||( money<100 && user.money>2000))
+ {
+ sprintf(userhomepwd, BBSHOME "/%c/%s/.passwd", user.userid[0],
+ user.userid);
+ printf("%s %d ", userid, money);
+ money= user.money;
+ SHM->money[i-1] = money;
+ if(get_record(userhomepwd, &user, sizeof(user), 1) == -1)
+ get_record(BBSHOME"/.PASSWD", &user, sizeof(user), i);
+ user.money = money;
+ printf("become %d\n", money);
+ substitute_record(BBSHOME"/.PASSWD", &user, sizeof(user), i);
+ substitute_record(userhomepwd, &user, sizeof(user), 1);
+ }
}
return 0;