void dumpclass(int gid) { boardheader_t *bptr; int bid; const int type = BRD_GROUP_LL_TYPE_NAME; bptr = getbcache(gid); if (bptr->firstchild[type] == 0 || bptr->childcount <= 0) resolve_board_group(gid, type); printf("$db{'class.%d'} = $serializer->serialize([", gid); for( bid = bptr->firstchild[type] ; bid > 0 ; bid = bptr->next[type] ) { bptr = getbcache(bid); if( (bptr->brdattr & (BRD_HIDE | BRD_TOP)) || (bptr->level && !(bptr->brdattr & BRD_POSTMASK) && (bptr->level & ~(PERM_BASIC|PERM_CHAT|PERM_PAGE|PERM_POST|PERM_LOGINOK))) ) continue; printf("%5d,\t", bid); parent[bid] = gid; } printf("]);\n"); bptr = getbcache(gid); for( bid = bptr->firstchild[type] ; bid > 0 ; bid = bptr->next[type] ) { bptr = getbcache(bid); if( (bptr->brdattr & (BRD_HIDE | BRD_TOP)) || (bptr->level && !(bptr->brdattr & BRD_POSTMASK) && (bptr->level & ~(PERM_BASIC|PERM_CHAT|PERM_PAGE|PERM_POST|PERM_LOGINOK))) ) continue; if( bptr->brdattr & BRD_GROUPBOARD ) dumpclass(bid); } }
void dumpclass(int gid) { boardheader_t *bptr; int bid; bptr = getbcache(gid); if (bptr->firstchild[0] == 0 || bptr->childcount <= 0) load_uidofgid(gid, 0); printf("$db{'class.%d'} = $serializer->serialize([", gid); for( bid = bptr->firstchild[0] ; bid > 0 ; bid = bptr->next[0] ) { bptr = getbcache(bid); if( (bptr->brdattr & (BRD_HIDE | BRD_TOP)) || (bptr->level && !(bptr->brdattr & BRD_POSTMASK) && (bptr->level & ~(PERM_BASIC|PERM_CHAT|PERM_PAGE|PERM_POST|PERM_LOGINOK))) ) continue; printf("%5d,\t", bid); parent[bid] = gid; } printf("]);\n"); bptr = getbcache(gid); for( bid = bptr->firstchild[0] ; bid > 0 ; bid = bptr->next[0] ) { bptr = getbcache(bid); if( (bptr->brdattr & (BRD_HIDE | BRD_TOP)) || (bptr->level && !(bptr->brdattr & BRD_POSTMASK) && (bptr->level & ~(PERM_BASIC|PERM_CHAT|PERM_PAGE|PERM_POST|PERM_LOGINOK))) ) continue; if( bptr->brdattr & BRD_GROUPBOARD ) dumpclass(bid); } }
int main(void) { attach_SHM(); printf("#!/usr/bin/perl\n" "# this is auto-generated perl module from boardlist.c\n" "# please do NOT modify this directly!\n" "# usage: make boardlist; ./boardlist | perl\n" "use DB_File;\n" "use Data::Serializer;\n" "\n" "unlink 'boardlist.db', 'boardlist.list';\n" "$serializer = Data::Serializer->new(serializer => 'Storable', digester => 'MD5',compress => 0,);\n" "tie %%db, 'DB_File', 'boardlist.db', (O_RDWR | O_CREAT), 0666, $DB_HASH;\n" ); dumpclass(1); dumpdetail(); dumpallbrdname(); printf("untie %%db;\n"); return 0; }