TIP: Click on subject to list as thread! ANSI
echo: fidosoft.husky
to: Rob Swindell
from: andrew clarke
date: 2016-05-25 02:55:48
subject: pktinfo for everyone

23 May 16 14:24, you wrote to Alan Ianson:

 >> Is it possible to have a pktinfo that doesn't depend on fido.config?
 >> I have fidoconfig myself so it's not a problem for me, but for others
 >> who don't use husky?

 >> Is there an external utility maybe by perl or something to inspect
 >> pkt files? I would like to have a utility that can tell me the
 >> version of pkt that I have if there is such a thing.

 RS> I wrote one:
 RSftp://vert.synchro.net/main/bbs/pktdump.exe

 RS> The source code is here:
 RShttp://cvs.synchro.net/cgi-bin/viewcvs.cgi/src/sbbs3/pktdump.c

You also need the following header files

dirwrap.h
fidodefs.h
gen_defs.h
wrapdll.h
xpendian.h

from here:

http://cvs.synchro.net/cgi-bin/viewcvs.cgi/src/xpdev/


Building with:

cc -Wall -s -DXPDEV_DONT_DEFINE_INTTYPES=1 -o pktdump pktdump.c

CLang on FreeBSD 10.3 spits out some warnings:

pktdump.c:26:3: warning: implicitly declaring library function 'strcat'
with type 'char *(char *, const char *)'
                strcat(str,point); }
                ^
pktdump.c:26:3: note: please include the header  or
explicitly provide a declaration for 'strcat'
pktdump.c:29:2: warning: implicitly declaring library function 'strcpy'
with type 'char *(char *, const char *)'
        strcpy(outstr,str);
        ^
pktdump.c:29:2: note: please include the header  or
explicitly provide a declaration for 'strcpy'
pktdump.c:67:11: warning: format specifies type 'unsigned int' but the
argument has type 'unsigned long' [-Wformat]
                        ,fname,sizeof(pkthdr));
                               ^~~~~~~~~~~~~~
pktdump.c:73:5: warning: implicitly declaring library function 'memcmp'
with type 'int (const void *, const void *, unsigned long)'
        if(memcmp(buf,"\x00\x00",2)) {
           ^
pktdump.c:73:5: note: please include the header  or
explicitly provide a declaration for 'memcmp'
pktdump.c:124:32: warning: field precision should have type 'int', but
argument has type 'unsigned long' [-Wformat]
                fprintf(stdout,"Password:
'%.*s'\n",sizeof(pkthdr.type2.password),pkthdr.type2.password);
                                           ~~^~     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pktdump.c:196:49: warning: format specifies type 'int' but the argument has
type 'unsigned long' [-Wformat]
                printf("sizeof(fpkthdr_t)=%d, expected:
%d\n",sizeof(fpkthdr_t),FIDO_PACKET_HDR_LEN);
                                          ~~                  ^~~~~~~~~~~~~~~~~
                                          %lu
pktdump.c:200:49: warning: format specifies type 'int' but the argument has
type 'unsigned long' [-Wformat]
                printf("sizeof(fpkdmsg_t)=%d, expected:
%d\n",sizeof(fpkdmsg_t),FIDO_PACKED_MSG_HDR_LEN);
                                          ~~                  ^~~~~~~~~~~~~~~~~
                                          %lu
pktdump.c:204:49: warning: format specifies type 'int' but the argument has
type 'unsigned long' [-Wformat]
                printf("sizeof(fmsghdr_t)=%d, expected:
%d\n",sizeof(fmsghdr_t),FIDO_STORED_MSG_HDR_LEN);
                                          ~~                  ^~~~~~~~~~~~~~~~~
                                          %lu
8 warnings generated.


Here's a patch:

-+- pktdump.c.orig      2016-05-25 02:42:08.889406000 +1000
+++ pktdump.c   2016-05-25 02:51:09.002495601 +1000
{at}{at} -6,6 +6,7 {at}{at}
 #include "xpendian.h"  /* swap */
 #include "dirwrap.h"   /* _PATH_DEVNULL */
 #include 
+#include 

 FILE* nulfp;
 FILE* bodyfp;
{at}{at} -64,7 +65,7 {at}{at}

        if(fread(&pkthdr,sizeof(pkthdr),1,fp) != 1) {
                fprintf(stderr,"%s !Error reading pkthdr (%u bytes)\n"
-                       ,fname,sizeof(pkthdr));
+                       ,fname,(unsigned)sizeof(pkthdr));
                return(-1);
        }

{at}{at} -121,7 +122,7 {at}{at}
        printf(" to %s%s\n"     ,faddrtoa(&dest,NULL),destdomn);

        if(pkthdr.type2.password[0])
-               fprintf(stdout,"Password:
'%.*s'\n",sizeof(pkthdr.type2.password),pkthdr.type2.password);
+               fprintf(stdout,"Password:
'%.*s'\n",(unsigned)sizeof(pkthdr.type2.password),pkthdr.type2.password);

        fseek(fp,sizeof(pkthdr),SEEK_SET);

{at}{at} -193,15 +194,15 {at}{at}
        bodyfp=nulfp;

        if(sizeof(fpkthdr_t)!=FIDO_PACKET_HDR_LEN) {
-               printf("sizeof(fpkthdr_t)=%d, expected:
%d\n",sizeof(fpkthdr_t),FIDO_PACKET_HDR_LEN);
+               printf("sizeof(fpkthdr_t)=%d, expected:
%d\n",(unsigned)sizeof(fpkthdr_t),FIDO_PACKET_HDR_LEN);
                return(-1);
        }
        if(sizeof(fpkdmsg_t)!=FIDO_PACKED_MSG_HDR_LEN) {
-               printf("sizeof(fpkdmsg_t)=%d, expected:
%d\n",sizeof(fpkdmsg_t),FIDO_PACKED_MSG_HDR_LEN);
+               printf("sizeof(fpkdmsg_t)=%d, expected:
%d\n",(unsigned)sizeof(fpkdmsg_t),FIDO_PACKED_MSG_HDR_LEN);
                return(-1);
        }
        if(sizeof(fmsghdr_t)!=FIDO_STORED_MSG_HDR_LEN) {
-               printf("sizeof(fmsghdr_t)=%d, expected:
%d\n",sizeof(fmsghdr_t),FIDO_STORED_MSG_HDR_LEN);
+               printf("sizeof(fmsghdr_t)=%d, expected:
%d\n",(unsigned)sizeof(fmsghdr_t),FIDO_STORED_MSG_HDR_LEN);
                return(-1);
        }

--- GoldED+/BSD 1.1.5-b20160201
* Origin: Blizzard of Ozz, Melbourne, Victoria, Australia (3:633/267)
SEEN-BY: 633/267 712/848
@PATH: 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.