diff options
author | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-03-12 11:24:46 +0800 |
---|---|---|
committer | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-03-12 11:24:46 +0800 |
commit | bf0ff170400889443fd3e3fffc6b1ae2b1738d68 (patch) | |
tree | 33b84a25b6b5809e2c526515de2b516f634ecb4d /util | |
parent | 4d791013a709c9269c4e4872fd9d379168d0f47a (diff) | |
download | pttbbs-bf0ff170400889443fd3e3fffc6b1ae2b1738d68.tar pttbbs-bf0ff170400889443fd3e3fffc6b1ae2b1738d68.tar.gz pttbbs-bf0ff170400889443fd3e3fffc6b1ae2b1738d68.tar.bz2 pttbbs-bf0ff170400889443fd3e3fffc6b1ae2b1738d68.tar.lz pttbbs-bf0ff170400889443fd3e3fffc6b1ae2b1738d68.tar.xz pttbbs-bf0ff170400889443fd3e3fffc6b1ae2b1738d68.tar.zst pttbbs-bf0ff170400889443fd3e3fffc6b1ae2b1738d68.zip |
move global variable xuser into local, save 512 bytes.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2596 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'util')
-rw-r--r-- | util/BM_money.c | 3 | ||||
-rw-r--r-- | util/bbsmail.c | 4 | ||||
-rw-r--r-- | util/chkhbf.c | 6 | ||||
-rw-r--r-- | util/jungo.c | 5 | ||||
-rw-r--r-- | util/openticket.c | 4 | ||||
-rw-r--r-- | util/toplazyBBM.c | 5 | ||||
-rw-r--r-- | util/toplazyBM.c | 5 |
7 files changed, 17 insertions, 15 deletions
diff --git a/util/BM_money.c b/util/BM_money.c index 09e66257..7a8021e9 100644 --- a/util/BM_money.c +++ b/util/BM_money.c @@ -12,7 +12,6 @@ extern boardheader_t *bcache; extern struct UCACHE *uidshm; int c, n; -extern userec_t xuser; @@ -87,7 +86,7 @@ int main(int argc, char **argv) char *ch1,uid ; if((ch1 = strchr(ch, '/'))) *ch1 = 0; - if ((uid=getuser(ch))!=0) + if ((uid=searchuser(ch))!=0) { char genbuf[200]; diff --git a/util/bbsmail.c b/util/bbsmail.c index dd015099..f1a5ffb8 100644 --- a/util/bbsmail.c +++ b/util/bbsmail.c @@ -8,7 +8,6 @@ extern char *notitle[], *nofrom[], *nocont[]; #endif -extern userec_t xuser; int strip_ansi(char *buf, char *str, int mode) @@ -84,9 +83,10 @@ int mail2bbs(char *userid) time_t tmp_time; struct stat st; FILE *fout; + userec_t xuser; /* check if the userid is in our bbs now */ - if( !(uid = getuser(userid)) ){ + if( !(uid = getuser(userid, &xuser)) ){ sprintf(genbuf, "BBS user <%s> not existed", userid); puts(genbuf); mailog(genbuf); diff --git a/util/chkhbf.c b/util/chkhbf.c index 2d416de1..df3dc048 100644 --- a/util/chkhbf.c +++ b/util/chkhbf.c @@ -33,7 +33,7 @@ void informBM(char *userid, boardheader_t *bptr, int nEXP) char filename[256], buf[64]; fileheader_t mymail; FILE *fp; - if( !(uid = getuser(userid)) ) + if( !(uid = searchuser(userid)) ) return; sprintf(filename, BBSHOME "/home/%c/%s", userid[0], userid); stampfile(filename, &mymail); @@ -82,6 +82,8 @@ void chkhbf(boardheader_t *bptr) char fn[256], chkuser[256]; int i, nEXP = 0; FILE *fp; + userec_t xuser; + sprintf(fn, "boards/%c/%s/visable", bptr->brdname[0], bptr->brdname); if( (fp = fopen(fn, "rt")) == NULL ) return; @@ -91,7 +93,7 @@ void chkhbf(boardheader_t *bptr) chkuser[i] = 0; break; } - if( !getuser(chkuser) || strcmp(chkuser, "guest") == 0 ){ + if( !getuser(chkuser, &xuser) || strcmp(chkuser, "guest") == 0 ){ strcpy(explist[nEXP].userid, chkuser); explist[nEXP].expire = -1; ++nEXP; diff --git a/util/jungo.c b/util/jungo.c index c0723c61..fdecf252 100644 --- a/util/jungo.c +++ b/util/jungo.c @@ -9,7 +9,6 @@ extern boardheader_t *bcache; extern int numboards; boardheader_t allbrd[MAX_BOARD]; -extern userec_t xuser; typedef struct lostbm { char *bmname; char *title; @@ -88,13 +87,15 @@ int main(int argc, char *argv[]) for (i = 0; i < numboards; i++) { char *p, bmbuf[IDLEN * 3 + 3]; int index = 0, flag = 0, k, n; + userec_t xuser; + p=strtok(allbrd[i].BM,"/ "); if(p) do { if(allbrd[i].brdname[0] == '\0' || (allbrd[i].brdattr & BRD_GROUPBOARD) ==0 ) continue; if (*p == '[' ){p[strlen(p)-1]='\0'; p++;} - bmid=getuser(p); + bmid=getuser(p, &xuser); bms[index].bmname = p; bms[index].flag = 0; if (((((int)time(NULL)-(int)xuser.lastlogin)/(60*60*24))>=7) diff --git a/util/openticket.c b/util/openticket.c index b93439ab..4bd761a3 100644 --- a/util/openticket.c +++ b/util/openticket.c @@ -8,8 +8,6 @@ static char *betname[8] = {"Ptt", "Jaky", "Action", "Heat", #define MAX_DES 7 /* 最大保留獎數 */ -extern userec_t xuser; - int Link(char *src, char *dst) { char cmd[200]; @@ -159,7 +157,7 @@ int main(int argc, char **argv) { printf("恭喜 %-15s買了%9d 張 %s, 獲得 %d 枚P幣\n" ,userid, num, betname[mybet], money * num); - if((uid=getuser(userid))==0) continue; + if((uid=searchuser(userid))==0) continue; deumoney(uid, money * num); sprintf(genbuf, BBSHOME "/home/%c/%s", userid[0], userid); stampfile(genbuf, &mymail); diff --git a/util/toplazyBBM.c b/util/toplazyBBM.c index 739539a5..c46d029b 100644 --- a/util/toplazyBBM.c +++ b/util/toplazyBBM.c @@ -9,7 +9,6 @@ extern boardheader_t *bcache; extern int numboards; boardheader_t allbrd[MAX_BOARD]; -extern userec_t xuser; typedef struct lostbm { char *bmname; char *title; @@ -89,12 +88,14 @@ int main(int argc, char *argv[]) char *p, bmbuf[IDLEN * 3 + 3]; int index = 0, flag = 0, k, n; p=strtok(allbrd[i].BM,"/ "); + userec_t xuser; + if(p) do { if(allbrd[i].brdname[0] == '\0' || (allbrd[i].brdattr & BRD_GROUPBOARD) ==0 ) continue; if (*p == '[' ){p[strlen(p)-1]='\0'; p++;} - bmid=getuser(p); + bmid=getuser(p, &xuser); bms[index].bmname = p; bms[index].flag = 0; if (((((int)time(NULL)-(int)xuser.lastlogin)/(60*60*24))>=7) diff --git a/util/toplazyBM.c b/util/toplazyBM.c index 5e74478b..8ca20443 100644 --- a/util/toplazyBM.c +++ b/util/toplazyBM.c @@ -7,7 +7,6 @@ extern boardheader_t *bcache; extern int numboards; boardheader_t allbrd[MAX_BOARD]; -extern userec_t xuser; typedef struct lostbm { char *bmname; char *title; @@ -87,6 +86,8 @@ int main(int argc, char *argv[]) char *p, bmbuf[IDLEN * 3 + 3]; int index = 0, flag = 0, k, n; p = allbrd[i].BM; + userec_t xuser; + if(*p=='[') p++; if(allbrd[i].brdname[0] == '\0' || !isalpha(allbrd[i].brdname[0]) @@ -98,7 +99,7 @@ int main(int argc, char *argv[]) if(!p[0]) {index--; p=strtok(NULL,"/ ]"); continue;} - bmid=getuser(p); + bmid=getuser(p, &xuser); bms[index].bmname = p; bms[index].flag = 0; if ((now-xuser.lastlogin)>=45*86400 |