]> git.pond.sub.org Git - empserver/commitdiff
nsc: New enum ca_dump member CA_DUMP_ONLY
authorMarkus Armbruster <armbru@pond.sub.org>
Mon, 30 May 2016 21:33:03 +0000 (23:33 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 6 Aug 2017 17:59:56 +0000 (19:59 +0200)
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>
include/nsc.h
src/lib/common/ef_verify.c
src/lib/common/xdump.c

index 2a0aee68e4f97683a24af126a6da7bb6a99d865a..f076c4e10c020fdbb430133a46bdeb326c7f2f8a 100644 (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 */
 };
 
index eb982434fef92efdd6817433c4245674f013f3a4..b5c31eacb475a5ac707f1fc732feb05c7a234817 100644 (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;
 }
index 7357a7e44924540e9f65bbce3ca96a40d824be5e..219e33a0f991765b1fa245f2e297817a0430a139 100644 (file)
 
 /*
  * 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 {