diff --git a/src/sbbs3/smbutil.c b/src/sbbs3/smbutil.c index a9bf13dc436c4fdd1b0b5d046f26c15ba4800b73..8bfa17ae883ca9a08603c1603ec995854d45a0dd 100644 --- a/src/sbbs3/smbutil.c +++ b/src/sbbs3/smbutil.c @@ -105,6 +105,7 @@ char *usage= " i[f] = import msg from text file f (or use stdin)\n" " e[f] = import e-mail from text file f (or use stdin)\n" " n[f] = import netmail from text file f (or use stdin)\n" +" h = dump hash table\n" " s = display msg base status\n" " c = change msg base status\n" " d = delete all msgs\n" @@ -587,6 +588,28 @@ void viewmsgs(ulong start, ulong count) } } +/****************************************************************************/ +/****************************************************************************/ +void dump_hashes(void) +{ + int retval; + hash_t hash; + + if((retval=smb_open_hash(&smb))!=SMB_SUCCESS) { + fprintf(stderr,"\n\7!smb_open_hash returned %d: %s\n", retval, smb.last_error); + return; + } + + while(!smb_feof(smb.hash_fp)) { + if(smb_fread(&smb,&hash,sizeof(hash),smb.hash_fp)!=sizeof(hash)) + break; + printf("%-25s: %lu\n", "number", hash.number); + printf("%-25s: %lx\n", "flags", hash.flags); + printf("%-25s: %s\n", "source", smb_hfieldtype(hash.source)); + printf("%-25s: %s\n", "time", my_timestr(&hash.time)); + } +} + /****************************************************************************/ /* Maintain message base - deletes messages older than max age (in days) */ /* or messages that exceed maximum */ @@ -1565,6 +1588,9 @@ int main(int argc, char **argv) viewmsgs(atol(cmd+1),count); y=strlen(cmd)-1; break; + case 'H': + dump_hashes(); + break; case 'M': maint(); break;