accept: Factor out rejection flags printing
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
d35303d426
commit
2fcc325dd5
1 changed files with 25 additions and 16 deletions
|
@ -27,13 +27,15 @@
|
|||
* acce.c: Report rejection status of telegrams/annos/loans
|
||||
*
|
||||
* Known contributors to this file:
|
||||
*
|
||||
* Markus Armbruster, 2006-2016
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "commands.h"
|
||||
|
||||
static void pr_accept(struct natstr *, natid);
|
||||
|
||||
/*
|
||||
* report rejection status
|
||||
* Optional argument reports staus from the
|
||||
|
@ -42,17 +44,6 @@
|
|||
int
|
||||
acce(void)
|
||||
{
|
||||
static char *rejects[] = {
|
||||
/* must follow reject flags defined in nat.h */
|
||||
" YES YES YES",
|
||||
" NO YES YES",
|
||||
" YES NO YES",
|
||||
" NO NO YES",
|
||||
" YES YES NO ",
|
||||
" NO YES NO ",
|
||||
" YES NO NO ",
|
||||
" NO NO NO ",
|
||||
};
|
||||
struct natstr *natp;
|
||||
struct natstr *np;
|
||||
natid cn;
|
||||
|
@ -78,9 +69,27 @@ acce(void)
|
|||
if (np->nat_stat == STAT_UNUSED)
|
||||
continue;
|
||||
pr("%3d) %-14.14s ", cn, cname(cn));
|
||||
pr("%s %s\n",
|
||||
rejects[getrejects(cn, natp)],
|
||||
rejects[getrejects(as, np)]);
|
||||
pr_accept(natp, cn);
|
||||
pr_accept(np, as);
|
||||
pr("\n");
|
||||
}
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static void
|
||||
pr_accept(struct natstr *to, natid from)
|
||||
{
|
||||
static char *rejects[] = {
|
||||
/* must follow reject flags defined in nat.h */
|
||||
" YES YES YES",
|
||||
" NO YES YES",
|
||||
" YES NO YES",
|
||||
" NO NO YES",
|
||||
" YES YES NO ",
|
||||
" NO YES NO ",
|
||||
" YES NO NO ",
|
||||
" NO NO NO ",
|
||||
};
|
||||
|
||||
pr(" %s", rejects[getrejects(from, to)]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue