Skip to content
Snippets Groups Projects
Commit d304f784 authored by rswindell's avatar rswindell
Browse files

Improved the msghdr() function - used to display message headers to the sysop

(advanced sysop command for debugging purposes).
parent 0caec07c
No related branches found
No related tags found
No related merge requests found
......@@ -81,7 +81,7 @@ void sbbs_t::listmsgs(int subnum, post_t HUGE16 *post, long i, long posts)
char *binstr(uchar *buf, ushort length)
{
static char str[128];
static char str[512];
char tmp[128];
int i;
......@@ -93,7 +93,8 @@ char *binstr(uchar *buf, ushort length)
return((char*)buf);
for(i=0;i<length;i++) {
sprintf(tmp,"%02X ",buf[i]);
strcat(str,tmp); }
strcat(str,tmp);
}
return(str);
}
......@@ -102,13 +103,60 @@ void sbbs_t::msghdr(smbmsg_t* msg)
{
int i;
/* required variable fields */
bprintf("%-20.20s %s\r\n" ,"subj" ,msg->subj);
bprintf("%-20.20s %s\r\n" ,"from" ,msg->from);
bprintf("%-20.20s %s\r\n" ,"to" ,msg->to);
/* fixed fields */
bprintf("%-20.20s %s %s\r\n","when_written"
,timestr((time_t *)&msg->hdr.when_written.time), zonestr(msg->hdr.when_written.zone));
bprintf("%-20.20s %s %s\r\n","when_imported"
,timestr((time_t *)&msg->hdr.when_imported.time), zonestr(msg->hdr.when_imported.zone));
bprintf("%-20.20s %04Xh\r\n","type" ,msg->hdr.type);
bprintf("%-20.20s %04Xh\r\n","version" ,msg->hdr.version);
bprintf("%-20.20s %04Xh\r\n","attr" ,msg->hdr.attr);
bprintf("%-20.20s %08lXh\r\n","auxattr" ,msg->hdr.auxattr);
bprintf("%-20.20s %08lXh\r\n","netattr" ,msg->hdr.netattr);
bprintf("%-20.20s %ld\r\n" ,"number" ,msg->hdr.number);
/* optional fixed fields */
if(msg->hdr.thread_orig)
bprintf("%-20.20s %ld\r\n" ,"thread_orig" ,msg->hdr.thread_orig);
if(msg->hdr.thread_next)
bprintf("%-20.20s %ld\r\n" ,"thread_next" ,msg->hdr.thread_next);
if(msg->hdr.thread_first)
bprintf("%-20.20s %ld\r\n" ,"thread_first" ,msg->hdr.thread_first);
if(msg->hdr.delivery_attempts)
bprintf("%-20.20s %hu\r\n" ,"delivery_attempts",msg->hdr.delivery_attempts);
if(msg->hdr.times_downloaded)
bprintf("%-20.20s %lu\r\n" ,"times_downloaded" ,msg->hdr.times_downloaded);
if(msg->hdr.last_downloaded)
bprintf("%-20.20s %s\r\n" ,"last_downloaded" ,timestr((time_t*)&msg->hdr.last_downloaded));
if(msg->expiration)
bprintf("%-20.20s %s\r\n" ,"expiration"
,timestr((time_t *)&msg->expiration));
if(msg->priority)
bprintf("%-20.20s %lu\r\n" ,"priority" ,msg->priority);
if(msg->cost)
bprintf("%-20.20s %lu\r\n" ,"cost" ,msg->cost);
bprintf("%-20.20s %06lXh\r\n" ,"header offset" ,msg->idx.offset);
bprintf("%-20.20s %u\r\n" ,"header length" ,msg->hdr.length);
for(i=0;i<msg->total_hfields;i++)
bprintf("hfield[%u].type %02Xh\r\n"
"hfield[%u].length %d\r\n"
"hfield[%u]_dat %s\r\n"
bprintf("field[%u].type %02Xh\r\n"
"field[%u].length %d\r\n"
"field[%u]_dat %s\r\n"
,i,msg->hfield[i].type
,i,msg->hfield[i].length
,i,binstr((uchar *)msg->hfield_dat[i],msg->hfield[i].length));
bprintf("%-20.20s %06lXh\r\n" ,"data offset" ,msg->hdr.offset);
for(i=0;i<msg->hdr.total_dfields;i++)
bprintf("data field[%u].type %02Xh\r\n"
"data field[%u].offset %lu\r\n"
"data field[%u].length %lu\r\n"
,i,msg->dfield[i].type
,i,msg->dfield[i].offset
,i,msg->dfield[i].length);
}
/****************************************************************************/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment