From fab9796001a2663fcbd9364f5883c1a6133dc6bf Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Wed, 8 Sep 2004 23:58:44 +0000
Subject: [PATCH] Added command (H) to dump hash file.

---
 src/sbbs3/smbutil.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/src/sbbs3/smbutil.c b/src/sbbs3/smbutil.c
index a9bf13dc43..8bfa17ae88 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;
-- 
GitLab