summaryrefslogtreecommitdiffstats
path: root/mbbsd/passwd.c
diff options
context:
space:
mode:
authorptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-04-06 04:32:52 +0800
committerptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-04-06 04:32:52 +0800
commit2d49c43abc05fc453ff3ff154fbe3a8dfd1fb571 (patch)
treec543fe6446c7acaf1781d93d5d9010fd2bcef3a5 /mbbsd/passwd.c
parent9b691d3d21047d1121ab62994e124385359bbdaa (diff)
downloadpttbbs-2d49c43abc05fc453ff3ff154fbe3a8dfd1fb571.tar
pttbbs-2d49c43abc05fc453ff3ff154fbe3a8dfd1fb571.tar.gz
pttbbs-2d49c43abc05fc453ff3ff154fbe3a8dfd1fb571.tar.bz2
pttbbs-2d49c43abc05fc453ff3ff154fbe3a8dfd1fb571.tar.lz
pttbbs-2d49c43abc05fc453ff3ff154fbe3a8dfd1fb571.tar.xz
pttbbs-2d49c43abc05fc453ff3ff154fbe3a8dfd1fb571.tar.zst
pttbbs-2d49c43abc05fc453ff3ff154fbe3a8dfd1fb571.zip
add push_bottom function
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1698 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/passwd.c')
-rw-r--r--mbbsd/passwd.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/mbbsd/passwd.c b/mbbsd/passwd.c
index 0f46f65f..ce6cd233 100644
--- a/mbbsd/passwd.c
+++ b/mbbsd/passwd.c
@@ -49,7 +49,9 @@ passwd_init()
}
int
-passwd_update_money(int num) /* update money only */
+passwd_update_money(int num)
+/* update money only
+ Ptt: don't call it directly, call deumoney() */
{
userec_t user;
int pwdfd, money = moneyof(num);
@@ -77,6 +79,32 @@ passwd_update_money(int num) /* update money only */
}
int
+passwd_query_money(int num)
+/* query money only
+ Ptt: don't call it directly, call moneyof() */
+{
+ userec_t user;
+ int pwdfd, money;
+ char path[256];
+
+ if (num < 1 || num > MAX_USERS)
+ return -1;
+
+ sethomefile(path, getuserid(num), ".passwd");
+
+ if ((pwdfd = open(path, O_WRONLY)) < 0)
+ {
+ if(passwd_index_query(num, &user)<0) // tempory code, will be removed
+ return -1;
+ return user.money;
+ }
+ if(lseek(pwdfd, (off_t)((int)&user.money - (int)&user), SEEK_SET) >= 0)
+ read(pwdfd, &money, sizeof(int));
+ close(pwdfd);
+ return money;
+}
+
+int
passwd_index_update(int num, userec_t * buf)
{
int pwdfd;