summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-06-02 15:10:49 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-06-02 15:10:49 +0800
commitcf4b4dd8042b811fe537ab9a3ab23028ea2a7c49 (patch)
tree2d2a9d0fef5d4a4945f54b96a2754e228f90f9ff
parente0bbefae19d6a7a39316873ec1afffb1ed9f8094 (diff)
downloadpttbbs-cf4b4dd8042b811fe537ab9a3ab23028ea2a7c49.tar
pttbbs-cf4b4dd8042b811fe537ab9a3ab23028ea2a7c49.tar.gz
pttbbs-cf4b4dd8042b811fe537ab9a3ab23028ea2a7c49.tar.bz2
pttbbs-cf4b4dd8042b811fe537ab9a3ab23028ea2a7c49.tar.lz
pttbbs-cf4b4dd8042b811fe537ab9a3ab23028ea2a7c49.tar.xz
pttbbs-cf4b4dd8042b811fe537ab9a3ab23028ea2a7c49.tar.zst
pttbbs-cf4b4dd8042b811fe537ab9a3ab23028ea2a7c49.zip
fixbfriend
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@274 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--util/shmctl.c38
1 files changed, 30 insertions, 8 deletions
diff --git a/util/shmctl.c b/util/shmctl.c
index 17b9dc42..f2ed2973 100644
--- a/util/shmctl.c
+++ b/util/shmctl.c
@@ -14,6 +14,7 @@
extern struct utmpfile_t *utmpshm;
extern struct pttcache_t *ptt;
+extern bcache_t *brdshm;
int logout_friend_online(userinfo_t *utmp)
{
@@ -292,18 +293,39 @@ int setglobe(int argc, char **argv)
return 0;
}
+int fixbfriend(int argc, char **argv)
+{
+ userinfo_t *ptr;
+ int count, i;
+
+ for( i = 0 ; i < MAX_BOARD ; ++i ){
+ if( isdigit(brdshm->bcache[i].brdname[0]) ||
+ isalpha(brdshm->bcache[i].brdname[0]) ){
+ for( count = 0, ptr = brdshm->bcache[i].u ;
+ ptr != NULL && count < 256 ;
+ ++count, ptr = ptr->nextbfriend )
+ ;
+ printf("counting %s\n", brdshm->bcache[i].brdname);
+ brdshm->bcache[i].nuser = ((count == 256) ? 0 : count);
+ }
+ }
+
+ return 0;
+}
+
struct {
int (*func)(int, char **);
char *cmd, *descript;
} cmd[] =
- { {utmpfix, "utmpfix", "clear dead userlist entry"},
- {utmpstate, "utmpstate", "list utmpstate"},
- {utmpreset, "utmpreset", "utmpshm->busystate=0"},
- {utmpsort, "utmpsort", "sort ulist"},
- {utmpwatch, "utmpwatch", "to see if busystate is always 1 then fix it"},
- {utmpnum, "utmpnum", "print utmpshm->number for snmpd"},
- {showglobe, "showglobe", "show GLOBE"},
- {setglobe, "setglobe", "set GLOBE"},
+ { {utmpfix, "utmpfix", "clear dead userlist entry"},
+ {utmpstate, "utmpstate", "list utmpstate"},
+ {utmpreset, "utmpreset", "utmpshm->busystate=0"},
+ {utmpsort, "utmpsort", "sort ulist"},
+ {utmpwatch, "utmpwatch", "to see if busystate is always 1 then fix it"},
+ {utmpnum, "utmpnum", "print utmpshm->number for snmpd"},
+ {showglobe, "showglobe", "show GLOBE"},
+ {setglobe, "setglobe", "set GLOBE"},
+ {fixbfriend, "fixbfriend", "recount numbers of board friends"},
{NULL, NULL, NULL} };
int main(int argc, char **argv)