Fixed nlookup and bfindex for pointlist handling. Added -C config option to utils. Updated man-files
This commit is contained in:
+31
-8
@@ -28,12 +28,13 @@ bool eventexpr(s_expr *expr)
|
||||
static void usage(void)
|
||||
{
|
||||
printf_usage("nodelist lookup utility",
|
||||
"usage: nlookup [-rmh] <address>\n"
|
||||
"usage: nlookup [-C config] [-rmh] <address>\n"
|
||||
"\n"
|
||||
"options:\n"
|
||||
" -r show nodelist string\n"
|
||||
" -m show email address\n"
|
||||
" -h show this help message\n"
|
||||
" -C config use config file\n"
|
||||
"\n"
|
||||
);
|
||||
}
|
||||
@@ -82,7 +83,7 @@ void print_nodeinfo(const s_node *node)
|
||||
timevec_check(&node->worktime, now) ? "false" : "true");
|
||||
}
|
||||
|
||||
if( node->sysop && *node->sysop && strcmp(node->sysop, "<none>") )
|
||||
if( (node->keyword != KEYWORD_POINT) && node->sysop && *node->sysop && strcmp(node->sysop, "<none>") )
|
||||
{
|
||||
char username[BNI_MAXSYSOP+1];
|
||||
|
||||
@@ -127,6 +128,8 @@ int main(int argc, char *argv[])
|
||||
s_node node;
|
||||
s_faddr addr;
|
||||
char ch;
|
||||
int rc = 0;
|
||||
char *confname = NULL;
|
||||
bool rawstring = FALSE;
|
||||
bool emailaddr = FALSE;
|
||||
|
||||
@@ -135,7 +138,7 @@ int main(int argc, char *argv[])
|
||||
/* Initialise current locale */
|
||||
(void)setlocale(LC_ALL, "");
|
||||
|
||||
while( (ch=getopt(argc, argv, "hrm")) != (char)-1 )
|
||||
while( (ch=getopt(argc, argv, "hdrmC:")) != (char)-1 )
|
||||
{
|
||||
switch( ch ) {
|
||||
case 'h':
|
||||
@@ -147,6 +150,10 @@ int main(int argc, char *argv[])
|
||||
case 'm':
|
||||
emailaddr = TRUE;
|
||||
break;
|
||||
case 'C':
|
||||
if( confname || !optarg ) { usage(); exit(BFERR_FATALERROR); }
|
||||
confname = (char *)xstrcpy(optarg);
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
exit(BFERR_FATALERROR);
|
||||
@@ -159,8 +166,18 @@ int main(int argc, char *argv[])
|
||||
exit(BFERR_FATALERROR);
|
||||
}
|
||||
|
||||
if( conf_readconf(conf_getconfname(), 0, false) )
|
||||
if( confname && *confname )
|
||||
rc = conf_readconf(confname, 0, false);
|
||||
else
|
||||
rc = conf_readconf(conf_getconfname(), 0, false);
|
||||
|
||||
if( rc )
|
||||
{
|
||||
DEB((D_NODELIST,"nlookup: Can not find config"));
|
||||
exit(BFERR_FATALERROR);
|
||||
}
|
||||
|
||||
DEB((D_NODELIST,"Starting nlookup"));
|
||||
|
||||
if( rawstring )
|
||||
{
|
||||
@@ -171,10 +188,16 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else if( nodelist_lookup(&node, addr) == 0 )
|
||||
{
|
||||
if( emailaddr )
|
||||
print_nodemail(&node);
|
||||
else
|
||||
print_nodeinfo(&node);
|
||||
if (addr.point == 0) {
|
||||
if( emailaddr )
|
||||
print_nodemail(&node);
|
||||
else
|
||||
print_nodeinfo(&node);
|
||||
}
|
||||
else
|
||||
{
|
||||
print_nodeinfo(&node);
|
||||
}
|
||||
}
|
||||
|
||||
deinit_conf();
|
||||
|
||||
Reference in New Issue
Block a user