nsc: New enum ca_dump member CA_DUMP_ONLY

CA_DUMP_ONLY selectors are like CA_DUMP_NONE, except the xdump command
still has them.  This will permit adding selectors for conditional
selector and xdump command forward compatibility without also adding
them to configuration tables.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2016-05-30 23:33:03 +02:00
parent dc58018cd7
commit c93405f10d
3 changed files with 7 additions and 1 deletions

View file

@ -201,6 +201,7 @@ enum ca_dump {
/* order is relevant */
CA_DUMP, /* xdump and xundump normally */
CA_DUMP_CONST, /* same, but value can't be changed */
CA_DUMP_ONLY, /* only in xdump command */
CA_DUMP_NONE /* do not xdump or xundump */
};

View file

@ -81,7 +81,7 @@ verify_ca(int type)
if (CANT_HAPPEN((ef_flags(type) & EFF_MEM)
&& ca[i].ca_get
&& ca[i].ca_dump <= CA_DUMP_CONST))
ca[i].ca_dump = CA_DUMP_NONE;
ca[i].ca_dump = CA_DUMP_ONLY;
}
return 0;
}

View file

@ -81,7 +81,10 @@
/*
* Initialize @xd.
* If @cnum is NATID_BAD, this is an empdump export rather than an
* xdump command.
* Translate dump for country @cnum, except when @cnum is NATID_BAD.
* Ignore CA_DUMP_ONLY selectors when @cnum is NATID_BAD.
* If @human, dump in human-readable format.
* If @sloppy, try to cope with invalid data (may result in invalid
* dump).
@ -244,6 +247,8 @@ xdflds(struct xdstr *xd, struct castr ca[], void *ptr)
continue;
if (ca[i].ca_dump == CA_DUMP_NONE)
continue;
if (ca[i].ca_dump == CA_DUMP_ONLY && xd->cnum == NATID_BAD)
continue;
n = CA_ARRAY_LEN(&ca[i]);
j = 0;
do {