summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-07-04 10:31:58 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-07-04 10:31:58 +0800
commit3b9ca23f6101423bfe6dc3eadfde925484aeea77 (patch)
treea332cc09fad1bcb07c52a239792aeeda96cfca2d /util
parent71ed0fbf805d126162e25a9ada6d49fa2d84d3e3 (diff)
downloadpttbbs-3b9ca23f6101423bfe6dc3eadfde925484aeea77.tar
pttbbs-3b9ca23f6101423bfe6dc3eadfde925484aeea77.tar.gz
pttbbs-3b9ca23f6101423bfe6dc3eadfde925484aeea77.tar.bz2
pttbbs-3b9ca23f6101423bfe6dc3eadfde925484aeea77.tar.lz
pttbbs-3b9ca23f6101423bfe6dc3eadfde925484aeea77.tar.xz
pttbbs-3b9ca23f6101423bfe6dc3eadfde925484aeea77.tar.zst
pttbbs-3b9ca23f6101423bfe6dc3eadfde925484aeea77.zip
add listbrd
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@1014 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'util')
-rw-r--r--util/shmctl.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/util/shmctl.c b/util/shmctl.c
index b7ca5dab..66c9888e 100644
--- a/util/shmctl.c
+++ b/util/shmctl.c
@@ -1,4 +1,4 @@
-/* $Id: shmctl.c,v 1.43 2003/06/21 05:27:03 in2 Exp $ */
+/* $Id: shmctl.c,v 1.44 2003/07/04 02:31:58 in2 Exp $ */
#include "bbs.h"
#include <sys/wait.h>
@@ -403,6 +403,34 @@ int listpid(int argc, char **argv)
return 0;
}
+int listbrd(int argc, char **argv)
+{
+ int i, ch;
+ int noHidden = 0;
+
+ while( (ch = getopt(argc, argv, "hn")) != -1 )
+ switch( ch ){
+ case 'n':
+ noHidden = 1;
+ break;
+ case 'h':
+ default:
+ printf("usage:\tshmctl\tlistbrd [-n]\n"
+ "\t-n no hidden board\n");
+ return 0;
+ }
+
+ for( i = 0 ; i < MAX_BOARD ; ++i )
+ if( bcache[i].brdname[0] && !(bcache[i].brdattr & BRD_GROUPBOARD) &&
+ (!noHidden ||
+ !((bcache[i].brdattr & BRD_HIDE) ||
+ (bcache[i].level && !(bcache[i].brdattr & BRD_POSTMASK) &&
+ (bcache[i].level &
+ ~(PERM_BASIC|PERM_CHAT|PERM_PAGE|PERM_POST|PERM_LOGINOK))))) )
+ printf("%s\n", bcache[i].brdname);
+ return 0;
+}
+
#ifdef OUTTA_TIMER
int timed(int argc, char **argv)
{
@@ -418,7 +446,6 @@ int timed(int argc, char **argv)
}
#endif
-
struct {
int (*func)(int, char **);
char *cmd, *descript;
@@ -432,6 +459,7 @@ struct {
{showglobal, "showglobal", "show GLOBALVAR[]"},
{setglobal, "setglobal", "set GLOBALVAR[]"},
{listpid, "listpid", "list all pids of mbbsd"},
+ {listbrd, "listbrd", "list board info in SHM"},
#ifdef OUTTA_TIMER
{timed, "timed", "time daemon for OUTTA_TIMER"},
#endif