diff --git a/source/bforce/nodelist.c b/source/bforce/nodelist.c index 9d6a87e..93375ec 100644 --- a/source/bforce/nodelist.c +++ b/source/bforce/nodelist.c @@ -230,6 +230,8 @@ int nodelist_parsepoint(s_node *node, char *str) DEB((D_NODELIST,"nodelist: parsepoint pho: %s", node->phone)); if (argv[NODELIST_POSFLAGS]) strnxcpy(node->flags, argv[NODELIST_POSFLAGS], sizeof(node->flags)); + else + memset(node->flags,'\0',sizeof(node->flags)); DEB((D_NODELIST,"nodelist: parsepoint fl: %s", node->flags)); if (argv[NODELIST_POSSPEED]) node->speed = atoi(argv[NODELIST_POSSPEED]); @@ -296,7 +298,10 @@ int nodelist_parsestring(s_node *node, char *str) strnxcpy(node->location, argv[NODELIST_POSLOCATION], sizeof(node->location)); strnxcpy(node->sysop, argv[NODELIST_POSSYSOP], sizeof(node->sysop)); strnxcpy(node->phone, argv[NODELIST_POSPHONE], sizeof(node->phone)); - strnxcpy(node->flags, argv[NODELIST_POSFLAGS], sizeof(node->flags)); + if (argv[NODELIST_POSFLAGS]) + strnxcpy(node->flags, argv[NODELIST_POSFLAGS], sizeof(node->flags)); + else + memset(node->flags,'\0',sizeof(node->flags)); node->speed = atoi(argv[NODELIST_POSSPEED]); DEB((D_NODELIST, "nodelist: Parsed common values SYS: %s, ZYZ: %s, LOC: %s, PHONE: %s", node->name, node->sysop, node->location, node->phone)); /* @@ -718,9 +723,7 @@ int nodelist_putindex(s_nodelist *nlp, const s_bni *bni) buffer_putint(buffer + 6, bni->point); buffer_putint(buffer + 8, bni->hub); buffer_putlong(buffer + 10, bni->offset); - if (bni->point != 0) { - DEB((D_NODELIST, "nodelist: findindex found point z: %d, n: %d, l: %d, p: %d, offset: %l", bni->zone, bni->net, bni->node, bni->point, bni->offset)); - } + if( fwrite(buffer, sizeof(buffer), 1, nlp->fp_index) != 1 ) { logerr("error writing nodelist index file \"%s\"", nlp->name_index); @@ -755,10 +758,6 @@ int nodelist_findindex(s_nodelist *nlp, s_bni *bni, s_faddr addr) bni->point = buffer_getint(p + 6); bni->hub = buffer_getint(p + 8); bni->offset = buffer_getlong(p + 10); - if ((uint32_t)nlp->endian == 0xBEEFDEAD) { - swap_long((char *)&bni->offset); - } - DEB((D_NODELIST, "nodelist: findindex found" )); return 0; } p += NODELIST_ENTRYSIZE; diff --git a/source/bforce/u_misc.c b/source/bforce/u_misc.c index 4d78dc9..81ae134 100644 --- a/source/bforce/u_misc.c +++ b/source/bforce/u_misc.c @@ -311,15 +311,6 @@ int buffer_getint(const char *buffer) | ( (unsigned int) ((unsigned char) buffer[1]) << 8 ); } -void swap_long(char *buffer){ - char *temp = xmemcpy(buffer, sizeof(uint32_t)); - temp[0] = buffer[2]; - temp[1] = buffer[3]; - temp[2] = buffer[0]; - temp[3] = buffer[1]; - memcpy(buffer,temp,sizeof(uint32_t)); -} - void printf_usage(const char *ident, const char *fmt, ...) { va_list args; diff --git a/source/include/util.h b/source/include/util.h index 8c19b06..4f7d24e 100644 --- a/source/include/util.h +++ b/source/include/util.h @@ -189,7 +189,6 @@ char *buffer_putlong(char *buffer, long val); char *buffer_putint(char *buf, int val); long buffer_getlong(const char *buf); int buffer_getint(const char *buf); -void swap_long(char *buffer); void printf_usage(const char *ident, const char *fmt, ...);