v0.27 #6
@ -329,7 +329,7 @@ void printf_usage(const char *ident, const char *fmt, ...)
|
||||
else
|
||||
printf("Sorry, no usage information available\n\n");
|
||||
|
||||
printf("Mail bug reports to <adb@newmail.ru>\n");
|
||||
printf("Mail bug reports to <zx@zxalexis.ru>\n");
|
||||
|
||||
fflush(stdout);
|
||||
}
|
||||
|
@ -28,11 +28,12 @@ bool eventexpr(s_expr *expr)
|
||||
static void usage(void)
|
||||
{
|
||||
printf_usage("nodelist lookup utility",
|
||||
"usage: nlookup [-C config] [-rmh] <address>\n"
|
||||
"usage: nlookup [-C config] [-romh] <address>\n"
|
||||
"\n"
|
||||
"options:\n"
|
||||
" -r show nodelist string\n"
|
||||
" -m show email address\n"
|
||||
" -o show overrides\n"
|
||||
" -h show this help message\n"
|
||||
" -C config use config file\n"
|
||||
"\n"
|
||||
@ -123,22 +124,48 @@ void print_nodeinfo(const s_node *node)
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
void print_overrides(const s_override *override_info)
|
||||
{
|
||||
s_override *p;
|
||||
char abuf[BF_MAXADDRSTR+1];
|
||||
int lin = 0;
|
||||
printf("----------- Overrides ------------\n");
|
||||
printf("Address : %s\n", ftn_addrstr(abuf, override_info->addr));
|
||||
printf("IpAddr : %s\n", override_info->sIpaddr);
|
||||
printf("Phone : %s\n", override_info->sPhone);
|
||||
printf("Flags : %s\n", override_info->sFlags);
|
||||
printf("Run before: %s\n", override_info->run);
|
||||
p = override_info->hidden;
|
||||
if (p) {
|
||||
printf("Hidden lines:\n");
|
||||
while( p )
|
||||
{
|
||||
printf(" Hidden IpAddr : %s\n", p->sIpaddr);
|
||||
printf(" Hidden Phone : %s\n", p->sPhone);
|
||||
printf(" Hidden Flags : %s\n", p->sFlags);
|
||||
p = p->hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
s_node node;
|
||||
s_faddr addr;
|
||||
s_override *ovr;
|
||||
char ch;
|
||||
int rc = 0;
|
||||
char *confname = NULL;
|
||||
bool rawstring = FALSE;
|
||||
bool emailaddr = FALSE;
|
||||
bool overrides = FALSE;
|
||||
|
||||
/* Initialise random number generation */
|
||||
(void)srand((unsigned)time(0));
|
||||
/* Initialise current locale */
|
||||
(void)setlocale(LC_ALL, "");
|
||||
|
||||
while( (ch=getopt(argc, argv, "hdrmC:")) != (char)-1 )
|
||||
while( (ch=getopt(argc, argv, "hdrmoC:")) != (char)-1 )
|
||||
{
|
||||
switch( ch ) {
|
||||
case 'h':
|
||||
@ -150,6 +177,9 @@ int main(int argc, char *argv[])
|
||||
case 'm':
|
||||
emailaddr = TRUE;
|
||||
break;
|
||||
case 'o':
|
||||
overrides = TRUE;
|
||||
break;
|
||||
case 'C':
|
||||
if( confname || !optarg ) { usage(); exit(BFERR_FATALERROR); }
|
||||
confname = (char *)xstrcpy(optarg);
|
||||
@ -188,6 +218,9 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else if( nodelist_lookup(&node, addr) == 0 )
|
||||
{
|
||||
// Overrides
|
||||
ovr = conf_override(cf_override, addr);
|
||||
|
||||
if (addr.point == 0) {
|
||||
if( emailaddr )
|
||||
print_nodemail(&node);
|
||||
@ -198,6 +231,17 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
print_nodeinfo(&node);
|
||||
}
|
||||
if (overrides && ovr) {
|
||||
print_overrides(ovr);
|
||||
}
|
||||
} else {
|
||||
if (overrides) {
|
||||
ovr = conf_override(cf_override, addr);
|
||||
if (ovr) {
|
||||
printf ("-- No nodelist info, only overrides --");
|
||||
print_overrides(ovr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
deinit_conf();
|
||||
|
Loading…
x
Reference in New Issue
Block a user