-
- /* Lame way of checking whether anyone else is doing this now */
- if (rr != NULL) {
- cprintf("%d Another FSCK is already running.\n", ERROR + RESOURCE_BUSY);
- return;
- }
-
- cprintf("%d Checking message reference counts\n", LISTING_FOLLOWS);
-
- cprintf("\nThis could take a while. Please be patient!\n\n");
- cprintf("Gathering pointers...\n");
- ForEachRoom(do_fsck_room, NULL);
-
- get_control();
- cprintf("Checking message base...\n");
- for (msgnum = 0L; msgnum <= CitControl.MMhighest; ++msgnum) {
-
- cdbmsg = cdb_fetch(CDB_MSGMAIN, &msgnum, sizeof(long));
- if (cdbmsg != NULL) {
- cdb_free(cdbmsg);
- cprintf("Message %7ld ", msgnum);
-
- GetMetaData(&smi, msgnum);
- cprintf("refcount=%-2d ", smi.meta_refcount);
-
- realcount = 0;
- for (ptr = rr; ptr != NULL; ptr = ptr->next) {
- if (ptr->msgnum == msgnum) ++realcount;
- }
- cprintf("realcount=%-2d\n", realcount);
-
- if ( (smi.meta_refcount != realcount)
- || (realcount == 0) ) {
- AdjRefCount(msgnum, (smi.meta_refcount - realcount));
- }
-
- }
-
- }
-
- cprintf("Freeing memory...\n");
- while (rr != NULL) {
- ptr = rr->next;
- free(rr);
- rr = ptr;
- }
-
- cprintf("Done!\n");
- cprintf("000\n");
-