Commit 8140b004 authored by rswindell's avatar rswindell
Browse files

Copy the message attribute parsing/displaying logic from fmsgdump.

parent b3c4b48d
......@@ -48,6 +48,29 @@ bool freadstr(FILE* fp, char* str, size_t maxlen)
return str[maxlen-1] == 0;
}
const char* fmsgattr_str(uint16_t attr)
{
static char str[64] = "";
#define FIDO_ATTR_CHECK(a, f) if(a&FIDO_##f) sprintf(str + strlen(str), "%s%s", str[0] == 0 ? "" : ", ", #f);
FIDO_ATTR_CHECK(attr, PRIVATE);
FIDO_ATTR_CHECK(attr, CRASH);
FIDO_ATTR_CHECK(attr, RECV);
FIDO_ATTR_CHECK(attr, SENT);
FIDO_ATTR_CHECK(attr, FILE);
FIDO_ATTR_CHECK(attr, INTRANS);
FIDO_ATTR_CHECK(attr, ORPHAN);
FIDO_ATTR_CHECK(attr, KILLSENT);
FIDO_ATTR_CHECK(attr, LOCAL);
FIDO_ATTR_CHECK(attr, HOLD);
FIDO_ATTR_CHECK(attr, FREQ);
FIDO_ATTR_CHECK(attr, RRREQ);
FIDO_ATTR_CHECK(attr, RR);
FIDO_ATTR_CHECK(attr, AUDIT);
FIDO_ATTR_CHECK(attr, FUPREQ);
return str;
}
int pktdump(FILE* fp, const char* fname, FILE* good, FILE* bad)
{
int ch,lastch=0;
......@@ -198,7 +221,7 @@ int pktdump(FILE* fp, const char* fname, FILE* good, FILE* bad)
,pkdmsg.type
,pkdmsg.orignet, pkdmsg.orignode
,pkdmsg.destnet, pkdmsg.destnode);
printf("Attribute: %04X\n",pkdmsg.attr);
printf("Attribute: 0x%04X (%s)\n",pkdmsg.attr, fmsgattr_str(pkdmsg.attr));
printf("Date/Time: %s\n",pkdmsg.time);
/* Display variable-length fields */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment