summaryrefslogtreecommitdiffstats
path: root/util/showboard.c
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-04-20 21:48:18 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-04-20 21:48:18 +0800
commitb9eee7301a59036c791b0cabef44092aaedc9c80 (patch)
tree3e7a9d9a9473b01641b9ef5aaafc015e235c601f /util/showboard.c
parenteaa73de381ee283ff5e0da64ee49bfecddb21723 (diff)
downloadpttbbs-b9eee7301a59036c791b0cabef44092aaedc9c80.tar
pttbbs-b9eee7301a59036c791b0cabef44092aaedc9c80.tar.gz
pttbbs-b9eee7301a59036c791b0cabef44092aaedc9c80.tar.bz2
pttbbs-b9eee7301a59036c791b0cabef44092aaedc9c80.tar.lz
pttbbs-b9eee7301a59036c791b0cabef44092aaedc9c80.tar.xz
pttbbs-b9eee7301a59036c791b0cabef44092aaedc9c80.tar.zst
pttbbs-b9eee7301a59036c791b0cabef44092aaedc9c80.zip
convenient board watcher tools.
Suggestion: .BRD should have '0RootClass' as first board ([0]). Because the buggy board class thinks .BRD[0] as class root. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2702 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'util/showboard.c')
-rw-r--r--util/showboard.c56
1 files changed, 49 insertions, 7 deletions
diff --git a/util/showboard.c b/util/showboard.c
index 0b473569..77bde9f1 100644
--- a/util/showboard.c
+++ b/util/showboard.c
@@ -16,11 +16,11 @@ int main(argc, argv)
int argc;
char *argv[];
{
- int inf, i, count;
+ int inf, i = 0, detail_i = 0, count;
if (argc < 2)
{
- printf("Usage:\t%s .BRD [MAXUSERS]\n", argv[0]);
+ printf("Usage:\t%s .BRD [bid]\n", argv[0]);
exit(1);
}
@@ -47,16 +47,58 @@ int main(argc, argv)
/* sort them by name */
count = i;
+#if 0
qsort(allbrd, count, sizeof(boardheader_t), board_cmp);
+#endif
/* write out the target file */
- printf(
- "看板名稱 板主 類別 中文敘述\n"
- "----------------------------------------------------------------------\n");
- for (i = 0; i < count; i++)
+ if (argc > 2)
{
- printf("%-13s%-25.25s%s\n", allbrd[i].brdname, allbrd[i].BM, allbrd[i].title);
+ detail_i = atoi(argv[2]);
+ if (detail_i >= count)
+ detail_i = -1;
+ } else {
+ detail_i = -1;
+ }
+
+ if (detail_i < 0) {
+ printf(
+ " 看板名稱 板主 類別 中文敘述\n"
+ " -----------------------------------------------------------------\n");
+ for (i = 0; i < count; i++)
+ {
+ printf("%4d %-13s%-25.25s%s\n", i, allbrd[i].brdname, allbrd[i].BM, allbrd[i].title);
+ }
+ } else {
+ /* print details */
+ boardheader_t b = allbrd[detail_i];
+ printf("brdname(bid):\t%s\n", b.brdname);
+ printf("title:\t%s\n", b.title);
+ printf("BM:\t%s\n", b.BM);
+ printf("brdattr:\t%08x\n", b.brdattr);
+ printf("post_limit_posts:\t%d\n", b.post_limit_posts);
+ printf("post_limit_logins:\t%d\n", b.post_limit_logins);
+ printf("post_limit_regtime:\t%d\n", b.post_limit_regtime);
+ printf("level:\t%d\n", b.level);
+ printf("gid:\t%d\n", b.gid);
+ printf("parent:\t%d\n", b.parent);
+ printf("childcount:\t%d\n", b.childcount);
+ printf("nuser:\t%d\n", b.nuser);
+
+ printf("next[0]:\t%d\n", b.next[0]);
+ printf("next[1]:\t%d\n", b.next[1]);
+ printf("firstchild[0]:\t%d\n", b.firstchild[0]);
+ printf("firstchild[1]:\t%d\n", b.firstchild[1]);
+ /* traverse to find my children */
+ printf("---- children: ---- \n");
+ for (i = 0; i < count; i++)
+ {
+ if(allbrd[i].gid == detail_i)
+ printf("%4d %-13s%-25.25s%s\n",
+ i, allbrd[i].brdname,
+ allbrd[i].BM, allbrd[i].title);
+ }
}
return 0;
}