Fixed nlookup and bfindex for pointlist handling. Added -C config option to utils. Updated man-files
This commit is contained in:
@@ -58,6 +58,7 @@ struct debuglevel {
|
||||
{ "Daemon", D_DAEMON },
|
||||
{ "Free", D_FREE },
|
||||
{ "24554", D_24554 },
|
||||
{ "Index", D_INDEX },
|
||||
// { "Daemon", D_DAEMON },
|
||||
{ "Full", D_FULL },
|
||||
{ NULL, 0 }
|
||||
|
||||
@@ -198,6 +198,54 @@ int nodelist_parse_Txy(s_node *node, const char *xy)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* Pointlist string parser
|
||||
*
|
||||
* Arguments:
|
||||
* node put here all obtained information
|
||||
* str pointer to the nodelist string
|
||||
*
|
||||
* Return value:
|
||||
* zero value if string was parsed successfuly, and non-zero if wasn't
|
||||
*/
|
||||
int nodelist_parsepoint(s_node *node, char *str)
|
||||
{
|
||||
char *argv[NODELIST_POSFLAGS+1];
|
||||
char *p;
|
||||
int cnt;
|
||||
|
||||
DEB((D_NODELIST,"nodelist: parsepoint %s", str));
|
||||
|
||||
cnt = string_parse(argv, NODELIST_POSFLAGS+1, str, ',');
|
||||
if( cnt < NODELIST_POSFLAGS-1 )
|
||||
return -1;
|
||||
DEB((D_NODELIST,"nodelist: parsepoint OK: %d", cnt));
|
||||
strnxcpy(node->name, argv[NODELIST_POSNAME], sizeof(node->name));
|
||||
DEB((D_NODELIST,"nodelist: parsepoint sys: %s", node->name));
|
||||
strnxcpy(node->location, argv[NODELIST_POSLOCATION], sizeof(node->location));
|
||||
DEB((D_NODELIST,"nodelist: parsepoint loc: %s", node->location));
|
||||
strnxcpy(node->sysop, argv[NODELIST_POSSYSOP], sizeof(node->sysop));
|
||||
DEB((D_NODELIST,"nodelist: parsepoint zyz: %s", node->sysop));
|
||||
strnxcpy(node->phone, argv[NODELIST_POSPHONE], sizeof(node->phone));
|
||||
DEB((D_NODELIST,"nodelist: parsepoint pho: %s", node->phone));
|
||||
if (argv[NODELIST_POSFLAGS])
|
||||
strnxcpy(node->flags, argv[NODELIST_POSFLAGS], sizeof(node->flags));
|
||||
DEB((D_NODELIST,"nodelist: parsepoint fl: %s", node->flags));
|
||||
if (argv[NODELIST_POSSPEED])
|
||||
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));
|
||||
/*
|
||||
* Replace all '_' by space character
|
||||
*/
|
||||
string_replchar(node->name, '_', ' ');
|
||||
string_replchar(node->location, '_', ' ');
|
||||
string_replchar(node->sysop, '_', ' ');
|
||||
node->keyword = KEYWORD_POINT;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* Nodelist string parser
|
||||
*
|
||||
@@ -212,7 +260,7 @@ int nodelist_parsestring(s_node *node, char *str)
|
||||
{
|
||||
char *argv[NODELIST_POSFLAGS+1];
|
||||
char *p;
|
||||
|
||||
DEB((D_NODELIST,"nodelist: parsestring %s", str));
|
||||
if( string_parse(argv, NODELIST_POSFLAGS+1, str, ',') != NODELIST_POSFLAGS+1 )
|
||||
return -1;
|
||||
|
||||
@@ -671,6 +719,7 @@ int nodelist_lookup_string(char *buffer, size_t buflen, s_faddr addr)
|
||||
*/
|
||||
for( ptrl = conf_first(cf_nodelist); ptrl; ptrl = conf_next(ptrl) )
|
||||
{
|
||||
DEB((D_NODELIST,"nl_lookup_string: using %s",ptrl->d.falist.what));
|
||||
if( ftn_addrcomp_mask(addr, ptrl->d.falist.addr) == 0 )
|
||||
{
|
||||
if( (nlp = nodelist_open(ndldir, ptrl->d.falist.what, NODELIST_READ)) )
|
||||
@@ -701,10 +750,24 @@ int nodelist_lookup(s_node *node, s_faddr addr)
|
||||
if( nodelist_lookup_string(buf, sizeof(buf), addr) == 0 )
|
||||
{
|
||||
node->listed = TRUE;
|
||||
if( nodelist_parsestring(node, buf) == -1 )
|
||||
if (addr.point == 0)
|
||||
{
|
||||
log("invalid nodelist string for address %s",
|
||||
ftn_addrstr(abuf, addr));
|
||||
if( nodelist_parsestring(node, buf) == -1 )
|
||||
{
|
||||
DEB((D_NODELIST,"invalid nodelist string for address %s",
|
||||
ftn_addrstr(abuf, addr)));
|
||||
log("invalid nodelist string for address %s",
|
||||
ftn_addrstr(abuf, addr));
|
||||
}
|
||||
} else {
|
||||
if ( nodelist_parsepoint(node, buf) == -1 )
|
||||
{
|
||||
DEB((D_NODELIST,"invalid nodelist string for address %s",
|
||||
ftn_addrstr(abuf, addr)));
|
||||
log("invalid nodelist string for address %s",
|
||||
ftn_addrstr(abuf, addr));
|
||||
}
|
||||
node->addr = addr;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -598,6 +598,8 @@ int string_parse(char **dest, int items, char *str, int separator)
|
||||
{
|
||||
int count = 0;
|
||||
char *p = str;
|
||||
//if ( *((unsigned char *)p) == separator )
|
||||
// p++;
|
||||
|
||||
dest[count++] = str;
|
||||
|
||||
@@ -606,6 +608,7 @@ int string_parse(char **dest, int items, char *str, int separator)
|
||||
if( *((unsigned char *)p) == separator )
|
||||
{
|
||||
*p++ = '\0';
|
||||
// DEB((D_INDEX,"Parsed string: %s", dest[count]));
|
||||
dest[count++] = p;
|
||||
} else
|
||||
++p;
|
||||
|
||||
Reference in New Issue
Block a user