LCOV - code coverage report
Current view: top level - tests/lib - pkg_printf_test.c (source / functions) Hit Total Coverage
Test: rapport Lines: 300 300 100.0 %
Date: 2021-12-10 16:22:55 Functions: 34 34 100.0 %
Branches: 149 246 60.6 %

           Branch data     Line data    Source code
       1                 :            : /*-
       2                 :            :  * Copyright (c) 2012-2015 Matthew Seaman <matthew@FreeBSD.org>
       3                 :            :  * All rights reserved.
       4                 :            :  * 
       5                 :            :  * Redistribution and use in source and binary forms, with or without
       6                 :            :  * modification, are permitted provided that the following conditions
       7                 :            :  * are met:
       8                 :            :  * 1. Redistributions of source code must retain the above copyright
       9                 :            :  *    notice, this list of conditions and the following disclaimer
      10                 :            :  *    in this position and unchanged.
      11                 :            :  * 2. Redistributions in binary form must reproduce the above copyright
      12                 :            :  *    notice, this list of conditions and the following disclaimer in the
      13                 :            :  *    documentation and/or other materials provided with the distribution.
      14                 :            :  * 
      15                 :            :  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
      16                 :            :  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
      17                 :            :  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
      18                 :            :  * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
      19                 :            :  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
      20                 :            :  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
      21                 :            :  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
      22                 :            :  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
      23                 :            :  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
      24                 :            :  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
      25                 :            :  */
      26                 :            : 
      27                 :            : #include <string.h>
      28                 :            : 
      29                 :            : #include <atf-c.h>
      30                 :            : #include <xstring.h>
      31                 :            : #include <pkg.h>
      32                 :            : #include <private/pkg_printf.h>
      33                 :            : 
      34                 :            : ATF_TC(gen_format);
      35                 :        221 : ATF_TC_HEAD(gen_format, tc)
      36                 :            : {
      37                 :        221 :         atf_tc_set_md_var(tc, "descr",
      38                 :            :                           "Generate printf format code for final output");
      39                 :        221 : }
      40                 :         13 : ATF_TC_BODY(gen_format, tc)
      41                 :            : {
      42                 :            :         char             buf[32];
      43                 :            :         unsigned         i;
      44                 :         13 :         char            *tail = "x";
      45                 :            : 
      46                 :            :         struct gf_test_vals {
      47                 :            :                 const char *out;
      48                 :            :                 unsigned    flags;
      49                 :         13 :         } gf_test_vals[] = {
      50                 :            : 
      51                 :            :                 { "%*x",     0, },
      52                 :            : 
      53                 :            :                 { "%*x",     PP_ALTERNATE_FORM1, }, /* Has no effect */
      54                 :            : 
      55                 :            :                 { "%#*x",    PP_ALTERNATE_FORM2, },
      56                 :            :                 { "%-*x",    PP_LEFT_ALIGN, },
      57                 :            :                 { "%#-*x",   PP_LEFT_ALIGN|PP_ALTERNATE_FORM2, },
      58                 :            :                 { "%+*x",    PP_EXPLICIT_PLUS, },
      59                 :            :                 { "%#+*x",   PP_EXPLICIT_PLUS|PP_ALTERNATE_FORM2, },
      60                 :            :                 { "%-+*x",   PP_EXPLICIT_PLUS|PP_LEFT_ALIGN, },
      61                 :            :                 { "%#-+*x",  PP_EXPLICIT_PLUS|PP_LEFT_ALIGN|PP_ALTERNATE_FORM2, },
      62                 :            :                 { "% *x",    PP_SPACE_FOR_PLUS, },
      63                 :            :                 { "%# *x",   PP_SPACE_FOR_PLUS|PP_ALTERNATE_FORM2, },
      64                 :            :                 { "%- *x",   PP_SPACE_FOR_PLUS|PP_LEFT_ALIGN, },
      65                 :            :                 { "%#- *x",  PP_SPACE_FOR_PLUS|PP_LEFT_ALIGN|PP_ALTERNATE_FORM2, },
      66                 :            :                 { "%+*x",    PP_SPACE_FOR_PLUS|PP_EXPLICIT_PLUS, },
      67                 :            :                 { "%#+*x",   PP_SPACE_FOR_PLUS|PP_EXPLICIT_PLUS|PP_ALTERNATE_FORM2, },
      68                 :            :                 { "%-+*x",   PP_SPACE_FOR_PLUS|PP_EXPLICIT_PLUS|PP_LEFT_ALIGN, },
      69                 :            :                 { "%#-+*x",  PP_SPACE_FOR_PLUS|PP_EXPLICIT_PLUS|PP_LEFT_ALIGN|PP_ALTERNATE_FORM2, },
      70                 :            :                 { "%0*x",    PP_ZERO_PAD, },
      71                 :            :                 { "%#0*x",   PP_ZERO_PAD|PP_ALTERNATE_FORM2, },
      72                 :            :                 { "%-*x",    PP_ZERO_PAD|PP_LEFT_ALIGN, },
      73                 :            :                 { "%#-*x",   PP_ZERO_PAD|PP_LEFT_ALIGN|PP_ALTERNATE_FORM2, },
      74                 :            :                 { "%0+*x",   PP_ZERO_PAD|PP_EXPLICIT_PLUS, },
      75                 :            :                 { "%#0+*x",  PP_ZERO_PAD|PP_EXPLICIT_PLUS|PP_ALTERNATE_FORM2, },
      76                 :            :                 { "%-+*x",   PP_ZERO_PAD|PP_EXPLICIT_PLUS|PP_LEFT_ALIGN, },
      77                 :            :                 { "%#-+*x",  PP_ZERO_PAD|PP_EXPLICIT_PLUS|PP_LEFT_ALIGN|PP_ALTERNATE_FORM2, },
      78                 :            :                 { "%0 *x",   PP_ZERO_PAD|PP_SPACE_FOR_PLUS, },
      79                 :            :                 { "%#0 *x",  PP_ZERO_PAD|PP_SPACE_FOR_PLUS|PP_ALTERNATE_FORM2, },
      80                 :            :                 { "%- *x",   PP_ZERO_PAD|PP_SPACE_FOR_PLUS|PP_LEFT_ALIGN, },
      81                 :            :                 { "%#- *x",  PP_ZERO_PAD|PP_SPACE_FOR_PLUS|PP_LEFT_ALIGN|PP_ALTERNATE_FORM2, },
      82                 :            :                 { "%0+*x",   PP_ZERO_PAD|PP_SPACE_FOR_PLUS|PP_EXPLICIT_PLUS, },
      83                 :            :                 { "%#0+*x",  PP_ZERO_PAD|PP_SPACE_FOR_PLUS|PP_EXPLICIT_PLUS|PP_ALTERNATE_FORM2, },
      84                 :            :                 { "%-+*x",   PP_ZERO_PAD|PP_SPACE_FOR_PLUS|PP_EXPLICIT_PLUS|PP_LEFT_ALIGN, },
      85                 :            :                 { "%#-+*x",  PP_ZERO_PAD|PP_SPACE_FOR_PLUS|PP_EXPLICIT_PLUS|PP_LEFT_ALIGN|PP_ALTERNATE_FORM2, },
      86                 :            :                 { "%'*x",    PP_THOUSANDS_SEP, },
      87                 :            :                 { "%#'*x",   PP_THOUSANDS_SEP|PP_ALTERNATE_FORM2, },
      88                 :            :                 { "%-'*x",   PP_THOUSANDS_SEP|PP_LEFT_ALIGN, },
      89                 :            :                 { "%#-'*x",  PP_THOUSANDS_SEP|PP_LEFT_ALIGN|PP_ALTERNATE_FORM2, },
      90                 :            :                 { "%+'*x",   PP_THOUSANDS_SEP|PP_EXPLICIT_PLUS, },
      91                 :            :                 { "%#+'*x",  PP_THOUSANDS_SEP|PP_EXPLICIT_PLUS|PP_ALTERNATE_FORM2, },
      92                 :            :                 { "%-+'*x",  PP_THOUSANDS_SEP|PP_EXPLICIT_PLUS|PP_LEFT_ALIGN, },
      93                 :            :                 { "%#-+'*x", PP_THOUSANDS_SEP|PP_EXPLICIT_PLUS|PP_LEFT_ALIGN|PP_ALTERNATE_FORM2, },
      94                 :            :                 { "% '*x",   PP_THOUSANDS_SEP|PP_SPACE_FOR_PLUS, },
      95                 :            :                 { "%# '*x",  PP_THOUSANDS_SEP|PP_SPACE_FOR_PLUS|PP_ALTERNATE_FORM2, },
      96                 :            :                 { "%- '*x",  PP_THOUSANDS_SEP|PP_SPACE_FOR_PLUS|PP_LEFT_ALIGN, },
      97                 :            :                 { "%#- '*x", PP_THOUSANDS_SEP|PP_SPACE_FOR_PLUS|PP_LEFT_ALIGN|PP_ALTERNATE_FORM2, },
      98                 :            :                 { "%+'*x",   PP_THOUSANDS_SEP|PP_SPACE_FOR_PLUS|PP_EXPLICIT_PLUS, },
      99                 :            :                 { "%#+'*x",  PP_THOUSANDS_SEP|PP_SPACE_FOR_PLUS|PP_EXPLICIT_PLUS|PP_ALTERNATE_FORM2, },
     100                 :            :                 { "%-+'*x",  PP_THOUSANDS_SEP|PP_SPACE_FOR_PLUS|PP_EXPLICIT_PLUS|PP_LEFT_ALIGN, },
     101                 :            :                 { "%#-+'*x", PP_THOUSANDS_SEP|PP_SPACE_FOR_PLUS|PP_EXPLICIT_PLUS|PP_LEFT_ALIGN|PP_ALTERNATE_FORM2, },
     102                 :            :                 { "%0'*x",   PP_THOUSANDS_SEP|PP_ZERO_PAD, },
     103                 :            :                 { "%#0'*x",  PP_THOUSANDS_SEP|PP_ZERO_PAD|PP_ALTERNATE_FORM2, },
     104                 :            :                 { "%-'*x",   PP_THOUSANDS_SEP|PP_ZERO_PAD|PP_LEFT_ALIGN, },
     105                 :            :                 { "%#-'*x",  PP_THOUSANDS_SEP|PP_ZERO_PAD|PP_LEFT_ALIGN|PP_ALTERNATE_FORM2, },
     106                 :            :                 { "%0+'*x",  PP_THOUSANDS_SEP|PP_ZERO_PAD|PP_EXPLICIT_PLUS, },
     107                 :            :                 { "%#0+'*x", PP_THOUSANDS_SEP|PP_ZERO_PAD|PP_EXPLICIT_PLUS|PP_ALTERNATE_FORM2, },
     108                 :            :                 { "%-+'*x",  PP_THOUSANDS_SEP|PP_ZERO_PAD|PP_EXPLICIT_PLUS|PP_LEFT_ALIGN, },
     109                 :            :                 { "%#-+'*x", PP_THOUSANDS_SEP|PP_ZERO_PAD|PP_EXPLICIT_PLUS|PP_LEFT_ALIGN|PP_ALTERNATE_FORM2, },
     110                 :            :                 { "%0 '*x",  PP_THOUSANDS_SEP|PP_ZERO_PAD|PP_SPACE_FOR_PLUS, },
     111                 :            :                 { "%#0 '*x", PP_THOUSANDS_SEP|PP_ZERO_PAD|PP_SPACE_FOR_PLUS|PP_ALTERNATE_FORM2, },
     112                 :            :                 { "%- '*x",  PP_THOUSANDS_SEP|PP_ZERO_PAD|PP_SPACE_FOR_PLUS|PP_LEFT_ALIGN, },
     113                 :            :                 { "%#- '*x", PP_THOUSANDS_SEP|PP_ZERO_PAD|PP_SPACE_FOR_PLUS|PP_LEFT_ALIGN|PP_ALTERNATE_FORM2, },
     114                 :            :                 { "%0+'*x",  PP_THOUSANDS_SEP|PP_ZERO_PAD|PP_SPACE_FOR_PLUS|PP_EXPLICIT_PLUS, },
     115                 :            :                 { "%#0+'*x", PP_THOUSANDS_SEP|PP_ZERO_PAD|PP_SPACE_FOR_PLUS|PP_EXPLICIT_PLUS|PP_ALTERNATE_FORM2, },
     116                 :            :                 { "%-+'*x",  PP_THOUSANDS_SEP|PP_ZERO_PAD|PP_SPACE_FOR_PLUS|PP_EXPLICIT_PLUS|PP_LEFT_ALIGN, },
     117                 :            :                 { "%#-+'*x", PP_THOUSANDS_SEP|PP_ZERO_PAD|PP_SPACE_FOR_PLUS|PP_EXPLICIT_PLUS|PP_LEFT_ALIGN|PP_ALTERNATE_FORM2, },
     118                 :            : 
     119                 :            :                 { NULL, 0, },
     120                 :            :         };
     121                 :            : 
     122         [ +  + ]:        858 :         for (i = 0; gf_test_vals[i].out != NULL; i++) {
     123         [ +  - ]:        845 :                 ATF_CHECK_STREQ(gen_format(buf, sizeof(buf),
     124                 :            :                                            gf_test_vals[i].flags, tail),
     125                 :            :                                 gf_test_vals[i].out);
     126                 :        845 :         }
     127                 :         13 : }
     128                 :            : 
     129                 :            : ATF_TC(human_number);
     130                 :        221 : ATF_TC_HEAD(human_number, tc)
     131                 :            : {
     132                 :        221 :         atf_tc_set_md_var(tc, "descr",
     133                 :            :                           "Testing human_number() output routine");
     134                 :        221 : }
     135                 :         13 : ATF_TC_BODY(human_number, tc)
     136                 :            : {
     137                 :         13 :         xstring         *buf = NULL;
     138                 :            :         struct percent_esc      *p;
     139                 :            :         int                      i;
     140                 :            : 
     141                 :            :         struct hn_test_vals {
     142                 :            :                 int64_t in;
     143                 :            :                 const char *out;
     144                 :            :                 int width;
     145                 :            :                 unsigned flags;
     146                 :         13 :         } hn_test_vals[] = {
     147                 :            :                 { 0,                   "0.00",   0, 0, },
     148                 :            :                 { 1,                   "1.00",   0, 0, },
     149                 :            :                 { 10,                  "10.0",   0, 0, },
     150                 :            :                 { 100,                 "100",    0, 0. },
     151                 :            :                 { 1000,                "1.00k",  0, 0, },
     152                 :            :                 { 10000,               "10.0k",  0, 0, },
     153                 :            :                 { 100000,              "100k",   0, 0, },
     154                 :            :                 { 1000000,             "1.00M",  0, 0, },
     155                 :            :                 { 1000000000,          "1.00G",  0, 0, },
     156                 :            :                 { 1000000000000,       "1.00T",  0, 0, },
     157                 :            :                 { 1000000000000000,    "1.00P",  0, 0, },
     158                 :            :                 { 1000000000000000000, "1.00E",  0, 0, },
     159                 :            : 
     160                 :            :                 { 999,                 "999",    0, 0, },
     161                 :            :                 { 1001,                "1.00k",  0, 0, },
     162                 :            :                 { 1010,                "1.01k",  0, 0, },
     163                 :            :                 { 1490,                "1.49k",  0, 0, },
     164                 :            :                 { 1499,                "1.50k",  0, 0, },
     165                 :            :                 { 1500,                "1.50k",  0, 0, },
     166                 :            : 
     167                 :            :                 { -1,                  "-1.00",  0, 0, },
     168                 :            :                 { -1234,               "-1.23k", 0, 0, },
     169                 :            :                 { -1234567,            "-1.23M", 0, 0, },
     170                 :            :                 { -1234567890,         "-1.23G", 0, 0, },
     171                 :            :                 { -1234567890123,      "-1.23T", 0, 0, },
     172                 :            :                 { -1234567890123456,   "-1.23P", 0, 0, },
     173                 :            :                 { -1234567890123456789,"-1.23E", 0, 0, },
     174                 :            : 
     175                 :            :                 { 512,                 "512",    0, PP_ALTERNATE_FORM2, },
     176                 :            :                 { 1024,                "1.00Ki", 0, PP_ALTERNATE_FORM2, },
     177                 :            :                 { 1536,                "1.50Ki", 0, PP_ALTERNATE_FORM2, },
     178                 :            :                 { 24576,               "24.0Ki", 0, PP_ALTERNATE_FORM2, },
     179                 :            :                 { 393216,              "384Ki",  0, PP_ALTERNATE_FORM2, },
     180                 :            :                 { 2359296,             "2.25Mi", 0, PP_ALTERNATE_FORM2, },
     181                 :            :                 { 3623878656,          "3.38Gi", 0, PP_ALTERNATE_FORM2, },
     182                 :            :                 { 5566277615616,       "5.06Ti", 0, PP_ALTERNATE_FORM2, },
     183                 :            :                 { 8549802417586176,    "7.59Pi", 0, PP_ALTERNATE_FORM2, },
     184                 :            :                 { 1313249651341236633, "1.14Ei", 0, PP_ALTERNATE_FORM2, },
     185                 :            : 
     186                 :            : 
     187                 :            :                 { 123,     "123",          0, 0, },
     188                 :            :                 { 123,     "123",          1, 0, },
     189                 :            :                 { 123,     "123",          2, 0, },
     190                 :            :                 { 123,     "123",          3, 0, },
     191                 :            :                 { 123,     " 123",         4, 0, },
     192                 :            :                 { 123,     "  123",        5, 0, },
     193                 :            :                 { 123,     "   123",       6, 0, },
     194                 :            :                 { 123,     "    123",      7, 0, },
     195                 :            :                 { 123,     "     123",     8, 0, },
     196                 :            :                 { 123,     "      123",    9, 0, },
     197                 :            : 
     198                 :            :                 { 123,     " 123",         0, PP_SPACE_FOR_PLUS, },
     199                 :            :                 { 123,     " 123",         1, PP_SPACE_FOR_PLUS, },
     200                 :            :                 { 123,     " 123",         2, PP_SPACE_FOR_PLUS, },
     201                 :            :                 { 123,     " 123",         3, PP_SPACE_FOR_PLUS, },
     202                 :            :                 { 123,     " 123",         4, PP_SPACE_FOR_PLUS, },
     203                 :            :                 { 123,     "  123",        5, PP_SPACE_FOR_PLUS, },
     204                 :            :                 { 123,     "   123",       6, PP_SPACE_FOR_PLUS, },
     205                 :            :                 { 123,     "    123",      7, PP_SPACE_FOR_PLUS, },
     206                 :            :                 { 123,     "     123",     8, PP_SPACE_FOR_PLUS, },
     207                 :            :                 { 123,     "      123",    9, PP_SPACE_FOR_PLUS, },
     208                 :            : 
     209                 :            :                 { -123,    "-123",         0, 0, },
     210                 :            :                 { -123,    "-123",         1, 0, },
     211                 :            :                 { -123,    "-123",         2, 0, },
     212                 :            :                 { -123,    "-123",         3, 0, },
     213                 :            :                 { -123,    "-123",         4, 0, },
     214                 :            :                 { -123,    " -123",        5, 0, },
     215                 :            :                 { -123,    "  -123",       6, 0, },
     216                 :            :                 { -123,    "   -123",      7, 0, },
     217                 :            :                 { -123,    "    -123",     8, 0, },
     218                 :            :                 { -123,    "     -123",    9, 0, },
     219                 :            : 
     220                 :            :                 { 123,     "123",          0, PP_ALTERNATE_FORM2, },
     221                 :            :                 { 123,     "123",          1, PP_ALTERNATE_FORM2, },
     222                 :            :                 { 123,     "123",          2, PP_ALTERNATE_FORM2, },
     223                 :            :                 { 123,     "123",          3, PP_ALTERNATE_FORM2, },
     224                 :            :                 { 123,     " 123",         4, PP_ALTERNATE_FORM2, },
     225                 :            :                 { 123,     "  123",        5, PP_ALTERNATE_FORM2, },
     226                 :            :                 { 123,     "   123",       6, PP_ALTERNATE_FORM2, },
     227                 :            :                 { 123,     "    123",      7, PP_ALTERNATE_FORM2, },
     228                 :            :                 { 123,     "     123",     8, PP_ALTERNATE_FORM2, },
     229                 :            :                 { 123,     "      123",    9, PP_ALTERNATE_FORM2, },
     230                 :            : 
     231                 :            :                 { 1234567, "1.23M",        0, 0, },
     232                 :            :                 { 1234567, "1M",           1, 0, },
     233                 :            :                 { 1234567, "1M",           2, 0, },
     234                 :            :                 { 1234567, " 1M",          3, 0, },
     235                 :            :                 { 1234567, "1.2M",         4, 0, },
     236                 :            :                 { 1234567, "1.23M",        5, 0, },
     237                 :            :                 { 1234567, " 1.23M",       6, 0, },
     238                 :            :                 { 1234567, "  1.23M",      7, 0, },
     239                 :            :                 { 1234567, "   1.23M",     8, 0, },
     240                 :            :                 { 1234567, "    1.23M",    9, 0, },
     241                 :            : 
     242                 :            :                 { 12345678, "12.3M",       0, 0, },
     243                 :            :                 { 12345678, "12M",         1, 0, },
     244                 :            :                 { 12345678, "12M",         2, 0, },
     245                 :            :                 { 12345678, "12M",         3, 0, },
     246                 :            :                 { 12345678, " 12M",        4, 0, },
     247                 :            :                 { 12345678, "12.3M",       5, 0, },
     248                 :            :                 { 12345678, " 12.3M",      6, 0, },
     249                 :            :                 { 12345678, "  12.3M",     7, 0, },
     250                 :            :                 { 12345678, "   12.3M",    8, 0, },
     251                 :            :                 { 12345678, "    12.3M",   9, 0, },
     252                 :            : 
     253                 :            :                 { 123456789, "123M",       0, 0, },
     254                 :            :                 { 123456789, "123M",       1, 0, },
     255                 :            :                 { 123456789, "123M",       2, 0, },
     256                 :            :                 { 123456789, "123M",       3, 0, },
     257                 :            :                 { 123456789, "123M",       4, 0, },
     258                 :            :                 { 123456789, " 123M",      5, 0, },
     259                 :            :                 { 123456789, "  123M",     6, 0, },
     260                 :            :                 { 123456789, "   123M",    7, 0, },
     261                 :            :                 { 123456789, "    123M",   8, 0, },
     262                 :            :                 { 123456789, "     123M",  9, 0, },
     263                 :            : 
     264                 :            :                 { 1234567, "1.18Mi",       0, PP_ALTERNATE_FORM2, },
     265                 :            :                 { 1234567, "1Mi",          1, PP_ALTERNATE_FORM2, },
     266                 :            :                 { 1234567, "1Mi",          2, PP_ALTERNATE_FORM2, },
     267                 :            :                 { 1234567, "1Mi",          3, PP_ALTERNATE_FORM2, },
     268                 :            :                 { 1234567, " 1Mi",         4, PP_ALTERNATE_FORM2, },
     269                 :            :                 { 1234567, "1.2Mi",        5, PP_ALTERNATE_FORM2, },
     270                 :            :                 { 1234567, "1.18Mi",       6, PP_ALTERNATE_FORM2, },
     271                 :            :                 { 1234567, " 1.18Mi",      7, PP_ALTERNATE_FORM2, },
     272                 :            :                 { 1234567, "  1.18Mi",     8, PP_ALTERNATE_FORM2, },
     273                 :            :                 { 1234567, "   1.18Mi",    9, PP_ALTERNATE_FORM2, },
     274                 :            : 
     275                 :            :                 { 12345678, "11.8Mi",      0, PP_ALTERNATE_FORM2, },
     276                 :            :                 { 12345678, "12Mi",        1, PP_ALTERNATE_FORM2, },
     277                 :            :                 { 12345678, "12Mi",        2, PP_ALTERNATE_FORM2, },
     278                 :            :                 { 12345678, "12Mi",        3, PP_ALTERNATE_FORM2, },
     279                 :            :                 { 12345678, "12Mi",        4, PP_ALTERNATE_FORM2, },
     280                 :            :                 { 12345678, " 12Mi",       5, PP_ALTERNATE_FORM2, },
     281                 :            :                 { 12345678, "11.8Mi",      6, PP_ALTERNATE_FORM2, },
     282                 :            :                 { 12345678, " 11.8Mi",     7, PP_ALTERNATE_FORM2, },
     283                 :            :                 { 12345678, "  11.8Mi",    8, PP_ALTERNATE_FORM2, },
     284                 :            :                 { 12345678, "   11.8Mi",   9, PP_ALTERNATE_FORM2, },
     285                 :            : 
     286                 :            :                 { 123456789, "118Mi",      0, PP_ALTERNATE_FORM2, },
     287                 :            :                 { 123456789, "118Mi",      1, PP_ALTERNATE_FORM2, },
     288                 :            :                 { 123456789, "118Mi",      2, PP_ALTERNATE_FORM2, },
     289                 :            :                 { 123456789, "118Mi",      3, PP_ALTERNATE_FORM2, },
     290                 :            :                 { 123456789, "118Mi",      4, PP_ALTERNATE_FORM2, },
     291                 :            :                 { 123456789, "118Mi",      5, PP_ALTERNATE_FORM2, },
     292                 :            :                 { 123456789, " 118Mi",     6, PP_ALTERNATE_FORM2, },
     293                 :            :                 { 123456789, "  118Mi",    7, PP_ALTERNATE_FORM2, },
     294                 :            :                 { 123456789, "   118Mi",   8, PP_ALTERNATE_FORM2, },
     295                 :            :                 { 123456789, "    118Mi",  9, PP_ALTERNATE_FORM2, },
     296                 :            : 
     297                 :            :                 {  1234567, "1.23M",  0, PP_ALTERNATE_FORM1, },
     298                 :            :                 {  1234567, "1.18Mi", 0, PP_ALTERNATE_FORM2, },
     299                 :            :                 {  1234567, "1.23 M", 6, PP_LEFT_ALIGN, },
     300                 :            :                 {  1234567, "+1.23M", 0, PP_EXPLICIT_PLUS, },
     301                 :            :                 { -1234567, "-1.23M", 0, PP_EXPLICIT_PLUS, },
     302                 :            :                 {  1234567, " 1.23M", 0, PP_SPACE_FOR_PLUS, },
     303                 :            :                 { -1234567, "-1.23M", 0, PP_SPACE_FOR_PLUS, },
     304                 :            :                 {  1234567, "01.23M", 6, PP_ZERO_PAD, },
     305                 :            :                 {  1234567, "1.23M",  0, PP_THOUSANDS_SEP, },
     306                 :            :                 {  1023,"1023", 0, PP_ALTERNATE_FORM2|PP_THOUSANDS_SEP, },
     307                 :            : 
     308                 :            :                 { -1,                  NULL,     0, 0, },
     309                 :            :         };
     310                 :            : 
     311                 :         13 :         p = new_percent_esc();
     312                 :            : 
     313         [ +  - ]:         13 :         ATF_REQUIRE_EQ(p != NULL, true);
     314                 :            : 
     315         [ +  + ]:       1898 :         for (i = 0; hn_test_vals[i].out != NULL; i++) {
     316         [ +  + ]:       1885 :                 xstring_renew(buf);
     317                 :       1885 :                 p->width = hn_test_vals[i].width;
     318                 :       1885 :                 p->flags = hn_test_vals[i].flags;
     319                 :       1885 :                 buf = human_number(buf, hn_test_vals[i].in, p);
     320                 :       1885 :                 fflush(buf->fp);
     321         [ +  - ]:       1885 :                 ATF_CHECK_STREQ(buf->buf, hn_test_vals[i].out);
     322                 :       1885 :         }
     323                 :            : 
     324                 :         13 :         free_percent_esc(p);
     325                 :         13 :         xstring_free(buf);
     326                 :         13 : }
     327                 :            : 
     328                 :            : ATF_TC(string_val);
     329                 :        221 : ATF_TC_HEAD(string_val, tc)
     330                 :            : {
     331                 :        221 :         atf_tc_set_md_var(tc, "descr",
     332                 :            :                           "Testing string_val() output routine");
     333                 :        221 : }
     334                 :         13 : ATF_TC_BODY(string_val, tc)
     335                 :            : {
     336                 :         13 :         xstring         *buf = NULL;
     337                 :            :         struct percent_esc      *p;
     338                 :            :         int                      i;
     339                 :            : 
     340                 :            :         struct sv_test_vals {
     341                 :            :                 const char *in;
     342                 :            :                 const char *out;
     343                 :            :                 int width;
     344                 :            :                 unsigned flags;
     345                 :         13 :         } sv_test_vals[] = {
     346                 :            :                 { "xxx", "xxx",    0, 0, },
     347                 :            :                 { "xxx", "xxx",    1, 0, },
     348                 :            :                 { "xxx", "xxx",    2, 0, },
     349                 :            :                 { "xxx", "xxx",    3, 0, },
     350                 :            :                 { "xxx", " xxx",   4, 0, },
     351                 :            :                 { "xxx", "  xxx",  5, 0, },
     352                 :            :                 { "xxx", "   xxx", 6, 0, },
     353                 :            : 
     354                 :            :                 { "xxy", "xxy",    0, PP_LEFT_ALIGN, },
     355                 :            :                 { "xxy", "xxy",    1, PP_LEFT_ALIGN, },
     356                 :            :                 { "xxy", "xxy",    2, PP_LEFT_ALIGN, },
     357                 :            :                 { "xxy", "xxy",    3, PP_LEFT_ALIGN, },
     358                 :            :                 { "xxy", "xxy ",   4, PP_LEFT_ALIGN, },
     359                 :            :                 { "xxy", "xxy  ",  5, PP_LEFT_ALIGN, },
     360                 :            :                 { "xxy", "xxy   ", 6, PP_LEFT_ALIGN, },
     361                 :            : 
     362                 :            :                 /* Zero padding a string is non-portable, so ignore 
     363                 :            :                    that flag when printing string values */
     364                 :            : 
     365                 :            :                 { "xxz", "xxz",    0, PP_ZERO_PAD, },
     366                 :            :                 { "xxz", "xxz",    1, PP_ZERO_PAD, },
     367                 :            :                 { "xxz", "xxz",    2, PP_ZERO_PAD, },
     368                 :            :                 { "xxz", "xxz",    3, PP_ZERO_PAD, },
     369                 :            :                 { "xxz", " xxz",   4, PP_ZERO_PAD, },
     370                 :            :                 { "xxz", "  xxz",  5, PP_ZERO_PAD, },
     371                 :            :                 { "xxz", "   xxz", 6, PP_ZERO_PAD, },
     372                 :            : 
     373                 :            :                 /* Seems you can't zero pad on the RHS of a string */
     374                 :            : 
     375                 :            :                 { "xyx", "xyx",    0, PP_ZERO_PAD|PP_LEFT_ALIGN, },
     376                 :            :                 { "xyx", "xyx",    1, PP_ZERO_PAD|PP_LEFT_ALIGN, },
     377                 :            :                 { "xyx", "xyx",    2, PP_ZERO_PAD|PP_LEFT_ALIGN, },
     378                 :            :                 { "xyx", "xyx",    3, PP_ZERO_PAD|PP_LEFT_ALIGN, },
     379                 :            :                 { "xyx", "xyx ",   4, PP_ZERO_PAD|PP_LEFT_ALIGN, },
     380                 :            :                 { "xyx", "xyx  ",  5, PP_ZERO_PAD|PP_LEFT_ALIGN, },
     381                 :            :                 { "xyx", "xyx   ", 6, PP_ZERO_PAD|PP_LEFT_ALIGN, },
     382                 :            : 
     383                 :            :                 /* Most of the format modifiers don't affect strings */
     384                 :            : 
     385                 :            :                 { "aaa", "aaa", 0, PP_ALTERNATE_FORM1, },
     386                 :            :                 { "bbb", "bbb", 0, PP_ALTERNATE_FORM2, },
     387                 :            :                 { "ccc", "ccc", 0, PP_EXPLICIT_PLUS, },
     388                 :            :                 { "ddd", "ddd", 0, PP_SPACE_FOR_PLUS, },
     389                 :            :                 { "eee", "eee", 0, PP_THOUSANDS_SEP, },
     390                 :            : 
     391                 :            :                 { NULL, NULL, 0, 0, },
     392                 :            :         };
     393                 :            : 
     394                 :         13 :         p = new_percent_esc();
     395                 :            : 
     396         [ +  - ]:         13 :         ATF_REQUIRE_EQ(p != NULL, true);
     397                 :            : 
     398         [ +  + ]:        442 :         for (i = 0; sv_test_vals[i].out != NULL; i++) {
     399         [ +  + ]:        429 :                 xstring_renew(buf);
     400                 :        429 :                 p->width = sv_test_vals[i].width;
     401                 :        429 :                 p->flags = sv_test_vals[i].flags;
     402                 :        429 :                 buf = string_val(buf, sv_test_vals[i].in, p);
     403                 :        429 :                 fflush(buf->fp);
     404         [ +  - ]:        429 :                 ATF_CHECK_STREQ(buf->buf, sv_test_vals[i].out);
     405                 :        429 :         }
     406                 :            : 
     407                 :         13 :         free_percent_esc(p);
     408                 :         13 :         xstring_free(buf);
     409                 :         13 : }
     410                 :            : 
     411                 :            : ATF_TC(int_val);
     412                 :        221 : ATF_TC_HEAD(int_val, tc)
     413                 :            : {
     414                 :        221 :         atf_tc_set_md_var(tc, "descr",
     415                 :            :                           "Testing int_val() output routine");
     416                 :        221 : }
     417                 :         13 : ATF_TC_BODY(int_val, tc)
     418                 :            : {
     419                 :         13 :         xstring         *buf = NULL;
     420                 :            :         struct percent_esc      *p;
     421                 :            :         int                      i;
     422                 :            : 
     423                 :            :         struct iv_test_vals {
     424                 :            :                 int64_t in;
     425                 :            :                 const char *out;
     426                 :            :                 int width;
     427                 :            :                 unsigned flags;
     428                 :         13 :         } iv_test_vals[] = {
     429                 :            :                 { 0,      "0",   0, 0, },
     430                 :            : 
     431                 :            :                 { 1,      "1",   0, 0, },
     432                 :            :                 { -1,     "-1",  0, 0, },
     433                 :            : 
     434                 :            :                 { 340,    "340",       0, 0, },
     435                 :            :                 { 341,    "341",       1, 0, },
     436                 :            :                 { 342,    "342",       2, 0, },
     437                 :            :                 { 343,    "343",       3, 0, },
     438                 :            :                 { 344,    " 344",      4, 0, },
     439                 :            :                 { 345,    "  345",     5, 0, },
     440                 :            :                 { 346,    "   346",    6, 0, },
     441                 :            :                 { 347,    "    347",   7, 0, },
     442                 :            :                 { 348,    "     348",  8, 0, },
     443                 :            :                 { 349,    "      349", 9, 0, },
     444                 :            : 
     445                 :            :                 { 350,    "350",       0, PP_LEFT_ALIGN, },
     446                 :            :                 { 351,    "351",       1, PP_LEFT_ALIGN, },
     447                 :            :                 { 352,    "352",       2, PP_LEFT_ALIGN, },
     448                 :            :                 { 353,    "353",       3, PP_LEFT_ALIGN, },
     449                 :            :                 { 354,    "354 ",      4, PP_LEFT_ALIGN, },
     450                 :            :                 { 355,    "355  ",     5, PP_LEFT_ALIGN, },
     451                 :            :                 { 356,    "356   ",    6, PP_LEFT_ALIGN, },
     452                 :            :                 { 357,    "357    ",   7, PP_LEFT_ALIGN, },
     453                 :            :                 { 358,    "358     ",  8, PP_LEFT_ALIGN, },
     454                 :            :                 { 359,    "359      ", 9, PP_LEFT_ALIGN, },
     455                 :            : 
     456                 :            :                 { 360,    "+360",      0, PP_EXPLICIT_PLUS, },
     457                 :            :                 { 361,    "+361",      1, PP_EXPLICIT_PLUS, },
     458                 :            :                 { 362,    "+362",      2, PP_EXPLICIT_PLUS, },
     459                 :            :                 { 363,    "+363",      3, PP_EXPLICIT_PLUS, },
     460                 :            :                 { 364,    "+364",      4, PP_EXPLICIT_PLUS, },
     461                 :            :                 { 365,    " +365",     5, PP_EXPLICIT_PLUS, },
     462                 :            :                 { 366,    "  +366",    6, PP_EXPLICIT_PLUS, },
     463                 :            :                 { 367,    "   +367",   7, PP_EXPLICIT_PLUS, },
     464                 :            :                 { 368,    "    +368",  8, PP_EXPLICIT_PLUS, },
     465                 :            :                 { 369,    "     +369", 9, PP_EXPLICIT_PLUS, },
     466                 :            : 
     467                 :            :                 { -370,   "-370",      0, PP_EXPLICIT_PLUS, },
     468                 :            :                 { -371,   "-371",      1, PP_EXPLICIT_PLUS, },
     469                 :            :                 { -372,   "-372",      2, PP_EXPLICIT_PLUS, },
     470                 :            :                 { -373,   "-373",      3, PP_EXPLICIT_PLUS, },
     471                 :            :                 { -374,   "-374",      4, PP_EXPLICIT_PLUS, },
     472                 :            :                 { -375,   " -375",     5, PP_EXPLICIT_PLUS, },
     473                 :            :                 { -376,   "  -376",    6, PP_EXPLICIT_PLUS, },
     474                 :            :                 { -377,   "   -377",   7, PP_EXPLICIT_PLUS, },
     475                 :            :                 { -378,   "    -378",  8, PP_EXPLICIT_PLUS, },
     476                 :            :                 { -379,   "     -379", 9, PP_EXPLICIT_PLUS, },
     477                 :            : 
     478                 :            :                 { 380,    " 380",      0, PP_SPACE_FOR_PLUS, },
     479                 :            :                 { 381,    " 381",      1, PP_SPACE_FOR_PLUS, },
     480                 :            :                 { 382,    " 382",      2, PP_SPACE_FOR_PLUS, },
     481                 :            :                 { 383,    " 383",      3, PP_SPACE_FOR_PLUS, },
     482                 :            :                 { 384,    " 384",      4, PP_SPACE_FOR_PLUS, },
     483                 :            :                 { 385,    "  385",     5, PP_SPACE_FOR_PLUS, },
     484                 :            :                 { 386,    "   386",    6, PP_SPACE_FOR_PLUS, },
     485                 :            :                 { 387,    "    387",   7, PP_SPACE_FOR_PLUS, },
     486                 :            :                 { 388,    "     388",  8, PP_SPACE_FOR_PLUS, },
     487                 :            :                 { 389,    "      389", 9, PP_SPACE_FOR_PLUS, },
     488                 :            : 
     489                 :            :                 { -390,   "-390",      0, PP_SPACE_FOR_PLUS, },
     490                 :            :                 { -391,   "-391",      1, PP_SPACE_FOR_PLUS, },
     491                 :            :                 { -392,   "-392",      2, PP_SPACE_FOR_PLUS, },
     492                 :            :                 { -393,   "-393",      3, PP_SPACE_FOR_PLUS, },
     493                 :            :                 { -394,   "-394",      4, PP_SPACE_FOR_PLUS, },
     494                 :            :                 { -395,   " -395",     5, PP_SPACE_FOR_PLUS, },
     495                 :            :                 { -396,   "  -396",    6, PP_SPACE_FOR_PLUS, },
     496                 :            :                 { -397,   "   -397",   7, PP_SPACE_FOR_PLUS, },
     497                 :            :                 { -398,   "    -398",  8, PP_SPACE_FOR_PLUS, },
     498                 :            :                 { -399,   "     -399", 9, PP_SPACE_FOR_PLUS, },
     499                 :            : 
     500                 :            :                 { 400,    "+400",      0, PP_LEFT_ALIGN|PP_EXPLICIT_PLUS, },
     501                 :            :                 { 401,    "+401",      1, PP_LEFT_ALIGN|PP_EXPLICIT_PLUS, },
     502                 :            :                 { 402,    "+402",      2, PP_LEFT_ALIGN|PP_EXPLICIT_PLUS, },
     503                 :            :                 { 403,    "+403",      3, PP_LEFT_ALIGN|PP_EXPLICIT_PLUS, },
     504                 :            :                 { 404,    "+404",      4, PP_LEFT_ALIGN|PP_EXPLICIT_PLUS, },
     505                 :            :                 { 405,    "+405 ",     5, PP_LEFT_ALIGN|PP_EXPLICIT_PLUS, },
     506                 :            :                 { 406,    "+406  ",    6, PP_LEFT_ALIGN|PP_EXPLICIT_PLUS, },
     507                 :            :                 { 407,    "+407   ",   7, PP_LEFT_ALIGN|PP_EXPLICIT_PLUS, },
     508                 :            :                 { 408,    "+408    ",  8, PP_LEFT_ALIGN|PP_EXPLICIT_PLUS, },
     509                 :            :                 { 409,    "+409     ", 9, PP_LEFT_ALIGN|PP_EXPLICIT_PLUS, },
     510                 :            : 
     511                 :            :                 { -410,   "-410",      0, PP_LEFT_ALIGN|PP_EXPLICIT_PLUS, },
     512                 :            :                 { -411,   "-411",      1, PP_LEFT_ALIGN|PP_EXPLICIT_PLUS, },
     513                 :            :                 { -412,   "-412",      2, PP_LEFT_ALIGN|PP_EXPLICIT_PLUS, },
     514                 :            :                 { -413,   "-413",      3, PP_LEFT_ALIGN|PP_EXPLICIT_PLUS, },
     515                 :            :                 { -414,   "-414",      4, PP_LEFT_ALIGN|PP_EXPLICIT_PLUS, },
     516                 :            :                 { -415,   "-415 ",     5, PP_LEFT_ALIGN|PP_EXPLICIT_PLUS, },
     517                 :            :                 { -416,   "-416  ",    6, PP_LEFT_ALIGN|PP_EXPLICIT_PLUS, },
     518                 :            :                 { -417,   "-417   ",   7, PP_LEFT_ALIGN|PP_EXPLICIT_PLUS, },
     519                 :            :                 { -418,   "-418    ",  8, PP_LEFT_ALIGN|PP_EXPLICIT_PLUS, },
     520                 :            :                 { -419,   "-419     ", 9, PP_LEFT_ALIGN|PP_EXPLICIT_PLUS, },
     521                 :            : 
     522                 :            :                 { 420,    " 420",      0, PP_LEFT_ALIGN|PP_SPACE_FOR_PLUS, },
     523                 :            :                 { 421,    " 421",      1, PP_LEFT_ALIGN|PP_SPACE_FOR_PLUS, },
     524                 :            :                 { 422,    " 422",      2, PP_LEFT_ALIGN|PP_SPACE_FOR_PLUS, },
     525                 :            :                 { 423,    " 423",      3, PP_LEFT_ALIGN|PP_SPACE_FOR_PLUS, },
     526                 :            :                 { 424,    " 424",      4, PP_LEFT_ALIGN|PP_SPACE_FOR_PLUS, },
     527                 :            :                 { 425,    " 425 ",     5, PP_LEFT_ALIGN|PP_SPACE_FOR_PLUS, },
     528                 :            :                 { 426,    " 426  ",    6, PP_LEFT_ALIGN|PP_SPACE_FOR_PLUS, },
     529                 :            :                 { 427,    " 427   ",   7, PP_LEFT_ALIGN|PP_SPACE_FOR_PLUS, },
     530                 :            :                 { 428,    " 428    ",  8, PP_LEFT_ALIGN|PP_SPACE_FOR_PLUS, },
     531                 :            :                 { 429,    " 429     ", 9, PP_LEFT_ALIGN|PP_SPACE_FOR_PLUS, },
     532                 :            : 
     533                 :            :                 { -430,   "-430",      0, PP_LEFT_ALIGN|PP_SPACE_FOR_PLUS, },
     534                 :            :                 { -431,   "-431",      1, PP_LEFT_ALIGN|PP_SPACE_FOR_PLUS, },
     535                 :            :                 { -432,   "-432",      2, PP_LEFT_ALIGN|PP_SPACE_FOR_PLUS, },
     536                 :            :                 { -433,   "-433",      3, PP_LEFT_ALIGN|PP_SPACE_FOR_PLUS, },
     537                 :            :                 { -434,   "-434",      4, PP_LEFT_ALIGN|PP_SPACE_FOR_PLUS, },
     538                 :            :                 { -435,   "-435 ",     5, PP_LEFT_ALIGN|PP_SPACE_FOR_PLUS, },
     539                 :            :                 { -436,   "-436  ",    6, PP_LEFT_ALIGN|PP_SPACE_FOR_PLUS, },
     540                 :            :                 { -437,   "-437   ",   7, PP_LEFT_ALIGN|PP_SPACE_FOR_PLUS, },
     541                 :            :                 { -438,   "-438    ",  8, PP_LEFT_ALIGN|PP_SPACE_FOR_PLUS, },
     542                 :            :                 { -439,   "-439     ", 9, PP_LEFT_ALIGN|PP_SPACE_FOR_PLUS, },
     543                 :            : 
     544                 :            :                 { 440,    "440",       0, PP_ZERO_PAD, },
     545                 :            :                 { 441,    "441",       1, PP_ZERO_PAD, },
     546                 :            :                 { 442,    "442",       2, PP_ZERO_PAD, },
     547                 :            :                 { 443,    "443",       3, PP_ZERO_PAD, },
     548                 :            :                 { 444,    "0444",      4, PP_ZERO_PAD, },
     549                 :            :                 { 445,    "00445",     5, PP_ZERO_PAD, },
     550                 :            :                 { 446,    "000446",    6, PP_ZERO_PAD, },
     551                 :            :                 { 447,    "0000447",   7, PP_ZERO_PAD, },
     552                 :            :                 { 448,    "00000448",  8, PP_ZERO_PAD, },
     553                 :            :                 { 449,    "000000449", 9, PP_ZERO_PAD, },
     554                 :            : 
     555                 :            :                 { -450,    "-450",      0, PP_ZERO_PAD, },
     556                 :            :                 { -451,    "-451",      1, PP_ZERO_PAD, },
     557                 :            :                 { -452,    "-452",      2, PP_ZERO_PAD, },
     558                 :            :                 { -453,    "-453",      3, PP_ZERO_PAD, },
     559                 :            :                 { -454,    "-454",      4, PP_ZERO_PAD, },
     560                 :            :                 { -455,    "-0455",     5, PP_ZERO_PAD, },
     561                 :            :                 { -456,    "-00456",    6, PP_ZERO_PAD, },
     562                 :            :                 { -457,    "-000457",   7, PP_ZERO_PAD, },
     563                 :            :                 { -458,    "-0000458",  8, PP_ZERO_PAD, },
     564                 :            :                 { -459,    "-00000459", 9, PP_ZERO_PAD, },
     565                 :            : 
     566                 :            :                 { 460,    "+460",      0, PP_EXPLICIT_PLUS|PP_ZERO_PAD, },
     567                 :            :                 { 461,    "+461",      1, PP_EXPLICIT_PLUS|PP_ZERO_PAD, },
     568                 :            :                 { 462,    "+462",      2, PP_EXPLICIT_PLUS|PP_ZERO_PAD, },
     569                 :            :                 { 463,    "+463",      3, PP_EXPLICIT_PLUS|PP_ZERO_PAD, },
     570                 :            :                 { 464,    "+464",      4, PP_EXPLICIT_PLUS|PP_ZERO_PAD, },
     571                 :            :                 { 465,    "+0465",     5, PP_EXPLICIT_PLUS|PP_ZERO_PAD, },
     572                 :            :                 { 466,    "+00466",    6, PP_EXPLICIT_PLUS|PP_ZERO_PAD, },
     573                 :            :                 { 467,    "+000467",   7, PP_EXPLICIT_PLUS|PP_ZERO_PAD, },
     574                 :            :                 { 468,    "+0000468",  8, PP_EXPLICIT_PLUS|PP_ZERO_PAD, },
     575                 :            :                 { 469,    "+00000469", 9, PP_EXPLICIT_PLUS|PP_ZERO_PAD, },
     576                 :            : 
     577                 :            :                 { -470,    "-470",      0, PP_EXPLICIT_PLUS|PP_ZERO_PAD, },
     578                 :            :                 { -471,    "-471",      1, PP_EXPLICIT_PLUS|PP_ZERO_PAD, },
     579                 :            :                 { -472,    "-472",      2, PP_EXPLICIT_PLUS|PP_ZERO_PAD, },
     580                 :            :                 { -473,    "-473",      3, PP_EXPLICIT_PLUS|PP_ZERO_PAD, },
     581                 :            :                 { -474,    "-474",      4, PP_EXPLICIT_PLUS|PP_ZERO_PAD, },
     582                 :            :                 { -475,    "-0475",     5, PP_EXPLICIT_PLUS|PP_ZERO_PAD, },
     583                 :            :                 { -476,    "-00476",    6, PP_EXPLICIT_PLUS|PP_ZERO_PAD, },
     584                 :            :                 { -477,    "-000477",   7, PP_EXPLICIT_PLUS|PP_ZERO_PAD, },
     585                 :            :                 { -478,    "-0000478",  8, PP_EXPLICIT_PLUS|PP_ZERO_PAD, },
     586                 :            :                 { -479,    "-00000479", 9, PP_EXPLICIT_PLUS|PP_ZERO_PAD, },
     587                 :            : 
     588                 :            :                 { 480,    " 480",      0, PP_SPACE_FOR_PLUS|PP_ZERO_PAD, },
     589                 :            :                 { 481,    " 481",      1, PP_SPACE_FOR_PLUS|PP_ZERO_PAD, },
     590                 :            :                 { 482,    " 482",      2, PP_SPACE_FOR_PLUS|PP_ZERO_PAD, },
     591                 :            :                 { 483,    " 483",      3, PP_SPACE_FOR_PLUS|PP_ZERO_PAD, },
     592                 :            :                 { 484,    " 484",      4, PP_SPACE_FOR_PLUS|PP_ZERO_PAD, },
     593                 :            :                 { 485,    " 0485",     5, PP_SPACE_FOR_PLUS|PP_ZERO_PAD, },
     594                 :            :                 { 486,    " 00486",    6, PP_SPACE_FOR_PLUS|PP_ZERO_PAD, },
     595                 :            :                 { 487,    " 000487",   7, PP_SPACE_FOR_PLUS|PP_ZERO_PAD, },
     596                 :            :                 { 488,    " 0000488",  8, PP_SPACE_FOR_PLUS|PP_ZERO_PAD, },
     597                 :            :                 { 489,    " 00000489", 9, PP_SPACE_FOR_PLUS|PP_ZERO_PAD, },
     598                 :            : 
     599                 :            :                 { -490,    "-490",      0, PP_SPACE_FOR_PLUS|PP_ZERO_PAD, },
     600                 :            :                 { -491,    "-491",      1, PP_SPACE_FOR_PLUS|PP_ZERO_PAD, },
     601                 :            :                 { -492,    "-492",      2, PP_SPACE_FOR_PLUS|PP_ZERO_PAD, },
     602                 :            :                 { -493,    "-493",      3, PP_SPACE_FOR_PLUS|PP_ZERO_PAD, },
     603                 :            :                 { -494,    "-494",      4, PP_SPACE_FOR_PLUS|PP_ZERO_PAD, },
     604                 :            :                 { -495,    "-0495",     5, PP_SPACE_FOR_PLUS|PP_ZERO_PAD, },
     605                 :            :                 { -496,    "-00496",    6, PP_SPACE_FOR_PLUS|PP_ZERO_PAD, },
     606                 :            :                 { -497,    "-000497",   7, PP_SPACE_FOR_PLUS|PP_ZERO_PAD, },
     607                 :            :                 { -498,    "-0000498",  8, PP_SPACE_FOR_PLUS|PP_ZERO_PAD, },
     608                 :            :                 { -499,    "-00000499", 9, PP_SPACE_FOR_PLUS|PP_ZERO_PAD, },
     609                 :            : 
     610                 :            :                 /* PP_LEFT_ALIGN beats PP_ZERO_PAD */
     611                 :            : 
     612                 :            :                 { 500,    "500",       0, PP_ZERO_PAD|PP_LEFT_ALIGN, },
     613                 :            :                 { 501,    "501",       1, PP_ZERO_PAD|PP_LEFT_ALIGN, },
     614                 :            :                 { 502,    "502",       2, PP_ZERO_PAD|PP_LEFT_ALIGN, },
     615                 :            :                 { 503,    "503",       3, PP_ZERO_PAD|PP_LEFT_ALIGN, },
     616                 :            :                 { 504,    "504 ",      4, PP_ZERO_PAD|PP_LEFT_ALIGN, },
     617                 :            :                 { 505,    "505  ",     5, PP_ZERO_PAD|PP_LEFT_ALIGN, },
     618                 :            :                 { 506,    "506   ",    6, PP_ZERO_PAD|PP_LEFT_ALIGN, },
     619                 :            :                 { 507,    "507    ",   7, PP_ZERO_PAD|PP_LEFT_ALIGN, },
     620                 :            :                 { 508,    "508     ",  8, PP_ZERO_PAD|PP_LEFT_ALIGN, },
     621                 :            :                 { 509,    "509      ", 9, PP_ZERO_PAD|PP_LEFT_ALIGN, },
     622                 :            : 
     623                 :            :                 /* PP_EXPLICIT_PLUS beats PP_SPACE_FOR_PLUS */
     624                 :            : 
     625                 :            :                 { 700,    "+700",       0, PP_EXPLICIT_PLUS|PP_SPACE_FOR_PLUS, },
     626                 :            : 
     627                 :            :                 /* See human_number for comprehensive tests of
     628                 :            :                    PP_ALTERNATE_FORM1 and PP_ALTERNATE_FORM2 */
     629                 :            : 
     630                 :            :                 { -1, NULL, 0, 0, },
     631                 :            :         }; 
     632                 :            : 
     633                 :         13 :         p = new_percent_esc();
     634                 :            : 
     635         [ +  - ]:         13 :         ATF_REQUIRE_EQ(p != NULL, true);
     636                 :            : 
     637         [ +  + ]:       2275 :         for (i = 0; iv_test_vals[i].out != NULL; i++) {
     638         [ +  + ]:       2262 :                 xstring_renew(buf);
     639                 :       2262 :                 p->width = iv_test_vals[i].width;
     640                 :       2262 :                 p->flags = iv_test_vals[i].flags;
     641                 :       2262 :                 buf = int_val(buf, iv_test_vals[i].in, p);
     642                 :       2262 :                 fflush(buf->fp);
     643         [ +  - ]:       2262 :                 ATF_CHECK_STREQ(buf->buf, iv_test_vals[i].out);
     644                 :       2262 :         }
     645                 :            : 
     646                 :         13 :         free_percent_esc(p);
     647                 :         13 :         xstring_free(buf);
     648                 :         13 : }
     649                 :            : 
     650                 :            : ATF_TC(bool_val);
     651                 :        221 : ATF_TC_HEAD(bool_val, tc)
     652                 :            : {
     653                 :        221 :         atf_tc_set_md_var(tc, "descr",
     654                 :            :                           "Testing bool_val() output routine");
     655                 :        221 : }
     656                 :         13 : ATF_TC_BODY(bool_val, tc)
     657                 :            : {
     658                 :         13 :         xstring         *buf = NULL;
     659                 :            :         struct percent_esc      *p;
     660                 :            :         int                      i;
     661                 :            : 
     662                 :            :         struct bv_test_vals {
     663                 :            :                 bool in;
     664                 :            :                 const char *out;
     665                 :            :                 int width;
     666                 :            :                 unsigned flags;
     667                 :         13 :         } bv_test_vals[] = {
     668                 :            :                 { false, "false", 0, 0, },
     669                 :            :                 { true,  "true",  0, 0, },
     670                 :            : 
     671                 :            :                 { false, "no",    0, PP_ALTERNATE_FORM1, },
     672                 :            :                 { true,  "yes",   0, PP_ALTERNATE_FORM1, },
     673                 :            : 
     674                 :            :                 { false, "",      0, PP_ALTERNATE_FORM2, },
     675                 :            :                 { true,  "(*)",   0, PP_ALTERNATE_FORM2, },
     676                 :            : 
     677                 :            :                 /*
     678                 :            :                  * See string_val() for tests on field-width and
     679                 :            :                  * left-align
     680                 :            :                  */
     681                 :            : 
     682                 :            :                 { false, NULL, 0, 0, },
     683                 :            :         };
     684                 :            : 
     685                 :         13 :         p = new_percent_esc();
     686                 :            : 
     687         [ +  - ]:         13 :         ATF_REQUIRE_EQ(p != NULL, true);
     688                 :            : 
     689         [ +  + ]:         91 :         for (i = 0; bv_test_vals[i].out != NULL; i++) {
     690         [ +  + ]:         78 :                 xstring_renew(buf);
     691                 :         78 :                 p->width = bv_test_vals[i].width;
     692                 :         78 :                 p->flags = bv_test_vals[i].flags;
     693                 :         78 :                 buf = bool_val(buf, bv_test_vals[i].in, p);
     694                 :         78 :                 fflush(buf->fp);
     695         [ +  - ]:         78 :                 ATF_CHECK_STREQ(buf->buf, bv_test_vals[i].out);
     696                 :         78 :         }
     697                 :            : 
     698                 :         13 :         free_percent_esc(p);
     699                 :         13 :         xstring_free(buf);
     700                 :         13 : }
     701                 :            : 
     702                 :            : ATF_TC(mode_val);
     703                 :        221 : ATF_TC_HEAD(mode_val, tc)
     704                 :            : {
     705                 :        221 :         atf_tc_set_md_var(tc, "descr",
     706                 :            :                           "Testing mode_val() output routine");
     707                 :        221 : }
     708                 :         13 : ATF_TC_BODY(mode_val, tc)
     709                 :            : {
     710                 :         13 :         xstring         *buf = NULL;
     711                 :            :         struct percent_esc      *p;
     712                 :            :         int                      i;
     713                 :            : 
     714                 :            :         struct mv_test_vals {
     715                 :            :                 int64_t in;
     716                 :            :                 const char *out;
     717                 :            :                 int width;
     718                 :            :                 unsigned flags;
     719                 :         13 :         } mv_test_vals[] = {
     720                 :            :                 { 00000, "0",          0, 0, },
     721                 :            :                 { 00007, "7",          0, 0, },
     722                 :            :                 { 00070, "70",         0, 0, },
     723                 :            :                 { 00700, "700",        0, 0, },
     724                 :            :                 { 07000, "7000",       0, 0, },
     725                 :            : 
     726                 :            :                 { 00000, "    0",      5, 0, },
     727                 :            :                 { 00007, "    7",      5, 0, },
     728                 :            :                 { 00070, "   70",      5, 0, },
     729                 :            :                 { 00700, "  700",      5, 0, },
     730                 :            :                 { 07000, " 7000",      5, 0, },
     731                 :            : 
     732                 :            :                 { 00000, "        0",  9, 0, },
     733                 :            :                 { 00007, "        7",  9, 0, },
     734                 :            :                 { 00070, "       70",  9, 0, },
     735                 :            :                 { 00700, "      700",  9, 0, },
     736                 :            :                 { 07000, "     7000",  9, 0, },
     737                 :            : 
     738                 :            :                 /*
     739                 :            :                  * Shows a ? character for 'unknown inode type'.  Note
     740                 :            :                  * the trailing space.
     741                 :            :                  */
     742                 :            : 
     743                 :            :                 { 00000, "?--------- ", 0, PP_ALTERNATE_FORM1, },
     744                 :            :                 { 00007, "?------rwx ", 0, PP_ALTERNATE_FORM1, },
     745                 :            :                 { 00070, "?---rwx--- ", 0, PP_ALTERNATE_FORM1, },
     746                 :            :                 { 00700, "?rwx------ ", 0, PP_ALTERNATE_FORM1, },
     747                 :            :                 { 07000, "?--S--S--T ", 0, PP_ALTERNATE_FORM1, },
     748                 :            :                 { 07111, "?--s--s--t ", 0, PP_ALTERNATE_FORM1, },
     749                 :            : 
     750                 :            :                 { 00000, "0",          0, PP_ALTERNATE_FORM2, },
     751                 :            :                 { 00007, "07",         0, PP_ALTERNATE_FORM2, },
     752                 :            :                 { 00070, "070",        0, PP_ALTERNATE_FORM2, },
     753                 :            :                 { 00700, "0700",       0, PP_ALTERNATE_FORM2, },
     754                 :            :                 { 07000, "07000",      0, PP_ALTERNATE_FORM2, },
     755                 :            : 
     756                 :            :                 { 00000, "    0",      5, PP_ALTERNATE_FORM2, },
     757                 :            :                 { 00007, "   07",      5, PP_ALTERNATE_FORM2, },
     758                 :            :                 { 00070, "  070",      5, PP_ALTERNATE_FORM2, },
     759                 :            :                 { 00700, " 0700",      5, PP_ALTERNATE_FORM2, },
     760                 :            :                 { 07000, "07000",      5, PP_ALTERNATE_FORM2, },
     761                 :            : 
     762                 :            :                 { 00000, "        0",  9, PP_ALTERNATE_FORM2, },
     763                 :            :                 { 00007, "       07",  9, PP_ALTERNATE_FORM2, },
     764                 :            :                 { 00070, "      070",  9, PP_ALTERNATE_FORM2, },
     765                 :            :                 { 00700, "     0700",  9, PP_ALTERNATE_FORM2, },
     766                 :            :                 { 07000, "    07000",  9, PP_ALTERNATE_FORM2, },
     767                 :            : 
     768                 :            :                 /*
     769                 :            :                  * The device type bits: 0170000
     770                 :            :                  */
     771                 :            : 
     772                 :            :                 { 0010000, "0", 0, 0, }, /* FIFO */
     773                 :            :                 { 0020000, "0", 0, 0, }, /* Char special */
     774                 :            :                 { 0060000, "0", 0, 0, }, /* Block special */
     775                 :            :                 { 0100000, "0", 0, 0, }, /* Regular file */
     776                 :            :                 { 0120000, "0", 0, 0, }, /* Sym-link */
     777                 :            :                 { 0140000, "0", 0, 0, }, /* socket */
     778                 :            :                 { 0160000, "0", 0, 0, }, /* whiteout */
     779                 :            : 
     780                 :            :                 { 0010000, "p--------- ", 0, PP_ALTERNATE_FORM1, }, /* FIFO */
     781                 :            :                 { 0020000, "c--------- ", 0, PP_ALTERNATE_FORM1, }, /* Char special */
     782                 :            :                 { 0060000, "b--------- ", 0, PP_ALTERNATE_FORM1, }, /* Block special */
     783                 :            :                 { 0100000, "---------- ", 0, PP_ALTERNATE_FORM1, }, /* Regular file */
     784                 :            :                 { 0120000, "l--------- ", 0, PP_ALTERNATE_FORM1, }, /* Sym-link */
     785                 :            :                 { 0140000, "s--------- ", 0, PP_ALTERNATE_FORM1, }, /* socket */
     786                 :            : #ifndef __linux__
     787                 :            :                 { 0160000, "w--------- ", 0, PP_ALTERNATE_FORM1, }, /* whiteout */
     788                 :            : #else
     789                 :            :                 { 0160000, "?--------- ", 0, PP_ALTERNATE_FORM1, }, /* whiteout */
     790                 :            : #endif
     791                 :            : 
     792                 :            :                 { 0010000, "10000",  0, PP_EXPLICIT_PLUS, }, /* FIFO */
     793                 :            :                 { 0020000, "20000",  0, PP_EXPLICIT_PLUS, }, /* Char special */
     794                 :            :                 { 0060000, "60000",  0, PP_EXPLICIT_PLUS, }, /* Block special */
     795                 :            :                 { 0100000, "100000", 0, PP_EXPLICIT_PLUS, }, /* Regular file */
     796                 :            :                 { 0120000, "120000", 0, PP_EXPLICIT_PLUS, }, /* Sym-link */
     797                 :            :                 { 0140000, "140000", 0, PP_EXPLICIT_PLUS, }, /* socket */
     798                 :            :                 { 0160000, "160000", 0, PP_EXPLICIT_PLUS, }, /* whiteout */
     799                 :            : 
     800                 :            :                 { 0, NULL, 0, 0, },
     801                 :            :         };
     802                 :            : 
     803                 :         13 :         p = new_percent_esc();
     804                 :            : 
     805         [ +  - ]:         13 :         ATF_REQUIRE_EQ(p != NULL, true);
     806                 :            : 
     807         [ +  + ]:        754 :         for (i = 0; mv_test_vals[i].out != NULL; i++) {
     808         [ +  + ]:        741 :                 xstring_renew(buf);
     809                 :        741 :                 p->width = mv_test_vals[i].width;
     810                 :        741 :                 p->flags = mv_test_vals[i].flags;
     811                 :        741 :                 buf = mode_val(buf, mv_test_vals[i].in, p);
     812                 :        741 :                 fflush(buf->fp);
     813         [ +  - ]:        741 :                 ATF_CHECK_STREQ(buf->buf, mv_test_vals[i].out);
     814                 :        741 :         }
     815                 :            : 
     816                 :         13 :         free_percent_esc(p);
     817                 :         13 :         xstring_free(buf);
     818                 :         13 : }
     819                 :            : 
     820                 :            : ATF_TC(liclog_val);
     821                 :        221 : ATF_TC_HEAD(liclog_val, tc)
     822                 :            : {
     823                 :        221 :         atf_tc_set_md_var(tc, "descr",
     824                 :            :                           "Testing liclog_val() output routine");
     825                 :        221 : }
     826                 :         13 : ATF_TC_BODY(liclog_val, tc)
     827                 :            : {
     828                 :         13 :         xstring         *buf = NULL;
     829                 :            :         struct percent_esc      *p;
     830                 :            :         int                      i;
     831                 :            : 
     832                 :            :         struct lv_test_vals {
     833                 :            :                 lic_t in;
     834                 :            :                 const char *out;
     835                 :            :                 int width;
     836                 :            :                 unsigned flags;
     837                 :         13 :         } lv_test_vals[] = {
     838                 :            :                 { LICENSE_SINGLE, "single", 0, 0, },
     839                 :            :                 { LICENSE_OR,     "or",     0, 0, },
     840                 :            :                 { LICENSE_AND,    "and",    0, 0, },
     841                 :            : 
     842                 :            :                 { LICENSE_SINGLE, "",       0, PP_ALTERNATE_FORM1, },
     843                 :            :                 { LICENSE_OR,     "|",      0, PP_ALTERNATE_FORM1, },
     844                 :            :                 { LICENSE_AND,    "&",      0, PP_ALTERNATE_FORM1, },
     845                 :            : 
     846                 :            :                 { LICENSE_SINGLE, "==",     0, PP_ALTERNATE_FORM2, },
     847                 :            :                 { LICENSE_OR,     "||",     0, PP_ALTERNATE_FORM2, },
     848                 :            :                 { LICENSE_AND,    "&&",     0, PP_ALTERNATE_FORM2, },
     849                 :            : 
     850                 :            :                 /*
     851                 :            :                  * See string_val() for tests on field-width and
     852                 :            :                  * left-align
     853                 :            :                  */
     854                 :            : 
     855                 :            :                 { 0, NULL, 0, 0, },
     856                 :            :         };
     857                 :            : 
     858                 :         13 :         p = new_percent_esc();
     859                 :            : 
     860         [ +  - ]:         13 :         ATF_REQUIRE_EQ(p != NULL, true);
     861                 :            : 
     862         [ +  + ]:        130 :         for (i = 0; lv_test_vals[i].out != NULL; i++) {
     863         [ +  + ]:        117 :                 xstring_renew(buf);
     864                 :        117 :                 p->width = lv_test_vals[i].width;
     865                 :        117 :                 p->flags = lv_test_vals[i].flags;
     866                 :        117 :                 buf = liclog_val(buf, lv_test_vals[i].in, p);
     867                 :        117 :                 fflush(buf->fp);
     868         [ +  - ]:        117 :                 ATF_CHECK_STREQ(buf->buf, lv_test_vals[i].out);
     869                 :        117 :         }
     870                 :            : 
     871                 :         13 :         free_percent_esc(p);
     872                 :         13 :         xstring_free(buf);
     873                 :         13 : }
     874                 :            : 
     875                 :            : ATF_TC(list_count);
     876                 :        221 : ATF_TC_HEAD(list_count, tc)
     877                 :            : {
     878                 :        221 :         atf_tc_set_md_var(tc, "descr",
     879                 :            :                           "Testing list_count() output routine");
     880                 :        221 : }
     881                 :         13 : ATF_TC_BODY(list_count, tc)
     882                 :            : {
     883                 :         13 :         xstring         *buf = NULL;
     884                 :            :         struct percent_esc      *p;
     885                 :            :         int                      i;
     886                 :            : 
     887                 :            :         struct lc_test_vals {
     888                 :            :                 int64_t in;
     889                 :            :                 const char *out;
     890                 :            :                 int width;
     891                 :            :                 unsigned flags;
     892                 :         13 :         } lc_test_vals[] = {
     893                 :            :                 { 10, "10", 0, 0, },
     894                 :            :                 { 20, "1",  0, PP_ALTERNATE_FORM1, },
     895                 :            :                 { 30, "30", 0, PP_ALTERNATE_FORM2, },
     896                 :            : 
     897                 :            :                 /*
     898                 :            :                  * See int_val() for tests on field-width and
     899                 :            :                  * left-align
     900                 :            :                  */
     901                 :            : 
     902                 :            :                 { 0, NULL, 0, 0, },
     903                 :            :         };
     904                 :            : 
     905                 :         13 :         p = new_percent_esc();
     906                 :            : 
     907         [ +  - ]:         13 :         ATF_REQUIRE_EQ(p != NULL, true);
     908                 :            : 
     909         [ +  + ]:         52 :         for (i = 0; lc_test_vals[i].out != NULL; i++) {
     910         [ +  + ]:         39 :                 xstring_renew(buf);
     911                 :         39 :                 p->width = lc_test_vals[i].width;
     912                 :         39 :                 p->flags = lc_test_vals[i].flags;
     913                 :         39 :                 buf = list_count(buf, lc_test_vals[i].in, p);
     914                 :         39 :                 fflush(buf->fp);
     915         [ +  - ]:         39 :                 ATF_CHECK_STREQ(buf->buf, lc_test_vals[i].out);
     916                 :         39 :         }
     917                 :            : 
     918                 :         13 :         free_percent_esc(p);
     919                 :         13 :         xstring_free(buf);
     920                 :         13 : }
     921                 :            : 
     922                 :            : ATF_TC(maybe_read_hex_byte);
     923                 :        221 : ATF_TC_HEAD(maybe_read_hex_byte, tc)
     924                 :            : {
     925                 :        221 :         atf_tc_set_md_var(tc, "descr",
     926                 :            :             "Testing maybe_read_hex_byte() format parsing routine");
     927                 :        221 : }
     928                 :         13 : ATF_TC_BODY(maybe_read_hex_byte, tc)
     929                 :            : {
     930                 :         13 :         xstring *buf = NULL;
     931                 :            :         const char      *f;
     932                 :            :         int              i;
     933                 :            : 
     934                 :            :         struct mrhb_test_vals {
     935                 :            :                 const char *in;
     936                 :            :                 const char *out; /* What gets written to the buf */
     937                 :            :                 ptrdiff_t   fend_offset; /* Where f is left pointing */
     938                 :            :                 char        fend_val; /* expected first char in fend */
     939                 :         13 :         } mrhb_test_vals[] = {
     940                 :            :                 { "x61",   "a",    3, '\0', },
     941                 :            :                 { "x",     "\\x",  1, '\0', },
     942                 :            :                 { "xg",    "\\x",  1, 'g',  },
     943                 :            :                 { "xf",    "\\x",  1, 'f',  },
     944                 :            :                 { "xfg",   "\\x",  1, 'f',  },
     945                 :            :                 { "xff",   "\xff", 3, '\0', },
     946                 :            :                 { "xffg",  "\xff", 3, 'g',  },
     947                 :            :                 { "xfffg", "\xff", 3, 'f',  },
     948                 :            : 
     949                 :            :                 { "x00",   "\0",   3, '\0', },
     950                 :            :                 { "x01",   "\x01", 3, '\0', },
     951                 :            :                 { "x02",   "\x02", 3, '\0', },
     952                 :            :                 { "x03",   "\x03", 3, '\0', },
     953                 :            :                 { "x04",   "\x04", 3, '\0', },
     954                 :            :                 { "x05",   "\x05", 3, '\0', },
     955                 :            :                 { "x06",   "\x06", 3, '\0', },
     956                 :            :                 { "x07",   "\x07", 3, '\0', },
     957                 :            :                 { "x08",   "\x08", 3, '\0', },
     958                 :            :                 { "x09",   "\x09", 3, '\0', },
     959                 :            :                 { "x0a",   "\x0a", 3, '\0', },
     960                 :            :                 { "x0b",   "\x0b", 3, '\0', },
     961                 :            :                 { "x0c",   "\x0c", 3, '\0', },
     962                 :            :                 { "x0d",   "\x0d", 3, '\0', },
     963                 :            :                 { "x0e",   "\x0e", 3, '\0', },
     964                 :            :                 { "x0f",   "\x0f", 3, '\0', },
     965                 :            : 
     966                 :            :                 { "x0A",   "\x0a", 3, '\0', },
     967                 :            :                 { "x0B",   "\x0b", 3, '\0', },
     968                 :            :                 { "x0C",   "\x0c", 3, '\0', },
     969                 :            :                 { "x0D",   "\x0d", 3, '\0', },
     970                 :            :                 { "x0E",   "\x0e", 3, '\0', },
     971                 :            :                 { "x0F",   "\x0f", 3, '\0', },
     972                 :            : 
     973                 :            :                 { "x10",   "\x10", 3, '\0', },
     974                 :            :                 { "x20",   "\x20", 3, '\0', },
     975                 :            :                 { "x30",   "\x30", 3, '\0', },
     976                 :            :                 { "x40",   "\x40", 3, '\0', },
     977                 :            :                 { "x50",   "\x50", 3, '\0', },
     978                 :            :                 { "x60",   "\x60", 3, '\0', },
     979                 :            :                 { "x70",   "\x70", 3, '\0', },
     980                 :            :                 { "x80",   "\x80", 3, '\0', },
     981                 :            :                 { "x90",   "\x90", 3, '\0', },
     982                 :            :                 { "xa0",   "\xa0", 3, '\0', },
     983                 :            :                 { "xb0",   "\xb0", 3, '\0', },
     984                 :            :                 { "xc0",   "\xc0", 3, '\0', },
     985                 :            :                 { "xd0",   "\xd0", 3, '\0', },
     986                 :            :                 { "xe0",   "\xe0", 3, '\0', },
     987                 :            :                 { "xf0",   "\xf0", 3, '\0', },
     988                 :            : 
     989                 :            :                 { "xA0",   "\xa0", 3, '\0', },
     990                 :            :                 { "xB0",   "\xb0", 3, '\0', },
     991                 :            :                 { "xC0",   "\xc0", 3, '\0', },
     992                 :            :                 { "xD0",   "\xd0", 3, '\0', },
     993                 :            :                 { "xE0",   "\xe0", 3, '\0', },
     994                 :            :                 { "xF0",   "\xf0", 3, '\0', },
     995                 :            : 
     996                 :            :                 { NULL,   NULL,    0, '\0', },
     997                 :            :         };
     998                 :            : 
     999         [ +  + ]:        676 :         for (i = 0; mrhb_test_vals[i].in != NULL; i++) {
    1000         [ +  + ]:        663 :                 xstring_renew(buf);
    1001                 :        663 :                 f = maybe_read_hex_byte(buf, mrhb_test_vals[i].in);
    1002                 :        663 :                 fflush(buf->fp);
    1003                 :            : 
    1004         [ +  - ]:        663 :                 ATF_CHECK_STREQ_MSG(buf->buf, mrhb_test_vals[i].out,
    1005                 :            :                                     "(test %d)", i);
    1006         [ +  - ]:        663 :                 ATF_CHECK_EQ_MSG(f - mrhb_test_vals[i].in,
    1007                 :            :                                  mrhb_test_vals[i].fend_offset,
    1008                 :            :                                  "(test %d)", i);
    1009         [ +  - ]:        663 :                 ATF_CHECK_EQ_MSG(*f, mrhb_test_vals[i].fend_val,
    1010                 :            :                                  "(test %d)", i);
    1011                 :        663 :         }
    1012                 :            : 
    1013                 :         13 :         xstring_free(buf);
    1014                 :         13 : }
    1015                 :            : 
    1016                 :            : 
    1017                 :            : ATF_TC(read_oct_byte);
    1018                 :        221 : ATF_TC_HEAD(read_oct_byte, tc)
    1019                 :            : {
    1020                 :        221 :         atf_tc_set_md_var(tc, "descr",
    1021                 :            :             "Testing read_oct_byte() format parsing routine");
    1022                 :        221 : }
    1023                 :         13 : ATF_TC_BODY(read_oct_byte, tc)
    1024                 :            : {
    1025                 :         13 :         xstring *buf = NULL;
    1026                 :            :         const char      *f;
    1027                 :            :         int              i;
    1028                 :            : 
    1029                 :            :         struct rob_test_vals {
    1030                 :            :                 const char *in;
    1031                 :            :                 const char *out; /* What gets written to the buf */
    1032                 :            :                 ptrdiff_t   fend_offset; /* Where f is left pointing */
    1033                 :            :                 char        fend_val; /* expected first char in fend */
    1034                 :         13 :         } rob_test_vals[] = {
    1035                 :            :                 { "141",    "a",   3, '\0', },
    1036                 :            :                 { "0",      "\0",  1, '\0', },
    1037                 :            :                 { "08",     "\0",  1, '8',  },
    1038                 :            :                 { "008",    "\0",  2, '8',  },
    1039                 :            :                 { "0008",   "\0",  3, '8',  },
    1040                 :            :                 { "00008",  "\0",  3, '0',  },
    1041                 :            : 
    1042                 :            :                 { "1",     "\001", 1, '\0', },
    1043                 :            :                 { "2",     "\002", 1, '\0', },
    1044                 :            :                 { "3",     "\003", 1, '\0', },
    1045                 :            :                 { "4",     "\004", 1, '\0', },
    1046                 :            :                 { "5",     "\005", 1, '\0', },
    1047                 :            :                 { "6",     "\006", 1, '\0', },
    1048                 :            :                 { "7",     "\007", 1, '\0', },
    1049                 :            : 
    1050                 :            :                 { "00",    "\000", 2, '\0', },
    1051                 :            :                 { "01",    "\001", 2, '\0', },
    1052                 :            :                 { "02",    "\002", 2, '\0', },
    1053                 :            :                 { "03",    "\003", 2, '\0', },
    1054                 :            :                 { "04",    "\004", 2, '\0', },
    1055                 :            :                 { "05",    "\005", 2, '\0', },
    1056                 :            :                 { "06",    "\006", 2, '\0', },
    1057                 :            :                 { "07",    "\007", 2, '\0', },
    1058                 :            : 
    1059                 :            :                 { "000",   "\000", 3, '\0', },
    1060                 :            :                 { "001",   "\001", 3, '\0', },
    1061                 :            :                 { "002",   "\002", 3, '\0', },
    1062                 :            :                 { "003",   "\003", 3, '\0', },
    1063                 :            :                 { "004",   "\004", 3, '\0', },
    1064                 :            :                 { "005",   "\005", 3, '\0', },
    1065                 :            :                 { "006",   "\006", 3, '\0', },
    1066                 :            :                 { "007",   "\007", 3, '\0', },
    1067                 :            : 
    1068                 :            :                 { "10",    "\010", 2, '\0', },
    1069                 :            :                 { "20",    "\020", 2, '\0', },
    1070                 :            :                 { "30",    "\030", 2, '\0', },
    1071                 :            :                 { "40",    "\040", 2, '\0', },
    1072                 :            :                 { "50",    "\050", 2, '\0', },
    1073                 :            :                 { "60",    "\060", 2, '\0', },
    1074                 :            :                 { "70",    "\070", 2, '\0', },
    1075                 :            : 
    1076                 :            :                 { "010",   "\010", 3, '\0', },
    1077                 :            :                 { "020",   "\020", 3, '\0', },
    1078                 :            :                 { "030",   "\030", 3, '\0', },
    1079                 :            :                 { "040",   "\040", 3, '\0', },
    1080                 :            :                 { "050",   "\050", 3, '\0', },
    1081                 :            :                 { "060",   "\060", 3, '\0', },
    1082                 :            :                 { "070",   "\070", 3, '\0', },
    1083                 :            : 
    1084                 :            :                 { "100",   "\100", 3, '\0', },
    1085                 :            :                 { "200",   "\200", 3, '\0', },
    1086                 :            :                 { "300",   "\300", 3, '\0', },
    1087                 :            : 
    1088                 :            :                 { "370",   "\370", 3, '\0', },
    1089                 :            :                 { "371",   "\371", 3, '\0', },
    1090                 :            :                 { "372",   "\372", 3, '\0', },
    1091                 :            :                 { "373",   "\373", 3, '\0', },
    1092                 :            :                 { "374",   "\374", 3, '\0', },
    1093                 :            :                 { "375",   "\375", 3, '\0', },
    1094                 :            :                 { "376",   "\376", 3, '\0', },
    1095                 :            :                 { "377",   "\377", 3, '\0', },
    1096                 :            :                 { "400",   "\040", 2, '0',  },
    1097                 :            : 
    1098                 :            :                 { NULL,   NULL,    0, '\0', },
    1099                 :            :         };
    1100                 :            : 
    1101         [ +  + ]:        728 :         for (i = 0; rob_test_vals[i].in != NULL; i++) {
    1102         [ +  + ]:        715 :                 xstring_renew(buf);
    1103                 :        715 :                 f = read_oct_byte(buf, rob_test_vals[i].in);
    1104                 :        715 :                 fflush(buf->fp);
    1105                 :            : 
    1106         [ +  - ]:        715 :                 ATF_CHECK_STREQ_MSG(buf->buf, rob_test_vals[i].out,
    1107                 :            :                                     "(test %d)", i);
    1108         [ +  - ]:        715 :                 ATF_CHECK_EQ_MSG(f - rob_test_vals[i].in,
    1109                 :            :                                  rob_test_vals[i].fend_offset,
    1110                 :            :                                  "(test %d)", i);
    1111         [ +  - ]:        715 :                 ATF_CHECK_EQ_MSG(*f, rob_test_vals[i].fend_val,
    1112                 :            :                                  "(test %d)", i);
    1113                 :        715 :         }
    1114                 :            : 
    1115                 :         13 :         xstring_free(buf);
    1116                 :         13 : }
    1117                 :            : 
    1118                 :            : ATF_TC(process_escape);
    1119                 :        221 : ATF_TC_HEAD(process_escape, tc)
    1120                 :            : {
    1121                 :        221 :         atf_tc_set_md_var(tc, "descr",
    1122                 :            :             "Testing process_escape() format parsing routine");
    1123                 :        221 : }
    1124                 :         13 : ATF_TC_BODY(process_escape, tc)
    1125                 :            : {
    1126                 :         13 :         xstring *buf = NULL;
    1127                 :            :         const char      *f;
    1128                 :            :         int              i;
    1129                 :            : 
    1130                 :            :         struct pe_test_vals {
    1131                 :            :                 const char *in;
    1132                 :            :                 const char *out; /* What gets written to the buf */
    1133                 :            :                 ptrdiff_t   fend_offset; /* Where f is left pointing */
    1134                 :            :                 char        fend_val; /* expected first char in fend */
    1135                 :         13 :         } pe_test_vals[] = {
    1136                 :            :                 { "\\a",   "\a",   2, '\0', },
    1137                 :            :                 { "\\b",   "\b",   2, '\0', },
    1138                 :            :                 { "\\f",   "\f",   2, '\0', },
    1139                 :            :                 { "\\n",   "\n",   2, '\0', },
    1140                 :            :                 { "\\t",   "\t",   2, '\0', },
    1141                 :            :                 { "\\v",   "\v",   2, '\0', },
    1142                 :            :                 { "\\'",   "'",    2, '\0', },
    1143                 :            :                 { "\\\"",  "\"",   2, '\0', },
    1144                 :            :                 { "\\\\",  "\\",   2, '\0', },
    1145                 :            : 
    1146                 :            :                 { "\\q",   "\\",   1, 'q',  },
    1147                 :            : 
    1148                 :            :                 /* See read_oct_byte() for more comprehensive tests on
    1149                 :            :                    octal number escapes */
    1150                 :            : 
    1151                 :            :                 { "\\1234",  "S",   4, '4',  },
    1152                 :            :                 { "\\89",    "\\",  1, '8',  },
    1153                 :            : 
    1154                 :            :                 /* See maybe_read_hex_byte() for more comprehensive
    1155                 :            :                    tests on hexadecimal number escapes */
    1156                 :            : 
    1157                 :            :                 { "\\x4cd",  "L",   4, 'd', },
    1158                 :            :                 { "\\xGG",   "\\x", 2, 'G', },
    1159                 :            : 
    1160                 :            :                 { NULL,   NULL,    0, '\0', },
    1161                 :            :         };
    1162                 :            : 
    1163         [ +  + ]:        195 :         for (i = 0; pe_test_vals[i].in != NULL; i++) {
    1164         [ +  + ]:        182 :                 xstring_renew(buf);
    1165                 :        182 :                 f = process_escape(buf, pe_test_vals[i].in);
    1166                 :        182 :                 fflush(buf->fp);
    1167                 :            : 
    1168         [ +  - ]:        182 :                 ATF_CHECK_STREQ_MSG(buf->buf, pe_test_vals[i].out,
    1169                 :            :                                     "(test %d)", i);
    1170         [ +  - ]:        182 :                 ATF_CHECK_EQ_MSG(f - pe_test_vals[i].in,
    1171                 :            :                                  pe_test_vals[i].fend_offset,
    1172                 :            :                                  "(test %d)", i);
    1173         [ +  - ]:        182 :                 ATF_CHECK_EQ_MSG(*f, pe_test_vals[i].fend_val,
    1174                 :            :                                  "(test %d)", i);
    1175                 :        182 :         }
    1176                 :            : 
    1177                 :         13 :         xstring_free(buf);
    1178                 :         13 : }
    1179                 :            : 
    1180                 :            : ATF_TC(field_modifier);
    1181                 :        221 : ATF_TC_HEAD(field_modifier, tc)
    1182                 :            : {
    1183                 :        221 :         atf_tc_set_md_var(tc, "descr",
    1184                 :            :             "Testing field_modifier() format parsing routine");
    1185                 :        221 : }
    1186                 :         13 : ATF_TC_BODY(field_modifier, tc)
    1187                 :            : {
    1188                 :            :         struct percent_esc      *p;
    1189                 :            :         const char              *f;
    1190                 :            :         int                     i;
    1191                 :            : 
    1192                 :            :         struct fm_test_vals {
    1193                 :            :                 const char *in;
    1194                 :            :                 unsigned flags; 
    1195                 :            :                 ptrdiff_t   fend_offset; /* Where f is left pointing */
    1196                 :            :                 char        fend_val; /* expected first char in fend */
    1197                 :         13 :         } fm_test_vals[] = {
    1198                 :            :                 { "?",  PP_ALTERNATE_FORM1, 1, '\0', },
    1199                 :            :                 { "#",  PP_ALTERNATE_FORM2, 1, '\0', },
    1200                 :            :                 { "-",  PP_LEFT_ALIGN,      1, '\0', },
    1201                 :            :                 { "+",  PP_EXPLICIT_PLUS,   1, '\0', },
    1202                 :            :                 { " ",  PP_SPACE_FOR_PLUS,  1, '\0', },
    1203                 :            :                 { "0",  PP_ZERO_PAD,        1, '\0', },
    1204                 :            :                 { "\'", PP_THOUSANDS_SEP,   1, '\0', },
    1205                 :            : 
    1206                 :            :                 /* Not a format modifier... */
    1207                 :            :                 { "z",  0,  0, 'z', },
    1208                 :            :                 { "*",  0,  0, '*', },
    1209                 :            :                 { "1",  0,  0, '1', },
    1210                 :            : 
    1211                 :            :                 { "#",    PP_ALTERNATE_FORM2, 1, '\0', },
    1212                 :            :                 { "##",   PP_ALTERNATE_FORM2, 2, '\0', },
    1213                 :            :                 { "###",  PP_ALTERNATE_FORM2, 3, '\0', },
    1214                 :            :                 { "####", PP_ALTERNATE_FORM2, 4, '\0', },
    1215                 :            : 
    1216                 :            :                 { "#z",    PP_ALTERNATE_FORM2, 1, 'z', },
    1217                 :            :                 { "##z",   PP_ALTERNATE_FORM2, 2, 'z', },
    1218                 :            :                 { "###z",  PP_ALTERNATE_FORM2, 3, 'z', },
    1219                 :            :                 { "####z", PP_ALTERNATE_FORM2, 4, 'z', },
    1220                 :            : 
    1221                 :            :                 { "#",    PP_ALTERNATE_FORM2, 1, '\0', },
    1222                 :            :                 { "#?",   PP_ALTERNATE_FORM1|PP_ALTERNATE_FORM2, 2, '\0', },
    1223                 :            :                 { "#?#",  PP_ALTERNATE_FORM1|PP_ALTERNATE_FORM2, 3, '\0', },
    1224                 :            :                 { "#?#?", PP_ALTERNATE_FORM1|PP_ALTERNATE_FORM2, 4, '\0', },
    1225                 :            : 
    1226                 :            :                 { NULL,   0,    0, '\0', },
    1227                 :            :         };
    1228                 :            : 
    1229                 :         13 :         p = new_percent_esc();
    1230                 :            : 
    1231         [ +  - ]:         13 :         ATF_REQUIRE_EQ(p != NULL, true);
    1232                 :            : 
    1233         [ +  + ]:        299 :         for (i = 0; fm_test_vals[i].in != NULL; i++) {
    1234                 :        286 :                 p->flags = 0;
    1235                 :        286 :                 f = field_modifier(fm_test_vals[i].in, p);
    1236                 :            : 
    1237         [ +  - ]:        286 :                 ATF_CHECK_EQ_MSG(p->flags, fm_test_vals[i].flags,
    1238                 :            :                                     "(test %d)", i);
    1239         [ +  - ]:        286 :                 ATF_CHECK_EQ_MSG(f - fm_test_vals[i].in,
    1240                 :            :                                  fm_test_vals[i].fend_offset,
    1241                 :            :                                  "(test %d)", i);
    1242         [ +  - ]:        286 :                 ATF_CHECK_EQ_MSG(*f, fm_test_vals[i].fend_val,
    1243                 :            :                                  "(test %d)", i);
    1244                 :        286 :         }
    1245                 :            : 
    1246                 :         13 :         free_percent_esc(p);
    1247                 :         13 : }
    1248                 :            : 
    1249                 :            : ATF_TC(field_width);
    1250                 :        221 : ATF_TC_HEAD(field_width, tc)
    1251                 :            : {
    1252                 :        221 :         atf_tc_set_md_var(tc, "descr",
    1253                 :            :             "Testing field_width() format parsing routine");
    1254                 :        221 : }
    1255                 :         13 : ATF_TC_BODY(field_width, tc)
    1256                 :            : {
    1257                 :            :         struct percent_esc      *p;
    1258                 :            :         const char              *f;
    1259                 :            :         int                     i;
    1260                 :            : 
    1261                 :            :         struct fw_test_vals {
    1262                 :            :                 const char *in;
    1263                 :            :                 int width; 
    1264                 :            :                 ptrdiff_t   fend_offset; /* Where f is left pointing */
    1265                 :            :                 char        fend_val; /* expected first char in fend */
    1266                 :         13 :         } fw_test_vals[] = {
    1267                 :            :                 {  "0",  0, 1, '\0', },
    1268                 :            :                 {  "1",  1, 1, '\0', },
    1269                 :            :                 {  "2",  2, 1, '\0', },
    1270                 :            :                 {  "3",  3, 1, '\0', },
    1271                 :            :                 {  "4",  4, 1, '\0', },
    1272                 :            :                 {  "5",  5, 1, '\0', },
    1273                 :            :                 {  "6",  6, 1, '\0', },
    1274                 :            :                 {  "7",  7, 1, '\0', },
    1275                 :            :                 {  "8",  8, 1, '\0', },
    1276                 :            :                 {  "9",  9, 1, '\0', },
    1277                 :            : 
    1278                 :            :                 { "10", 10, 2, '\0', },
    1279                 :            :                 { "11", 11, 2, '\0', },
    1280                 :            :                 { "12", 12, 2, '\0', },
    1281                 :            : 
    1282                 :            :                 { "23", 23, 2, '\0', },
    1283                 :            :                 { "34", 34, 2, '\0', },
    1284                 :            :                 { "45", 45, 2, '\0', },
    1285                 :            :                 { "56", 56, 2, '\0', },
    1286                 :            :                 { "67", 67, 2, '\0', },
    1287                 :            :                 { "78", 78, 2, '\0', },
    1288                 :            :                 { "89", 89, 2, '\0', },
    1289                 :            :                 { "90", 90, 2, '\0', },
    1290                 :            : 
    1291                 :            :                 { "00",  0, 2, '\0', },
    1292                 :            :                 { "001", 1, 3, '\0', },
    1293                 :            :                 { "x",   0, 0, 'x',  },
    1294                 :            :                 { "0x",  0, 1, 'x',  },
    1295                 :            : 
    1296                 :            :                 { NULL,  0, 0, '\0', },
    1297                 :            :         };
    1298                 :            : 
    1299                 :         13 :         p = new_percent_esc();
    1300                 :            : 
    1301         [ +  - ]:         13 :         ATF_REQUIRE_EQ(p != NULL, true);
    1302                 :            : 
    1303         [ +  + ]:        338 :         for (i = 0; fw_test_vals[i].in != NULL; i++) {
    1304                 :        325 :                 p->width = 0;
    1305                 :        325 :                 f = field_width(fw_test_vals[i].in, p);
    1306                 :            : 
    1307         [ +  - ]:        325 :                 ATF_CHECK_EQ_MSG(p->width, fw_test_vals[i].width,
    1308                 :            :                                     "(test %d)", i);
    1309         [ +  - ]:        325 :                 ATF_CHECK_EQ_MSG(f - fw_test_vals[i].in,
    1310                 :            :                                  fw_test_vals[i].fend_offset,
    1311                 :            :                                  "(test %d)", i);
    1312         [ +  - ]:        325 :                 ATF_CHECK_EQ_MSG(*f, fw_test_vals[i].fend_val,
    1313                 :            :                                  "(test %d)", i);
    1314                 :        325 :         }
    1315                 :            : 
    1316                 :         13 :         free_percent_esc(p);
    1317                 :         13 : }
    1318                 :            : 
    1319                 :            : ATF_TC(format_code);
    1320                 :        221 : ATF_TC_HEAD(format_code, tc)
    1321                 :            :         
    1322                 :            : {
    1323                 :        221 :         atf_tc_set_md_var(tc, "descr",
    1324                 :            :             "Testing format_code() format parsing routine");
    1325                 :        221 : }
    1326                 :         13 : ATF_TC_BODY(format_code, tc)
    1327                 :            : {
    1328                 :            :         struct percent_esc      *p;
    1329                 :            :         const char              *f;
    1330                 :            :         int                     i;
    1331                 :            : 
    1332                 :            :         struct fc_test_vals {
    1333                 :            :                 const char *in;
    1334                 :            :                 unsigned context;
    1335                 :            :                 fmt_code_t fmt_code; 
    1336                 :            :                 ptrdiff_t   fend_offset; /* Where f is left pointing */
    1337                 :            :                 char        fend_val; /* expected first char in fend */
    1338                 :         13 :         } fc_test_vals[] = {
    1339                 :            :                 { "Bn", PP_PKG, PP_PKG_SHLIB_REQUIRED_NAME, 2, '\0', },
    1340                 :            :                 { "B",  PP_PKG, PP_PKG_SHLIBS_REQUIRED,     1, '\0', },
    1341                 :            :                 { "Cn", PP_PKG, PP_PKG_CATEGORY_NAME,       2, '\0', },
    1342                 :            :                 { "C",  PP_PKG, PP_PKG_CATEGORIES,          1, '\0', },
    1343                 :            :                 { "Dg", PP_PKG, PP_PKG_DIRECTORY_GROUP,     2, '\0', },
    1344                 :            :                 { "Dn", PP_PKG, PP_PKG_DIRECTORY_PATH,      2, '\0', },
    1345                 :            :                 { "Dp", PP_PKG, PP_PKG_DIRECTORY_PERMS,     2, '\0', },
    1346                 :            :                 { "Du", PP_PKG, PP_PKG_DIRECTORY_USER,      2, '\0', },
    1347                 :            :                 { "D",  PP_PKG, PP_PKG_DIRECTORIES,         1, '\0', },
    1348                 :            :                 { "Fg", PP_PKG, PP_PKG_FILE_GROUP,          2, '\0', },
    1349                 :            :                 { "Fn", PP_PKG, PP_PKG_FILE_PATH,           2, '\0', },
    1350                 :            :                 { "Fp", PP_PKG, PP_PKG_FILE_PERMS,          2, '\0', },
    1351                 :            :                 { "Fs", PP_PKG, PP_PKG_FILE_SHA256,         2, '\0', },
    1352                 :            :                 { "Fu", PP_PKG, PP_PKG_FILE_USER,           2, '\0', },
    1353                 :            :                 { "F",  PP_PKG, PP_PKG_FILES,               1, '\0', },
    1354                 :            :                 { "Gn", PP_PKG, PP_PKG_GROUP_NAME,          2, '\0', },
    1355                 :            :                 { "G",  PP_PKG, PP_PKG_GROUPS,              1, '\0', },
    1356                 :            :                 { "I",  PP_PKG, PP_UNKNOWN,                 0, 'I',  },
    1357                 :            :                 { "Ln", PP_PKG, PP_PKG_LICENSE_NAME,        2, '\0', },
    1358                 :            :                 { "L",  PP_PKG, PP_PKG_LICENSES,            1, '\0', },
    1359                 :            :                 { "M",  PP_PKG, PP_PKG_MESSAGE,             1, '\0', },
    1360                 :            :                 { "N",  PP_PKG, PP_PKG_REPO_IDENT,          1, '\0', },
    1361                 :            :                 { "On", PP_PKG, PP_PKG_OPTION_NAME,         2, '\0', },
    1362                 :            :                 { "Ov", PP_PKG, PP_PKG_OPTION_VALUE,        2, '\0', },
    1363                 :            :                 { "Od", PP_PKG, PP_PKG_OPTION_DEFAULT,      2, '\0', },
    1364                 :            :                 { "OD", PP_PKG, PP_PKG_OPTION_DESCRIPTION,  2, '\0', },
    1365                 :            :                 { "O",  PP_PKG, PP_PKG_OPTIONS,             1, '\0', },
    1366                 :            :                 { "R",  PP_PKG, PP_PKG_REPO_PATH,           1, '\0', },
    1367                 :            :                 { "S",  PP_PKG, PP_PKG_CHAR_STRING,         1, '\0', },
    1368                 :            :                 { "Un", PP_PKG, PP_PKG_USER_NAME,           2, '\0', },
    1369                 :            :                 { "U",  PP_PKG, PP_PKG_USERS,               1, '\0', },
    1370                 :            :                 { "V",  PP_PKG, PP_PKG_OLD_VERSION,         1, '\0', },
    1371                 :            :                 { "a",  PP_PKG, PP_PKG_AUTOREMOVE,          1, '\0', },
    1372                 :            :                 { "bn", PP_PKG, PP_PKG_SHLIB_PROVIDED_NAME, 2, '\0', },
    1373                 :            :                 { "b",  PP_PKG, PP_PKG_SHLIBS_PROVIDED,     1, '\0', },
    1374                 :            :                 { "c",  PP_PKG, PP_PKG_COMMENT,             1, '\0', },
    1375                 :            :                 { "dk", PP_PKG, PP_PKG_DEPENDENCY_LOCK,     2, '\0', },
    1376                 :            :                 { "dn", PP_PKG, PP_PKG_DEPENDENCY_NAME,     2, '\0', },
    1377                 :            :                 { "do", PP_PKG, PP_PKG_DEPENDENCY_ORIGIN,   2, '\0', },
    1378                 :            :                 { "dv", PP_PKG, PP_PKG_DEPENDENCY_VERSION,  2, '\0', },
    1379                 :            :                 { "d",  PP_PKG, PP_PKG_DEPENDENCIES,        1, '\0', },
    1380                 :            :                 { "e",  PP_PKG, PP_PKG_DESCRIPTION,         1, '\0', },
    1381                 :            :                 { "k",  PP_PKG, PP_PKG_LOCK_STATUS,         1, '\0', },
    1382                 :            :                 { "l",  PP_PKG, PP_PKG_LICENSE_LOGIC,       1, '\0', },
    1383                 :            :                 { "m",  PP_PKG, PP_PKG_MAINTAINER,          1, '\0', },
    1384                 :            :                 { "n",  PP_PKG, PP_PKG_NAME,                1, '\0', },
    1385                 :            :                 { "o",  PP_PKG, PP_PKG_ORIGIN,              1, '\0', },
    1386                 :            :                 { "p",  PP_PKG, PP_PKG_PREFIX,              1, '\0', },
    1387                 :            :                 { "q",  PP_PKG, PP_PKG_ARCHITECTURE,        1, '\0', },
    1388                 :            :                 { "rk", PP_PKG, PP_PKG_REQUIREMENT_LOCK,    2, '\0', },
    1389                 :            :                 { "rn", PP_PKG, PP_PKG_REQUIREMENT_NAME,    2, '\0', },
    1390                 :            :                 { "ro", PP_PKG, PP_PKG_REQUIREMENT_ORIGIN,  2, '\0', },
    1391                 :            :                 { "rv", PP_PKG, PP_PKG_REQUIREMENT_VERSION, 2, '\0', },
    1392                 :            :                 { "r",  PP_PKG, PP_PKG_REQUIREMENTS,        1, '\0', },
    1393                 :            :                 { "s",  PP_PKG, PP_PKG_FLATSIZE,            1, '\0', },
    1394                 :            :                 { "t",  PP_PKG, PP_PKG_INSTALL_TIMESTAMP,   1, '\0', },
    1395                 :            :                 { "u",  PP_PKG, PP_PKG_CHECKSUM,            1, '\0', },
    1396                 :            :                 { "v",  PP_PKG, PP_PKG_VERSION,             1, '\0', },
    1397                 :            :                 { "w",  PP_PKG, PP_PKG_HOME_PAGE,           1, '\0', },
    1398                 :            :                 { "x",  PP_PKG, PP_PKG_PKGSIZE,             1, '\0', },
    1399                 :            :                 { "z",  PP_PKG, PP_PKG_SHORT_CHECKSUM,      1, '\0', },
    1400                 :            :                 { "%",  PP_PKG, PP_LITERAL_PERCENT,         1, '\0', },
    1401                 :            :                 { "Z",  PP_PKG, PP_UNKNOWN,                 0, 'Z',  },
    1402                 :            : 
    1403                 :            :                 { "Bn", PP_B, PP_PKG_SHLIB_REQUIRED_NAME, 2, '\0', },
    1404                 :            :                 { "B",  PP_B, PP_UNKNOWN,                 0, 'B',  },
    1405                 :            :                 { "Cn", PP_B, PP_UNKNOWN,                 0, 'C',  },
    1406                 :            :                 { "C",  PP_B, PP_UNKNOWN,                 0, 'C',  },
    1407                 :            :                 { "Dg", PP_B, PP_UNKNOWN,                 0, 'D',  },
    1408                 :            :                 { "Dk", PP_B, PP_UNKNOWN,                 0, 'D',  },
    1409                 :            :                 { "Dn", PP_B, PP_UNKNOWN,                 0, 'D',  },
    1410                 :            :                 { "Dp", PP_B, PP_UNKNOWN,                 0, 'D',  },
    1411                 :            :                 { "Dt", PP_B, PP_UNKNOWN,                 0, 'D',  },
    1412                 :            :                 { "Du", PP_B, PP_UNKNOWN,                 0, 'D',  },
    1413                 :            :                 { "D",  PP_B, PP_UNKNOWN,                 0, 'D',  },
    1414                 :            :                 { "Fg", PP_B, PP_UNKNOWN,                 0, 'F',  },
    1415                 :            :                 { "Fk", PP_B, PP_UNKNOWN,                 0, 'F',  },
    1416                 :            :                 { "Fn", PP_B, PP_UNKNOWN,                 0, 'F',  },
    1417                 :            :                 { "Fp", PP_B, PP_UNKNOWN,                 0, 'F',  },
    1418                 :            :                 { "Fs", PP_B, PP_UNKNOWN,                 0, 'F',  },
    1419                 :            :                 { "Fu", PP_B, PP_UNKNOWN,                 0, 'F',  },
    1420                 :            :                 { "F",  PP_B, PP_UNKNOWN,                 0, 'F',  },
    1421                 :            :                 { "Gn", PP_B, PP_UNKNOWN,                 0, 'G',  },
    1422                 :            :                 { "G",  PP_B, PP_UNKNOWN,                 0, 'G',  },
    1423                 :            :                 { "I",  PP_B, PP_ROW_COUNTER,             1, '\0', },
    1424                 :            :                 { "Ln", PP_B, PP_UNKNOWN,                 0, 'L',  },
    1425                 :            :                 { "L",  PP_B, PP_UNKNOWN,                 0, 'L',  },
    1426                 :            :                 { "M",  PP_B, PP_PKG_MESSAGE,             1, '\0', },
    1427                 :            :                 { "N",  PP_B, PP_PKG_REPO_IDENT,          1, '\0', },
    1428                 :            :                 { "On", PP_B, PP_UNKNOWN,                 0, 'O',  },
    1429                 :            :                 { "Ov", PP_B, PP_UNKNOWN,                 0, 'O',  },
    1430                 :            :                 { "Od", PP_B, PP_UNKNOWN,                 0, 'O',  },
    1431                 :            :                 { "OD", PP_B, PP_UNKNOWN,                 0, 'O',  },
    1432                 :            :                 { "O",  PP_B, PP_UNKNOWN,                 0, 'O',  },
    1433                 :            :                 { "R",  PP_B, PP_PKG_REPO_PATH,           1, '\0', },
    1434                 :            :                 { "S",  PP_B, PP_UNKNOWN,                 0, 'S',  },
    1435                 :            :                 { "Un", PP_B, PP_UNKNOWN,                 0, 'U',  },
    1436                 :            :                 { "U",  PP_B, PP_UNKNOWN,                 0, 'U',  },
    1437                 :            :                 { "V",  PP_B, PP_PKG_OLD_VERSION,         1, '\0', },
    1438                 :            :                 { "a",  PP_B, PP_PKG_AUTOREMOVE,          1, '\0', },
    1439                 :            :                 { "bn", PP_B, PP_UNKNOWN,                 0, 'b',  },
    1440                 :            :                 { "b",  PP_B, PP_UNKNOWN,                 0, 'b',  },
    1441                 :            :                 { "c",  PP_B, PP_PKG_COMMENT,             1, '\0', },
    1442                 :            :                 { "dk", PP_B, PP_UNKNOWN,                 0, 'd',  },
    1443                 :            :                 { "dn", PP_B, PP_UNKNOWN,                 0, 'd',  },
    1444                 :            :                 { "do", PP_B, PP_UNKNOWN,                 0, 'd',  },
    1445                 :            :                 { "dv", PP_B, PP_UNKNOWN,                 0, 'd',  },
    1446                 :            :                 { "d",  PP_B, PP_UNKNOWN,                 0, 'd',  },
    1447                 :            :                 { "e",  PP_B, PP_PKG_DESCRIPTION,         1, '\0', },
    1448                 :            :                 { "k",  PP_B, PP_PKG_LOCK_STATUS,         1, '\0', },
    1449                 :            :                 { "l",  PP_B, PP_PKG_LICENSE_LOGIC,       1, '\0', },
    1450                 :            :                 { "m",  PP_B, PP_PKG_MAINTAINER,          1, '\0', },
    1451                 :            :                 { "n",  PP_B, PP_PKG_NAME,                1, '\0', },
    1452                 :            :                 { "o",  PP_B, PP_PKG_ORIGIN,              1, '\0', },
    1453                 :            :                 { "p",  PP_B, PP_PKG_PREFIX,              1, '\0', },
    1454                 :            :                 { "q",  PP_B, PP_PKG_ARCHITECTURE,        1, '\0', },
    1455                 :            :                 { "rk", PP_B, PP_UNKNOWN,                 0, 'r',  },
    1456                 :            :                 { "rn", PP_B, PP_UNKNOWN,                 0, 'r',  },
    1457                 :            :                 { "ro", PP_B, PP_UNKNOWN,                 0, 'r',  },
    1458                 :            :                 { "rv", PP_B, PP_UNKNOWN,                 0, 'r',  },
    1459                 :            :                 { "r",  PP_B, PP_UNKNOWN,                 0, 'r',  },
    1460                 :            :                 { "s",  PP_B, PP_PKG_FLATSIZE,            1, '\0', },
    1461                 :            :                 { "t",  PP_B, PP_PKG_INSTALL_TIMESTAMP,   1, '\0', },
    1462                 :            :                 { "u",  PP_B, PP_PKG_CHECKSUM,            1, '\0', },
    1463                 :            :                 { "v",  PP_B, PP_PKG_VERSION,             1, '\0', },
    1464                 :            :                 { "w",  PP_B, PP_PKG_HOME_PAGE,           1, '\0', },
    1465                 :            :                 { "x",  PP_B, PP_PKG_PKGSIZE,             1, '\0', },
    1466                 :            :                 { "z",  PP_B, PP_PKG_SHORT_CHECKSUM,      1, '\0', },
    1467                 :            :                 { "%",  PP_B, PP_LITERAL_PERCENT,         1, '\0', },
    1468                 :            :                 { "Z",  PP_B, PP_UNKNOWN,                 0, 'Z',  },
    1469                 :            : 
    1470                 :            :                 { "Bn", PP_C, PP_UNKNOWN,                 0, 'B',  },
    1471                 :            :                 { "B",  PP_C, PP_UNKNOWN,                 0, 'B',  },
    1472                 :            :                 { "Cn", PP_C, PP_PKG_CATEGORY_NAME,       2, '\0', },
    1473                 :            :                 { "C",  PP_C, PP_UNKNOWN,                 0, 'C',  },
    1474                 :            :                 { "Dg", PP_C, PP_UNKNOWN,                 0, 'D',  },
    1475                 :            :                 { "Dk", PP_C, PP_UNKNOWN,                 0, 'D',  },
    1476                 :            :                 { "Dn", PP_C, PP_UNKNOWN,                 0, 'D',  },
    1477                 :            :                 { "Dp", PP_C, PP_UNKNOWN,                 0, 'D',  },
    1478                 :            :                 { "Dt", PP_C, PP_UNKNOWN,                 0, 'D',  },
    1479                 :            :                 { "Du", PP_C, PP_UNKNOWN,                 0, 'D',  },
    1480                 :            :                 { "D",  PP_C, PP_UNKNOWN,                 0, 'D',  },
    1481                 :            :                 { "Fg", PP_C, PP_UNKNOWN,                 0, 'F',  },
    1482                 :            :                 { "Fk", PP_C, PP_UNKNOWN,                 0, 'F',  },
    1483                 :            :                 { "Fn", PP_C, PP_UNKNOWN,                 0, 'F',  },
    1484                 :            :                 { "Fp", PP_C, PP_UNKNOWN,                 0, 'F',  },
    1485                 :            :                 { "Fs", PP_C, PP_UNKNOWN,                 0, 'F',  },
    1486                 :            :                 { "Fu", PP_C, PP_UNKNOWN,                 0, 'F',  },
    1487                 :            :                 { "F",  PP_C, PP_UNKNOWN,                 0, 'F',  },
    1488                 :            :                 { "Gn", PP_C, PP_UNKNOWN,                 0, 'G',  },
    1489                 :            :                 { "G",  PP_C, PP_UNKNOWN,                 0, 'G',  },
    1490                 :            :                 { "I",  PP_C, PP_ROW_COUNTER,             1, '\0', },
    1491                 :            :                 { "Ln", PP_C, PP_UNKNOWN,                 0, 'L',  },
    1492                 :            :                 { "L",  PP_C, PP_UNKNOWN,                 0, 'L',  },
    1493                 :            :                 { "M",  PP_C, PP_PKG_MESSAGE,             1, '\0', },
    1494                 :            :                 { "N",  PP_C, PP_PKG_REPO_IDENT,          1, '\0', },
    1495                 :            :                 { "On", PP_C, PP_UNKNOWN,                 0, 'O',  },
    1496                 :            :                 { "Ov", PP_C, PP_UNKNOWN,                 0, 'O',  },
    1497                 :            :                 { "Od", PP_C, PP_UNKNOWN,                 0, 'O',  },
    1498                 :            :                 { "OD", PP_C, PP_UNKNOWN,                 0, 'O',  },
    1499                 :            :                 { "O",  PP_C, PP_UNKNOWN,                 0, 'O',  },
    1500                 :            :                 { "R",  PP_C, PP_PKG_REPO_PATH,           1, '\0', },
    1501                 :            :                 { "S",  PP_C, PP_UNKNOWN,                 0, 'S',  },
    1502                 :            :                 { "Un", PP_C, PP_UNKNOWN,                 0, 'U',  },
    1503                 :            :                 { "U",  PP_C, PP_UNKNOWN,                 0, 'U',  },
    1504                 :            :                 { "V",  PP_C, PP_PKG_OLD_VERSION,         1, '\0', },
    1505                 :            :                 { "a",  PP_C, PP_PKG_AUTOREMOVE,          1, '\0', },
    1506                 :            :                 { "bn", PP_C, PP_UNKNOWN,                 0, 'b',  },
    1507                 :            :                 { "b",  PP_C, PP_UNKNOWN,                 0, 'b',  },
    1508                 :            :                 { "c",  PP_C, PP_PKG_COMMENT,             1, '\0', },
    1509                 :            :                 { "dk", PP_C, PP_UNKNOWN,                 0, 'd',  },
    1510                 :            :                 { "dn", PP_C, PP_UNKNOWN,                 0, 'd',  },
    1511                 :            :                 { "do", PP_C, PP_UNKNOWN,                 0, 'd',  },
    1512                 :            :                 { "dv", PP_C, PP_UNKNOWN,                 0, 'd',  },
    1513                 :            :                 { "d",  PP_C, PP_UNKNOWN,                 0, 'd',  },
    1514                 :            :                 { "e",  PP_C, PP_PKG_DESCRIPTION,         1, '\0', },
    1515                 :            :                 { "k",  PP_C, PP_PKG_LOCK_STATUS,         1, '\0', },
    1516                 :            :                 { "l",  PP_C, PP_PKG_LICENSE_LOGIC,       1, '\0', },
    1517                 :            :                 { "m",  PP_C, PP_PKG_MAINTAINER,          1, '\0', },
    1518                 :            :                 { "n",  PP_C, PP_PKG_NAME,                1, '\0', },
    1519                 :            :                 { "o",  PP_C, PP_PKG_ORIGIN,              1, '\0', },
    1520                 :            :                 { "p",  PP_C, PP_PKG_PREFIX,              1, '\0', },
    1521                 :            :                 { "q",  PP_C, PP_PKG_ARCHITECTURE,        1, '\0', },
    1522                 :            :                 { "rk", PP_C, PP_UNKNOWN,                 0, 'r',  },
    1523                 :            :                 { "rn", PP_C, PP_UNKNOWN,                 0, 'r',  },
    1524                 :            :                 { "ro", PP_C, PP_UNKNOWN,                 0, 'r',  },
    1525                 :            :                 { "rv", PP_C, PP_UNKNOWN,                 0, 'r',  },
    1526                 :            :                 { "r",  PP_C, PP_UNKNOWN,                 0, 'r',  },
    1527                 :            :                 { "s",  PP_C, PP_PKG_FLATSIZE,            1, '\0', },
    1528                 :            :                 { "t",  PP_C, PP_PKG_INSTALL_TIMESTAMP,   1, '\0', },
    1529                 :            :                 { "u",  PP_C, PP_PKG_CHECKSUM,            1, '\0', },
    1530                 :            :                 { "v",  PP_C, PP_PKG_VERSION,             1, '\0', },
    1531                 :            :                 { "w",  PP_C, PP_PKG_HOME_PAGE,           1, '\0', },
    1532                 :            :                 { "x",  PP_C, PP_PKG_PKGSIZE,             1, '\0', },
    1533                 :            :                 { "z",  PP_C, PP_PKG_SHORT_CHECKSUM,      1, '\0', },
    1534                 :            :                 { "%",  PP_C, PP_LITERAL_PERCENT,         1, '\0', },
    1535                 :            :                 { "Z",  PP_C, PP_UNKNOWN,                 0, 'Z',  },
    1536                 :            : 
    1537                 :            :                 { "Bn", PP_D, PP_UNKNOWN,                 0, 'B',  },
    1538                 :            :                 { "B",  PP_D, PP_UNKNOWN,                 0, 'B',  },
    1539                 :            :                 { "Cn", PP_D, PP_UNKNOWN,                 0, 'C',  },
    1540                 :            :                 { "C",  PP_D, PP_UNKNOWN,                 0, 'C',  },
    1541                 :            :                 { "Dg", PP_D, PP_PKG_DIRECTORY_GROUP,     2, '\0', },
    1542                 :            :                 { "Dn", PP_D, PP_PKG_DIRECTORY_PATH,      2, '\0', },
    1543                 :            :                 { "Dp", PP_D, PP_PKG_DIRECTORY_PERMS,     2, '\0', },
    1544                 :            :                 { "Du", PP_D, PP_PKG_DIRECTORY_USER,      2, '\0', },
    1545                 :            :                 { "D",  PP_D, PP_UNKNOWN,                 0, 'D',  },
    1546                 :            :                 { "Fg", PP_D, PP_UNKNOWN,                 0, 'F',  },
    1547                 :            :                 { "Fk", PP_D, PP_UNKNOWN,                 0, 'F',  },
    1548                 :            :                 { "Fn", PP_D, PP_UNKNOWN,                 0, 'F',  },
    1549                 :            :                 { "Fp", PP_D, PP_UNKNOWN,                 0, 'F',  },
    1550                 :            :                 { "Fs", PP_D, PP_UNKNOWN,                 0, 'F',  },
    1551                 :            :                 { "Fu", PP_D, PP_UNKNOWN,                 0, 'F',  },
    1552                 :            :                 { "F",  PP_D, PP_UNKNOWN,                 0, 'F',  },
    1553                 :            :                 { "Gn", PP_D, PP_UNKNOWN,                 0, 'G',  },
    1554                 :            :                 { "G",  PP_D, PP_UNKNOWN,                 0, 'G',  },
    1555                 :            :                 { "I",  PP_D, PP_ROW_COUNTER,             1, '\0', },
    1556                 :            :                 { "Ln", PP_D, PP_UNKNOWN,                 0, 'L',  },
    1557                 :            :                 { "L",  PP_D, PP_UNKNOWN,                 0, 'L',  },
    1558                 :            :                 { "M",  PP_D, PP_PKG_MESSAGE,             1, '\0', },
    1559                 :            :                 { "N",  PP_D, PP_PKG_REPO_IDENT,          1, '\0', },
    1560                 :            :                 { "On", PP_D, PP_UNKNOWN,                 0, 'O',  },
    1561                 :            :                 { "Ov", PP_D, PP_UNKNOWN,                 0, 'O',  },
    1562                 :            :                 { "Od", PP_D, PP_UNKNOWN,                 0, 'O',  },
    1563                 :            :                 { "OD", PP_D, PP_UNKNOWN,                 0, 'O',  },
    1564                 :            :                 { "O",  PP_D, PP_UNKNOWN,                 0, 'O',  },
    1565                 :            :                 { "R",  PP_D, PP_PKG_REPO_PATH,           1, '\0', },
    1566                 :            :                 { "S",  PP_D, PP_UNKNOWN,                 0, 'S',  },
    1567                 :            :                 { "Un", PP_D, PP_UNKNOWN,                 0, 'U',  },
    1568                 :            :                 { "U",  PP_D, PP_UNKNOWN,                 0, 'U',  },
    1569                 :            :                 { "V",  PP_D, PP_PKG_OLD_VERSION,         1, '\0', },
    1570                 :            :                 { "a",  PP_D, PP_PKG_AUTOREMOVE,          1, '\0', },
    1571                 :            :                 { "bn", PP_D, PP_UNKNOWN,                 0, 'b',  },
    1572                 :            :                 { "b",  PP_D, PP_UNKNOWN,                 0, 'b',  },
    1573                 :            :                 { "c",  PP_D, PP_PKG_COMMENT,             1, '\0', },
    1574                 :            :                 { "dk", PP_D, PP_UNKNOWN,                 0, 'd',  },
    1575                 :            :                 { "dn", PP_D, PP_UNKNOWN,                 0, 'd',  },
    1576                 :            :                 { "do", PP_D, PP_UNKNOWN,                 0, 'd',  },
    1577                 :            :                 { "dv", PP_D, PP_UNKNOWN,                 0, 'd',  },
    1578                 :            :                 { "d",  PP_D, PP_UNKNOWN,                 0, 'd',  },
    1579                 :            :                 { "e",  PP_D, PP_PKG_DESCRIPTION,         1, '\0', },
    1580                 :            :                 { "k",  PP_D, PP_PKG_LOCK_STATUS,         1, '\0', },
    1581                 :            :                 { "l",  PP_D, PP_PKG_LICENSE_LOGIC,       1, '\0', },
    1582                 :            :                 { "m",  PP_D, PP_PKG_MAINTAINER,          1, '\0', },
    1583                 :            :                 { "n",  PP_D, PP_PKG_NAME,                1, '\0', },
    1584                 :            :                 { "o",  PP_D, PP_PKG_ORIGIN,              1, '\0', },
    1585                 :            :                 { "p",  PP_D, PP_PKG_PREFIX,              1, '\0', },
    1586                 :            :                 { "q",  PP_D, PP_PKG_ARCHITECTURE,        1, '\0', },
    1587                 :            :                 { "rk", PP_D, PP_UNKNOWN,                 0, 'r',  },
    1588                 :            :                 { "rn", PP_D, PP_UNKNOWN,                 0, 'r',  },
    1589                 :            :                 { "ro", PP_D, PP_UNKNOWN,                 0, 'r',  },
    1590                 :            :                 { "rv", PP_D, PP_UNKNOWN,                 0, 'r',  },
    1591                 :            :                 { "r",  PP_D, PP_UNKNOWN,                 0, 'r',  },
    1592                 :            :                 { "s",  PP_D, PP_PKG_FLATSIZE,            1, '\0', },
    1593                 :            :                 { "t",  PP_D, PP_PKG_INSTALL_TIMESTAMP,   1, '\0', },
    1594                 :            :                 { "u",  PP_D, PP_PKG_CHECKSUM,            1, '\0', },
    1595                 :            :                 { "v",  PP_D, PP_PKG_VERSION,             1, '\0', },
    1596                 :            :                 { "w",  PP_D, PP_PKG_HOME_PAGE,           1, '\0', },
    1597                 :            :                 { "x",  PP_D, PP_PKG_PKGSIZE,             1, '\0', },
    1598                 :            :                 { "z",  PP_D, PP_PKG_SHORT_CHECKSUM,      1, '\0', },
    1599                 :            :                 { "%",  PP_D, PP_LITERAL_PERCENT,         1, '\0', },
    1600                 :            :                 { "Z",  PP_D, PP_UNKNOWN,                 0, 'Z',  },
    1601                 :            : 
    1602                 :            :                 { "Bn", PP_F, PP_UNKNOWN,                 0, 'B',  },
    1603                 :            :                 { "B",  PP_F, PP_UNKNOWN,                 0, 'B',  },
    1604                 :            :                 { "Cn", PP_F, PP_UNKNOWN,                 0, 'C',  },
    1605                 :            :                 { "C",  PP_F, PP_UNKNOWN,                 0, 'C',  },
    1606                 :            :                 { "Dg", PP_F, PP_UNKNOWN,                 0, 'D',  },
    1607                 :            :                 { "Dk", PP_F, PP_UNKNOWN,                 0, 'D',  },
    1608                 :            :                 { "Dn", PP_F, PP_UNKNOWN,                 0, 'D',  },
    1609                 :            :                 { "Dp", PP_F, PP_UNKNOWN,                 0, 'D',  },
    1610                 :            :                 { "Dt", PP_F, PP_UNKNOWN,                 0, 'D',  },
    1611                 :            :                 { "Du", PP_F, PP_UNKNOWN,                 0, 'D',  },
    1612                 :            :                 { "D",  PP_F, PP_UNKNOWN,                 0, 'D',  },
    1613                 :            :                 { "Fg", PP_F, PP_PKG_FILE_GROUP,          2, '\0', },
    1614                 :            :                 { "Fn", PP_F, PP_PKG_FILE_PATH,           2, '\0', },
    1615                 :            :                 { "Fp", PP_F, PP_PKG_FILE_PERMS,          2, '\0', },
    1616                 :            :                 { "Fs", PP_F, PP_PKG_FILE_SHA256,         2, '\0', },
    1617                 :            :                 { "Fu", PP_F, PP_PKG_FILE_USER,           2, '\0', },
    1618                 :            :                 { "F",  PP_F, PP_UNKNOWN,                 0, 'F',  },
    1619                 :            :                 { "Gn", PP_F, PP_UNKNOWN,                 0, 'G',  },
    1620                 :            :                 { "G",  PP_F, PP_UNKNOWN,                 0, 'G',  },
    1621                 :            :                 { "I",  PP_F, PP_ROW_COUNTER,             1, '\0', },
    1622                 :            :                 { "Ln", PP_F, PP_UNKNOWN,                 0, 'L',  },
    1623                 :            :                 { "L",  PP_F, PP_UNKNOWN,                 0, 'L',  },
    1624                 :            :                 { "M",  PP_F, PP_PKG_MESSAGE,             1, '\0', },
    1625                 :            :                 { "N",  PP_F, PP_PKG_REPO_IDENT,          1, '\0', },
    1626                 :            :                 { "On", PP_F, PP_UNKNOWN,                 0, 'O',  },
    1627                 :            :                 { "Ov", PP_F, PP_UNKNOWN,                 0, 'O',  },
    1628                 :            :                 { "Od", PP_F, PP_UNKNOWN,                 0, 'O',  },
    1629                 :            :                 { "OD", PP_F, PP_UNKNOWN,                 0, 'O',  },
    1630                 :            :                 { "O",  PP_F, PP_UNKNOWN,                 0, 'O',  },
    1631                 :            :                 { "R",  PP_F, PP_PKG_REPO_PATH,           1, '\0', },
    1632                 :            :                 { "S",  PP_F, PP_UNKNOWN,                 0, 'S',  },
    1633                 :            :                 { "Un", PP_F, PP_UNKNOWN,                 0, 'U',  },
    1634                 :            :                 { "U",  PP_F, PP_UNKNOWN,                 0, 'U',  },
    1635                 :            :                 { "V",  PP_F, PP_PKG_OLD_VERSION,         1, '\0', },
    1636                 :            :                 { "a",  PP_F, PP_PKG_AUTOREMOVE,          1, '\0', },
    1637                 :            :                 { "bn", PP_F, PP_UNKNOWN,                 0, 'b',  },
    1638                 :            :                 { "b",  PP_F, PP_UNKNOWN,                 0, 'b',  },
    1639                 :            :                 { "c",  PP_F, PP_PKG_COMMENT,             1, '\0', },
    1640                 :            :                 { "dk", PP_F, PP_UNKNOWN,                 0, 'd',  },
    1641                 :            :                 { "dn", PP_F, PP_UNKNOWN,                 0, 'd',  },
    1642                 :            :                 { "do", PP_F, PP_UNKNOWN,                 0, 'd',  },
    1643                 :            :                 { "dv", PP_F, PP_UNKNOWN,                 0, 'd',  },
    1644                 :            :                 { "d",  PP_F, PP_UNKNOWN,                 0, 'd',  },
    1645                 :            :                 { "e",  PP_F, PP_PKG_DESCRIPTION,         1, '\0', },
    1646                 :            :                 { "k",  PP_F, PP_PKG_LOCK_STATUS,         1, '\0', },
    1647                 :            :                 { "l",  PP_F, PP_PKG_LICENSE_LOGIC,       1, '\0', },
    1648                 :            :                 { "m",  PP_F, PP_PKG_MAINTAINER,          1, '\0', },
    1649                 :            :                 { "n",  PP_F, PP_PKG_NAME,                1, '\0', },
    1650                 :            :                 { "o",  PP_F, PP_PKG_ORIGIN,              1, '\0', },
    1651                 :            :                 { "p",  PP_F, PP_PKG_PREFIX,              1, '\0', },
    1652                 :            :                 { "q",  PP_F, PP_PKG_ARCHITECTURE,        1, '\0', },
    1653                 :            :                 { "rk", PP_F, PP_UNKNOWN,                 0, 'r',  },
    1654                 :            :                 { "rn", PP_F, PP_UNKNOWN,                 0, 'r',  },
    1655                 :            :                 { "ro", PP_F, PP_UNKNOWN,                 0, 'r',  },
    1656                 :            :                 { "rv", PP_F, PP_UNKNOWN,                 0, 'r',  },
    1657                 :            :                 { "r",  PP_F, PP_UNKNOWN,                 0, 'r',  },
    1658                 :            :                 { "s",  PP_F, PP_PKG_FLATSIZE,            1, '\0', },
    1659                 :            :                 { "t",  PP_F, PP_PKG_INSTALL_TIMESTAMP,   1, '\0', },
    1660                 :            :                 { "u",  PP_F, PP_PKG_CHECKSUM,            1, '\0', },
    1661                 :            :                 { "v",  PP_F, PP_PKG_VERSION,             1, '\0', },
    1662                 :            :                 { "w",  PP_F, PP_PKG_HOME_PAGE,           1, '\0', },
    1663                 :            :                 { "x",  PP_F, PP_PKG_PKGSIZE,             1, '\0', },
    1664                 :            :                 { "z",  PP_F, PP_PKG_SHORT_CHECKSUM,      1, '\0', },
    1665                 :            :                 { "%",  PP_F, PP_LITERAL_PERCENT,         1, '\0', },
    1666                 :            :                 { "Z",  PP_F, PP_UNKNOWN,                 0, 'Z',  },
    1667                 :            : 
    1668                 :            :                 { "Bn", PP_G, PP_UNKNOWN,                 0, 'B',  },
    1669                 :            :                 { "B",  PP_G, PP_UNKNOWN,                 0, 'B',  },
    1670                 :            :                 { "Cn", PP_G, PP_UNKNOWN,                 0, 'C',  },
    1671                 :            :                 { "C",  PP_G, PP_UNKNOWN,                 0, 'C',  },
    1672                 :            :                 { "Dg", PP_G, PP_UNKNOWN,                 0, 'D',  },
    1673                 :            :                 { "Dk", PP_G, PP_UNKNOWN,                 0, 'D',  },
    1674                 :            :                 { "Dn", PP_G, PP_UNKNOWN,                 0, 'D',  },
    1675                 :            :                 { "Dp", PP_G, PP_UNKNOWN,                 0, 'D',  },
    1676                 :            :                 { "Dt", PP_G, PP_UNKNOWN,                 0, 'D',  },
    1677                 :            :                 { "Du", PP_G, PP_UNKNOWN,                 0, 'D',  },
    1678                 :            :                 { "D",  PP_G, PP_UNKNOWN,                 0, 'D',  },
    1679                 :            :                 { "Fg", PP_G, PP_UNKNOWN,                 0, 'F',  },
    1680                 :            :                 { "Fk", PP_G, PP_UNKNOWN,                 0, 'F',  },
    1681                 :            :                 { "Fn", PP_G, PP_UNKNOWN,                 0, 'F',  },
    1682                 :            :                 { "Fp", PP_G, PP_UNKNOWN,                 0, 'F',  },
    1683                 :            :                 { "Fs", PP_G, PP_UNKNOWN,                 0, 'F',  },
    1684                 :            :                 { "Fu", PP_G, PP_UNKNOWN,                 0, 'F',  },
    1685                 :            :                 { "F",  PP_G, PP_UNKNOWN,                 0, 'F',  },
    1686                 :            :                 { "Gn", PP_G, PP_PKG_GROUP_NAME,          2, '\0', },
    1687                 :            :                 { "G",  PP_G, PP_UNKNOWN,                 0, 'G',  },
    1688                 :            :                 { "I",  PP_G, PP_ROW_COUNTER,             1, '\0', },
    1689                 :            :                 { "Ln", PP_G, PP_UNKNOWN,                 0, 'L',  },
    1690                 :            :                 { "L",  PP_G, PP_UNKNOWN,                 0, 'L',  },
    1691                 :            :                 { "M",  PP_G, PP_PKG_MESSAGE,             1, '\0', },
    1692                 :            :                 { "N",  PP_G, PP_PKG_REPO_IDENT,          1, '\0', },
    1693                 :            :                 { "On", PP_G, PP_UNKNOWN,                 0, 'O',  },
    1694                 :            :                 { "Ov", PP_G, PP_UNKNOWN,                 0, 'O',  },
    1695                 :            :                 { "Od", PP_G, PP_UNKNOWN,                 0, 'O',  },
    1696                 :            :                 { "OD", PP_G, PP_UNKNOWN,                 0, 'O',  },
    1697                 :            :                 { "O",  PP_G, PP_UNKNOWN,                 0, 'O',  },
    1698                 :            :                 { "R",  PP_G, PP_PKG_REPO_PATH,           1, '\0', },
    1699                 :            :                 { "S",  PP_G, PP_UNKNOWN,                 0, 'S',  },
    1700                 :            :                 { "Un", PP_G, PP_UNKNOWN,                 0, 'U',  },
    1701                 :            :                 { "U",  PP_G, PP_UNKNOWN,                 0, 'U',  },
    1702                 :            :                 { "V",  PP_G, PP_PKG_OLD_VERSION,         1, '\0', },
    1703                 :            :                 { "a",  PP_G, PP_PKG_AUTOREMOVE,          1, '\0', },
    1704                 :            :                 { "bn", PP_G, PP_UNKNOWN,                 0, 'b',  },
    1705                 :            :                 { "b",  PP_G, PP_UNKNOWN,                 0, 'b',  },
    1706                 :            :                 { "c",  PP_G, PP_PKG_COMMENT,             1, '\0', },
    1707                 :            :                 { "dk", PP_G, PP_UNKNOWN,                 0, 'd',  },
    1708                 :            :                 { "dn", PP_G, PP_UNKNOWN,                 0, 'd',  },
    1709                 :            :                 { "do", PP_G, PP_UNKNOWN,                 0, 'd',  },
    1710                 :            :                 { "dv", PP_G, PP_UNKNOWN,                 0, 'd',  },
    1711                 :            :                 { "d",  PP_G, PP_UNKNOWN,                 0, 'd',  },
    1712                 :            :                 { "e",  PP_G, PP_PKG_DESCRIPTION,         1, '\0', },
    1713                 :            :                 { "k",  PP_G, PP_PKG_LOCK_STATUS,         1, '\0', },
    1714                 :            :                 { "l",  PP_G, PP_PKG_LICENSE_LOGIC,       1, '\0', },
    1715                 :            :                 { "m",  PP_G, PP_PKG_MAINTAINER,          1, '\0', },
    1716                 :            :                 { "n",  PP_G, PP_PKG_NAME,                1, '\0', },
    1717                 :            :                 { "o",  PP_G, PP_PKG_ORIGIN,              1, '\0', },
    1718                 :            :                 { "p",  PP_G, PP_PKG_PREFIX,              1, '\0', },
    1719                 :            :                 { "q",  PP_G, PP_PKG_ARCHITECTURE,        1, '\0', },
    1720                 :            :                 { "rk", PP_G, PP_UNKNOWN,                 0, 'r',  },
    1721                 :            :                 { "rn", PP_G, PP_UNKNOWN,                 0, 'r',  },
    1722                 :            :                 { "ro", PP_G, PP_UNKNOWN,                 0, 'r',  },
    1723                 :            :                 { "rv", PP_G, PP_UNKNOWN,                 0, 'r',  },
    1724                 :            :                 { "r",  PP_G, PP_UNKNOWN,                 0, 'r',  },
    1725                 :            :                 { "s",  PP_G, PP_PKG_FLATSIZE,            1, '\0', },
    1726                 :            :                 { "t",  PP_G, PP_PKG_INSTALL_TIMESTAMP,   1, '\0', },
    1727                 :            :                 { "u",  PP_G, PP_PKG_CHECKSUM,            1, '\0', },
    1728                 :            :                 { "v",  PP_G, PP_PKG_VERSION,             1, '\0', },
    1729                 :            :                 { "w",  PP_G, PP_PKG_HOME_PAGE,           1, '\0', },
    1730                 :            :                 { "x",  PP_G, PP_PKG_PKGSIZE,             1, '\0', },
    1731                 :            :                 { "z",  PP_G, PP_PKG_SHORT_CHECKSUM,      1, '\0', },
    1732                 :            :                 { "%",  PP_G, PP_LITERAL_PERCENT,         1, '\0', },
    1733                 :            :                 { "Z",  PP_G, PP_UNKNOWN,                 0, 'Z',  },
    1734                 :            : 
    1735                 :            :                 { "Bn", PP_L, PP_UNKNOWN,                 0, 'B',  },
    1736                 :            :                 { "B",  PP_L, PP_UNKNOWN,                 0, 'B',  },
    1737                 :            :                 { "Cn", PP_L, PP_UNKNOWN,                 0, 'C',  },
    1738                 :            :                 { "C",  PP_L, PP_UNKNOWN,                 0, 'C',  },
    1739                 :            :                 { "Dg", PP_L, PP_UNKNOWN,                 0, 'D',  },
    1740                 :            :                 { "Dk", PP_L, PP_UNKNOWN,                 0, 'D',  },
    1741                 :            :                 { "Dn", PP_L, PP_UNKNOWN,                 0, 'D',  },
    1742                 :            :                 { "Dp", PP_L, PP_UNKNOWN,                 0, 'D',  },
    1743                 :            :                 { "Dt", PP_L, PP_UNKNOWN,                 0, 'D',  },
    1744                 :            :                 { "Du", PP_L, PP_UNKNOWN,                 0, 'D',  },
    1745                 :            :                 { "D",  PP_L, PP_UNKNOWN,                 0, 'D',  },
    1746                 :            :                 { "Fg", PP_L, PP_UNKNOWN,                 0, 'F',  },
    1747                 :            :                 { "Fk", PP_L, PP_UNKNOWN,                 0, 'F',  },
    1748                 :            :                 { "Fn", PP_L, PP_UNKNOWN,                 0, 'F',  },
    1749                 :            :                 { "Fp", PP_L, PP_UNKNOWN,                 0, 'F',  },
    1750                 :            :                 { "Fs", PP_L, PP_UNKNOWN,                 0, 'F',  },
    1751                 :            :                 { "Fu", PP_L, PP_UNKNOWN,                 0, 'F',  },
    1752                 :            :                 { "F",  PP_L, PP_UNKNOWN,                 0, 'F',  },
    1753                 :            :                 { "Gn", PP_L, PP_UNKNOWN,                 0, 'G',  },
    1754                 :            :                 { "G",  PP_L, PP_UNKNOWN,                 0, 'G',  },
    1755                 :            :                 { "I",  PP_L, PP_ROW_COUNTER,             1, '\0', },
    1756                 :            :                 { "Ln", PP_L, PP_PKG_LICENSE_NAME,        2, '\0', },
    1757                 :            :                 { "L",  PP_L, PP_UNKNOWN,                 0, 'L',  },
    1758                 :            :                 { "M",  PP_L, PP_PKG_MESSAGE,             1, '\0', },
    1759                 :            :                 { "N",  PP_L, PP_PKG_REPO_IDENT,          1, '\0', },
    1760                 :            :                 { "On", PP_L, PP_UNKNOWN,                 0, 'O',  },
    1761                 :            :                 { "Ov", PP_L, PP_UNKNOWN,                 0, 'O',  },
    1762                 :            :                 { "Od", PP_L, PP_UNKNOWN,                 0, 'O',  },
    1763                 :            :                 { "OD", PP_L, PP_UNKNOWN,                 0, 'O',  },
    1764                 :            :                 { "O",  PP_L, PP_UNKNOWN,                 0, 'O',  },
    1765                 :            :                 { "R",  PP_L, PP_PKG_REPO_PATH,           1, '\0', },
    1766                 :            :                 { "S",  PP_L, PP_UNKNOWN,                 0, 'S',  },
    1767                 :            :                 { "Un", PP_L, PP_UNKNOWN,                 0, 'U',  },
    1768                 :            :                 { "U",  PP_L, PP_UNKNOWN,                 0, 'U',  },
    1769                 :            :                 { "V",  PP_L, PP_PKG_OLD_VERSION,         1, '\0', },
    1770                 :            :                 { "a",  PP_L, PP_PKG_AUTOREMOVE,          1, '\0', },
    1771                 :            :                 { "bn", PP_L, PP_UNKNOWN,                 0, 'b',  },
    1772                 :            :                 { "b",  PP_L, PP_UNKNOWN,                 0, 'b',  },
    1773                 :            :                 { "c",  PP_L, PP_PKG_COMMENT,             1, '\0', },
    1774                 :            :                 { "dk", PP_L, PP_UNKNOWN,                 0, 'd',  },
    1775                 :            :                 { "dn", PP_L, PP_UNKNOWN,                 0, 'd',  },
    1776                 :            :                 { "do", PP_L, PP_UNKNOWN,                 0, 'd',  },
    1777                 :            :                 { "dv", PP_L, PP_UNKNOWN,                 0, 'd',  },
    1778                 :            :                 { "d",  PP_L, PP_UNKNOWN,                 0, 'd',  },
    1779                 :            :                 { "e",  PP_L, PP_PKG_DESCRIPTION,         1, '\0', },
    1780                 :            :                 { "k",  PP_L, PP_PKG_LOCK_STATUS,         1, '\0', },
    1781                 :            :                 { "l",  PP_L, PP_PKG_LICENSE_LOGIC,       1, '\0', },
    1782                 :            :                 { "m",  PP_L, PP_PKG_MAINTAINER,          1, '\0', },
    1783                 :            :                 { "n",  PP_L, PP_PKG_NAME,                1, '\0', },
    1784                 :            :                 { "o",  PP_L, PP_PKG_ORIGIN,              1, '\0', },
    1785                 :            :                 { "p",  PP_L, PP_PKG_PREFIX,              1, '\0', },
    1786                 :            :                 { "q",  PP_L, PP_PKG_ARCHITECTURE,        1, '\0', },
    1787                 :            :                 { "rk", PP_L, PP_UNKNOWN,                 0, 'r',  },
    1788                 :            :                 { "rn", PP_L, PP_UNKNOWN,                 0, 'r',  },
    1789                 :            :                 { "ro", PP_L, PP_UNKNOWN,                 0, 'r',  },
    1790                 :            :                 { "rv", PP_L, PP_UNKNOWN,                 0, 'r',  },
    1791                 :            :                 { "r",  PP_L, PP_UNKNOWN,                 0, 'r',  },
    1792                 :            :                 { "s",  PP_L, PP_PKG_FLATSIZE,            1, '\0', },
    1793                 :            :                 { "t",  PP_L, PP_PKG_INSTALL_TIMESTAMP,   1, '\0', },
    1794                 :            :                 { "u",  PP_L, PP_PKG_CHECKSUM,            1, '\0', },
    1795                 :            :                 { "v",  PP_L, PP_PKG_VERSION,             1, '\0', },
    1796                 :            :                 { "w",  PP_L, PP_PKG_HOME_PAGE,           1, '\0', },
    1797                 :            :                 { "x",  PP_L, PP_PKG_PKGSIZE,             1, '\0', },
    1798                 :            :                 { "z",  PP_L, PP_PKG_SHORT_CHECKSUM,      1, '\0', },
    1799                 :            :                 { "%",  PP_L, PP_LITERAL_PERCENT,         1, '\0', },
    1800                 :            :                 { "Z",  PP_L, PP_UNKNOWN,                 0, 'Z',  },
    1801                 :            : 
    1802                 :            :                 { "Bn", PP_O, PP_UNKNOWN,                 0, 'B',  },
    1803                 :            :                 { "B",  PP_O, PP_UNKNOWN,                 0, 'B',  },
    1804                 :            :                 { "Cn", PP_O, PP_UNKNOWN,                 0, 'C',  },
    1805                 :            :                 { "C",  PP_O, PP_UNKNOWN,                 0, 'C',  },
    1806                 :            :                 { "Dg", PP_O, PP_UNKNOWN,                 0, 'D',  },
    1807                 :            :                 { "Dk", PP_O, PP_UNKNOWN,                 0, 'D',  },
    1808                 :            :                 { "Dn", PP_O, PP_UNKNOWN,                 0, 'D',  },
    1809                 :            :                 { "Dp", PP_O, PP_UNKNOWN,                 0, 'D',  },
    1810                 :            :                 { "Dt", PP_O, PP_UNKNOWN,                 0, 'D',  },
    1811                 :            :                 { "Du", PP_O, PP_UNKNOWN,                 0, 'D',  },
    1812                 :            :                 { "D",  PP_O, PP_UNKNOWN,                 0, 'D',  },
    1813                 :            :                 { "Fg", PP_O, PP_UNKNOWN,                 0, 'F',  },
    1814                 :            :                 { "Fk", PP_O, PP_UNKNOWN,                 0, 'F',  },
    1815                 :            :                 { "Fn", PP_O, PP_UNKNOWN,                 0, 'F',  },
    1816                 :            :                 { "Fp", PP_O, PP_UNKNOWN,                 0, 'F',  },
    1817                 :            :                 { "Fs", PP_O, PP_UNKNOWN,                 0, 'F',  },
    1818                 :            :                 { "Fu", PP_O, PP_UNKNOWN,                 0, 'F',  },
    1819                 :            :                 { "F",  PP_O, PP_UNKNOWN,                 0, 'F',  },
    1820                 :            :                 { "Gn", PP_O, PP_UNKNOWN,                 0, 'G',  },
    1821                 :            :                 { "G",  PP_O, PP_UNKNOWN,                 0, 'G',  },
    1822                 :            :                 { "I",  PP_O, PP_ROW_COUNTER,             1, '\0', },
    1823                 :            :                 { "Ln", PP_O, PP_UNKNOWN,                 0, 'L',  },
    1824                 :            :                 { "L",  PP_O, PP_UNKNOWN,                 0, 'L',  },
    1825                 :            :                 { "M",  PP_O, PP_PKG_MESSAGE,             1, '\0', },
    1826                 :            :                 { "N",  PP_O, PP_PKG_REPO_IDENT,          1, '\0', },
    1827                 :            :                 { "On", PP_O, PP_PKG_OPTION_NAME,         2, '\0', },
    1828                 :            :                 { "Ov", PP_O, PP_PKG_OPTION_VALUE,        2, '\0', },
    1829                 :            :                 { "Od", PP_O, PP_PKG_OPTION_DEFAULT,      2, '\0', },
    1830                 :            :                 { "OD", PP_O, PP_PKG_OPTION_DESCRIPTION,  2, '\0', },
    1831                 :            :                 { "O",  PP_O, PP_UNKNOWN,                 0, 'O',  },
    1832                 :            :                 { "R",  PP_O, PP_PKG_REPO_PATH,           1, '\0', },
    1833                 :            :                 { "S",  PP_O, PP_UNKNOWN,                 0, 'S',  },
    1834                 :            :                 { "Un", PP_O, PP_UNKNOWN,                 0, 'U',  },
    1835                 :            :                 { "U",  PP_O, PP_UNKNOWN,                 0, 'U',  },
    1836                 :            :                 { "V",  PP_O, PP_PKG_OLD_VERSION,         1, '\0', },
    1837                 :            :                 { "a",  PP_O, PP_PKG_AUTOREMOVE,          1, '\0', },
    1838                 :            :                 { "bn", PP_O, PP_UNKNOWN,                 0, 'b',  },
    1839                 :            :                 { "b",  PP_O, PP_UNKNOWN,                 0, 'b',  },
    1840                 :            :                 { "c",  PP_O, PP_PKG_COMMENT,             1, '\0', },
    1841                 :            :                 { "dk", PP_O, PP_UNKNOWN,                 0, 'd',  },
    1842                 :            :                 { "dn", PP_O, PP_UNKNOWN,                 0, 'd',  },
    1843                 :            :                 { "do", PP_O, PP_UNKNOWN,                 0, 'd',  },
    1844                 :            :                 { "dv", PP_O, PP_UNKNOWN,                 0, 'd',  },
    1845                 :            :                 { "d",  PP_O, PP_UNKNOWN,                 0, 'd',  },
    1846                 :            :                 { "e",  PP_O, PP_PKG_DESCRIPTION,         1, '\0', },
    1847                 :            :                 { "k",  PP_O, PP_PKG_LOCK_STATUS,         1, '\0', },
    1848                 :            :                 { "l",  PP_O, PP_PKG_LICENSE_LOGIC,       1, '\0', },
    1849                 :            :                 { "m",  PP_O, PP_PKG_MAINTAINER,          1, '\0', },
    1850                 :            :                 { "n",  PP_O, PP_PKG_NAME,                1, '\0', },
    1851                 :            :                 { "o",  PP_O, PP_PKG_ORIGIN,              1, '\0', },
    1852                 :            :                 { "p",  PP_O, PP_PKG_PREFIX,              1, '\0', },
    1853                 :            :                 { "q",  PP_O, PP_PKG_ARCHITECTURE,        1, '\0', },
    1854                 :            :                 { "rk", PP_O, PP_UNKNOWN,                 0, 'r',  },
    1855                 :            :                 { "rn", PP_O, PP_UNKNOWN,                 0, 'r',  },
    1856                 :            :                 { "ro", PP_O, PP_UNKNOWN,                 0, 'r',  },
    1857                 :            :                 { "rv", PP_O, PP_UNKNOWN,                 0, 'r',  },
    1858                 :            :                 { "r",  PP_O, PP_UNKNOWN,                 0, 'r',  },
    1859                 :            :                 { "s",  PP_O, PP_PKG_FLATSIZE,            1, '\0', },
    1860                 :            :                 { "t",  PP_O, PP_PKG_INSTALL_TIMESTAMP,   1, '\0', },
    1861                 :            :                 { "u",  PP_O, PP_PKG_CHECKSUM,            1, '\0', },
    1862                 :            :                 { "v",  PP_O, PP_PKG_VERSION,             1, '\0', },
    1863                 :            :                 { "w",  PP_O, PP_PKG_HOME_PAGE,           1, '\0', },
    1864                 :            :                 { "x",  PP_O, PP_PKG_PKGSIZE,             1, '\0', },
    1865                 :            :                 { "z",  PP_O, PP_PKG_SHORT_CHECKSUM,      1, '\0', },
    1866                 :            :                 { "%",  PP_O, PP_LITERAL_PERCENT,         1, '\0', },
    1867                 :            :                 { "Z",  PP_O, PP_UNKNOWN,                 0, 'Z',  },
    1868                 :            : 
    1869                 :            :                 { "Bn", PP_U, PP_UNKNOWN,                 0, 'B',  },
    1870                 :            :                 { "B",  PP_U, PP_UNKNOWN,                 0, 'B',  },
    1871                 :            :                 { "Cn", PP_U, PP_UNKNOWN,                 0, 'C',  },
    1872                 :            :                 { "C",  PP_U, PP_UNKNOWN,                 0, 'C',  },
    1873                 :            :                 { "Dg", PP_U, PP_UNKNOWN,                 0, 'D',  },
    1874                 :            :                 { "Dk", PP_U, PP_UNKNOWN,                 0, 'D',  },
    1875                 :            :                 { "Dn", PP_U, PP_UNKNOWN,                 0, 'D',  },
    1876                 :            :                 { "Dp", PP_U, PP_UNKNOWN,                 0, 'D',  },
    1877                 :            :                 { "Dt", PP_U, PP_UNKNOWN,                 0, 'D',  },
    1878                 :            :                 { "Du", PP_U, PP_UNKNOWN,                 0, 'D',  },
    1879                 :            :                 { "D",  PP_U, PP_UNKNOWN,                 0, 'D',  },
    1880                 :            :                 { "Fg", PP_U, PP_UNKNOWN,                 0, 'F',  },
    1881                 :            :                 { "Fk", PP_U, PP_UNKNOWN,                 0, 'F',  },
    1882                 :            :                 { "Fn", PP_U, PP_UNKNOWN,                 0, 'F',  },
    1883                 :            :                 { "Fp", PP_U, PP_UNKNOWN,                 0, 'F',  },
    1884                 :            :                 { "Fs", PP_U, PP_UNKNOWN,                 0, 'F',  },
    1885                 :            :                 { "Fu", PP_U, PP_UNKNOWN,                 0, 'F',  },
    1886                 :            :                 { "F",  PP_U, PP_UNKNOWN,                 0, 'F',  },
    1887                 :            :                 { "Gn", PP_U, PP_UNKNOWN,                 0, 'G',  },
    1888                 :            :                 { "G",  PP_U, PP_UNKNOWN,                 0, 'G',  },
    1889                 :            :                 { "I",  PP_U, PP_ROW_COUNTER,             1, '\0', },
    1890                 :            :                 { "Ln", PP_U, PP_UNKNOWN,                 0, 'L',  },
    1891                 :            :                 { "L",  PP_U, PP_UNKNOWN,                 0, 'L',  },
    1892                 :            :                 { "M",  PP_U, PP_PKG_MESSAGE,             1, '\0', },
    1893                 :            :                 { "N",  PP_U, PP_PKG_REPO_IDENT,          1, '\0', },
    1894                 :            :                 { "On", PP_U, PP_UNKNOWN,                 0, 'O',  },
    1895                 :            :                 { "Ov", PP_U, PP_UNKNOWN,                 0, 'O',  },
    1896                 :            :                 { "Od", PP_U, PP_UNKNOWN,                 0, 'O',  },
    1897                 :            :                 { "OD", PP_U, PP_UNKNOWN,                 0, 'O',  },
    1898                 :            :                 { "O",  PP_U, PP_UNKNOWN,                 0, 'O',  },
    1899                 :            :                 { "R",  PP_U, PP_PKG_REPO_PATH,           1, '\0', },
    1900                 :            :                 { "S",  PP_U, PP_UNKNOWN,                 0, 'S',  },
    1901                 :            :                 { "Un", PP_U, PP_PKG_USER_NAME,           2, '\0', },
    1902                 :            :                 { "U",  PP_U, PP_UNKNOWN,                 0, 'U',  },
    1903                 :            :                 { "V",  PP_U, PP_PKG_OLD_VERSION,         1, '\0', },
    1904                 :            :                 { "a",  PP_U, PP_PKG_AUTOREMOVE,          1, '\0', },
    1905                 :            :                 { "bn", PP_U, PP_UNKNOWN,                 0, 'b',  },
    1906                 :            :                 { "b",  PP_U, PP_UNKNOWN,                 0, 'b',  },
    1907                 :            :                 { "c",  PP_U, PP_PKG_COMMENT,             1, '\0', },
    1908                 :            :                 { "dk", PP_U, PP_UNKNOWN,                 0, 'd',  },
    1909                 :            :                 { "dn", PP_U, PP_UNKNOWN,                 0, 'd',  },
    1910                 :            :                 { "do", PP_U, PP_UNKNOWN,                 0, 'd',  },
    1911                 :            :                 { "dv", PP_U, PP_UNKNOWN,                 0, 'd',  },
    1912                 :            :                 { "d",  PP_U, PP_UNKNOWN,                 0, 'd',  },
    1913                 :            :                 { "e",  PP_U, PP_PKG_DESCRIPTION,         1, '\0', },
    1914                 :            :                 { "k",  PP_U, PP_PKG_LOCK_STATUS,         1, '\0', },
    1915                 :            :                 { "l",  PP_U, PP_PKG_LICENSE_LOGIC,       1, '\0', },
    1916                 :            :                 { "m",  PP_U, PP_PKG_MAINTAINER,          1, '\0', },
    1917                 :            :                 { "n",  PP_U, PP_PKG_NAME,                1, '\0', },
    1918                 :            :                 { "o",  PP_U, PP_PKG_ORIGIN,              1, '\0', },
    1919                 :            :                 { "p",  PP_U, PP_PKG_PREFIX,              1, '\0', },
    1920                 :            :                 { "q",  PP_U, PP_PKG_ARCHITECTURE,        1, '\0', },
    1921                 :            :                 { "rk", PP_U, PP_UNKNOWN,                 0, 'r',  },
    1922                 :            :                 { "rn", PP_U, PP_UNKNOWN,                 0, 'r',  },
    1923                 :            :                 { "ro", PP_U, PP_UNKNOWN,                 0, 'r',  },
    1924                 :            :                 { "rv", PP_U, PP_UNKNOWN,                 0, 'r',  },
    1925                 :            :                 { "r",  PP_U, PP_UNKNOWN,                 0, 'r',  },
    1926                 :            :                 { "s",  PP_U, PP_PKG_FLATSIZE,            1, '\0', },
    1927                 :            :                 { "t",  PP_U, PP_PKG_INSTALL_TIMESTAMP,   1, '\0', },
    1928                 :            :                 { "u",  PP_U, PP_PKG_CHECKSUM,            1, '\0', },
    1929                 :            :                 { "v",  PP_U, PP_PKG_VERSION,             1, '\0', },
    1930                 :            :                 { "w",  PP_U, PP_PKG_HOME_PAGE,           1, '\0', },
    1931                 :            :                 { "x",  PP_U, PP_PKG_PKGSIZE,             1, '\0', },
    1932                 :            :                 { "z",  PP_U, PP_PKG_SHORT_CHECKSUM,      1, '\0', },
    1933                 :            :                 { "%",  PP_U, PP_LITERAL_PERCENT,         1, '\0', },
    1934                 :            :                 { "Z",  PP_U, PP_UNKNOWN,                 0, 'Z',  },
    1935                 :            : 
    1936                 :            :                 { "Bn", PP_b, PP_UNKNOWN,                 0, 'B', },
    1937                 :            :                 { "B",  PP_b, PP_UNKNOWN,                 0, 'B',  },
    1938                 :            :                 { "Cn", PP_b, PP_UNKNOWN,                 0, 'C',  },
    1939                 :            :                 { "C",  PP_b, PP_UNKNOWN,                 0, 'C',  },
    1940                 :            :                 { "Dg", PP_b, PP_UNKNOWN,                 0, 'D',  },
    1941                 :            :                 { "Dk", PP_b, PP_UNKNOWN,                 0, 'D',  },
    1942                 :            :                 { "Dn", PP_b, PP_UNKNOWN,                 0, 'D',  },
    1943                 :            :                 { "Dp", PP_b, PP_UNKNOWN,                 0, 'D',  },
    1944                 :            :                 { "Dt", PP_b, PP_UNKNOWN,                 0, 'D',  },
    1945                 :            :                 { "Du", PP_b, PP_UNKNOWN,                 0, 'D',  },
    1946                 :            :                 { "D",  PP_b, PP_UNKNOWN,                 0, 'D',  },
    1947                 :            :                 { "Fg", PP_b, PP_UNKNOWN,                 0, 'F',  },
    1948                 :            :                 { "Fk", PP_b, PP_UNKNOWN,                 0, 'F',  },
    1949                 :            :                 { "Fn", PP_b, PP_UNKNOWN,                 0, 'F',  },
    1950                 :            :                 { "Fp", PP_b, PP_UNKNOWN,                 0, 'F',  },
    1951                 :            :                 { "Fs", PP_b, PP_UNKNOWN,                 0, 'F',  },
    1952                 :            :                 { "Fu", PP_b, PP_UNKNOWN,                 0, 'F',  },
    1953                 :            :                 { "F",  PP_b, PP_UNKNOWN,                 0, 'F',  },
    1954                 :            :                 { "Gn", PP_b, PP_UNKNOWN,                 0, 'G',  },
    1955                 :            :                 { "G",  PP_b, PP_UNKNOWN,                 0, 'G',  },
    1956                 :            :                 { "I",  PP_b, PP_ROW_COUNTER,             1, '\0', },
    1957                 :            :                 { "Ln", PP_b, PP_UNKNOWN,                 0, 'L',  },
    1958                 :            :                 { "L",  PP_b, PP_UNKNOWN,                 0, 'L',  },
    1959                 :            :                 { "M",  PP_b, PP_PKG_MESSAGE,             1, '\0', },
    1960                 :            :                 { "N",  PP_b, PP_PKG_REPO_IDENT,          1, '\0', },
    1961                 :            :                 { "On", PP_b, PP_UNKNOWN,                 0, 'O',  },
    1962                 :            :                 { "Ov", PP_b, PP_UNKNOWN,                 0, 'O',  },
    1963                 :            :                 { "Od", PP_b, PP_UNKNOWN,                 0, 'O',  },
    1964                 :            :                 { "OD", PP_b, PP_UNKNOWN,                 0, 'O',  },
    1965                 :            :                 { "O",  PP_b, PP_UNKNOWN,                 0, 'O',  },
    1966                 :            :                 { "R",  PP_b, PP_PKG_REPO_PATH,           1, '\0', },
    1967                 :            :                 { "S",  PP_b, PP_UNKNOWN,                 0, 'S',  },
    1968                 :            :                 { "Un", PP_b, PP_UNKNOWN,                 0, 'U',  },
    1969                 :            :                 { "U",  PP_b, PP_UNKNOWN,                 0, 'U',  },
    1970                 :            :                 { "V",  PP_b, PP_PKG_OLD_VERSION,         1, '\0', },
    1971                 :            :                 { "a",  PP_b, PP_PKG_AUTOREMOVE,          1, '\0', },
    1972                 :            :                 { "bn", PP_b, PP_PKG_SHLIB_PROVIDED_NAME, 2, '\0', },
    1973                 :            :                 { "b",  PP_b, PP_UNKNOWN,                 0, 'b',  },
    1974                 :            :                 { "c",  PP_b, PP_PKG_COMMENT,             1, '\0', },
    1975                 :            :                 { "dk", PP_b, PP_UNKNOWN,                 0, 'd',  },
    1976                 :            :                 { "dn", PP_b, PP_UNKNOWN,                 0, 'd',  },
    1977                 :            :                 { "do", PP_b, PP_UNKNOWN,                 0, 'd',  },
    1978                 :            :                 { "dv", PP_b, PP_UNKNOWN,                 0, 'd',  },
    1979                 :            :                 { "d",  PP_b, PP_UNKNOWN,                 0, 'd',  },
    1980                 :            :                 { "e",  PP_b, PP_PKG_DESCRIPTION,         1, '\0', },
    1981                 :            :                 { "k",  PP_b, PP_PKG_LOCK_STATUS,         1, '\0', },
    1982                 :            :                 { "l",  PP_b, PP_PKG_LICENSE_LOGIC,       1, '\0', },
    1983                 :            :                 { "m",  PP_b, PP_PKG_MAINTAINER,          1, '\0', },
    1984                 :            :                 { "n",  PP_b, PP_PKG_NAME,                1, '\0', },
    1985                 :            :                 { "o",  PP_b, PP_PKG_ORIGIN,              1, '\0', },
    1986                 :            :                 { "p",  PP_b, PP_PKG_PREFIX,              1, '\0', },
    1987                 :            :                 { "q",  PP_b, PP_PKG_ARCHITECTURE,        1, '\0', },
    1988                 :            :                 { "rk", PP_b, PP_UNKNOWN,                 0, 'r',  },
    1989                 :            :                 { "rn", PP_b, PP_UNKNOWN,                 0, 'r',  },
    1990                 :            :                 { "ro", PP_b, PP_UNKNOWN,                 0, 'r',  },
    1991                 :            :                 { "rv", PP_b, PP_UNKNOWN,                 0, 'r',  },
    1992                 :            :                 { "r",  PP_b, PP_UNKNOWN,                 0, 'r',  },
    1993                 :            :                 { "s",  PP_b, PP_PKG_FLATSIZE,            1, '\0', },
    1994                 :            :                 { "t",  PP_b, PP_PKG_INSTALL_TIMESTAMP,   1, '\0', },
    1995                 :            :                 { "u",  PP_b, PP_PKG_CHECKSUM,            1, '\0', },
    1996                 :            :                 { "v",  PP_b, PP_PKG_VERSION,             1, '\0', },
    1997                 :            :                 { "w",  PP_b, PP_PKG_HOME_PAGE,           1, '\0', },
    1998                 :            :                 { "x",  PP_b, PP_PKG_PKGSIZE,             1, '\0', },
    1999                 :            :                 { "z",  PP_b, PP_PKG_SHORT_CHECKSUM,      1, '\0', },
    2000                 :            :                 { "%",  PP_b, PP_LITERAL_PERCENT,         1, '\0', },
    2001                 :            :                 { "Z",  PP_b, PP_UNKNOWN,                 0, 'Z',  },
    2002                 :            : 
    2003                 :            :                 { "Bn", PP_d, PP_UNKNOWN,                 0, 'B',  },
    2004                 :            :                 { "B",  PP_d, PP_UNKNOWN,                 0, 'B',  },
    2005                 :            :                 { "Cn", PP_d, PP_UNKNOWN,                 0, 'C',  },
    2006                 :            :                 { "C",  PP_d, PP_UNKNOWN,                 0, 'C',  },
    2007                 :            :                 { "Dg", PP_d, PP_UNKNOWN,                 0, 'D',  },
    2008                 :            :                 { "Dk", PP_d, PP_UNKNOWN,                 0, 'D',  },
    2009                 :            :                 { "Dn", PP_d, PP_UNKNOWN,                 0, 'D',  },
    2010                 :            :                 { "Dp", PP_d, PP_UNKNOWN,                 0, 'D',  },
    2011                 :            :                 { "Dt", PP_d, PP_UNKNOWN,                 0, 'D',  },
    2012                 :            :                 { "Du", PP_d, PP_UNKNOWN,                 0, 'D',  },
    2013                 :            :                 { "D",  PP_d, PP_UNKNOWN,                 0, 'D',  },
    2014                 :            :                 { "Fg", PP_d, PP_UNKNOWN,                 0, 'F',  },
    2015                 :            :                 { "Fk", PP_d, PP_UNKNOWN,                 0, 'F',  },
    2016                 :            :                 { "Fn", PP_d, PP_UNKNOWN,                 0, 'F',  },
    2017                 :            :                 { "Fp", PP_d, PP_UNKNOWN,                 0, 'F',  },
    2018                 :            :                 { "Fs", PP_d, PP_UNKNOWN,                 0, 'F',  },
    2019                 :            :                 { "Fu", PP_d, PP_UNKNOWN,                 0, 'F',  },
    2020                 :            :                 { "F",  PP_d, PP_UNKNOWN,                 0, 'F',  },
    2021                 :            :                 { "Gn", PP_d, PP_UNKNOWN,                 0, 'G',  },
    2022                 :            :                 { "G",  PP_d, PP_UNKNOWN,                 0, 'G',  },
    2023                 :            :                 { "I",  PP_d, PP_ROW_COUNTER,             1, '\0', },
    2024                 :            :                 { "Ln", PP_d, PP_UNKNOWN,                 0, 'L',  },
    2025                 :            :                 { "L",  PP_d, PP_UNKNOWN,                 0, 'L',  },
    2026                 :            :                 { "M",  PP_d, PP_PKG_MESSAGE,             1, '\0', },
    2027                 :            :                 { "N",  PP_d, PP_PKG_REPO_IDENT,          1, '\0', },
    2028                 :            :                 { "On", PP_d, PP_UNKNOWN,                 0, 'O',  },
    2029                 :            :                 { "Ov", PP_d, PP_UNKNOWN,                 0, 'O',  },
    2030                 :            :                 { "Od", PP_d, PP_UNKNOWN,                 0, 'O',  },
    2031                 :            :                 { "OD", PP_d, PP_UNKNOWN,                 0, 'O',  },
    2032                 :            :                 { "O",  PP_d, PP_UNKNOWN,                 0, 'O',  },
    2033                 :            :                 { "R",  PP_d, PP_PKG_REPO_PATH,           1, '\0', },
    2034                 :            :                 { "S",  PP_d, PP_UNKNOWN,                 0, 'S',  },
    2035                 :            :                 { "Un", PP_d, PP_UNKNOWN,                 0, 'U',  },
    2036                 :            :                 { "U",  PP_d, PP_UNKNOWN,                 0, 'U',  },
    2037                 :            :                 { "V",  PP_d, PP_PKG_OLD_VERSION,         1, '\0', },
    2038                 :            :                 { "a",  PP_d, PP_PKG_AUTOREMOVE,          1, '\0', },
    2039                 :            :                 { "bn", PP_d, PP_UNKNOWN,                 0, 'b',  },
    2040                 :            :                 { "b",  PP_d, PP_UNKNOWN,                 0, 'b',  },
    2041                 :            :                 { "c",  PP_d, PP_PKG_COMMENT,             1, '\0', },
    2042                 :            :                 { "dk", PP_d, PP_PKG_DEPENDENCY_LOCK,     2, '\0', },
    2043                 :            :                 { "dn", PP_d, PP_PKG_DEPENDENCY_NAME,     2, '\0', },
    2044                 :            :                 { "do", PP_d, PP_PKG_DEPENDENCY_ORIGIN,   2, '\0', },
    2045                 :            :                 { "dv", PP_d, PP_PKG_DEPENDENCY_VERSION,  2, '\0', },
    2046                 :            :                 { "d",  PP_d, PP_UNKNOWN,                 0, 'd',  },
    2047                 :            :                 { "e",  PP_d, PP_PKG_DESCRIPTION,         1, '\0', },
    2048                 :            :                 { "k",  PP_d, PP_PKG_LOCK_STATUS,         1, '\0', },
    2049                 :            :                 { "l",  PP_d, PP_PKG_LICENSE_LOGIC,       1, '\0', },
    2050                 :            :                 { "m",  PP_d, PP_PKG_MAINTAINER,          1, '\0', },
    2051                 :            :                 { "n",  PP_d, PP_PKG_NAME,                1, '\0', },
    2052                 :            :                 { "o",  PP_d, PP_PKG_ORIGIN,              1, '\0', },
    2053                 :            :                 { "p",  PP_d, PP_PKG_PREFIX,              1, '\0', },
    2054                 :            :                 { "q",  PP_d, PP_PKG_ARCHITECTURE,        1, '\0', },
    2055                 :            :                 { "rk", PP_d, PP_UNKNOWN,                 0, 'r',  },
    2056                 :            :                 { "rn", PP_d, PP_UNKNOWN,                 0, 'r',  },
    2057                 :            :                 { "ro", PP_d, PP_UNKNOWN,                 0, 'r',  },
    2058                 :            :                 { "rv", PP_d, PP_UNKNOWN,                 0, 'r',  },
    2059                 :            :                 { "r",  PP_d, PP_UNKNOWN,                 0, 'r',  },
    2060                 :            :                 { "s",  PP_d, PP_PKG_FLATSIZE,            1, '\0', },
    2061                 :            :                 { "t",  PP_d, PP_PKG_INSTALL_TIMESTAMP,   1, '\0', },
    2062                 :            :                 { "u",  PP_d, PP_PKG_CHECKSUM,            1, '\0', },
    2063                 :            :                 { "v",  PP_d, PP_PKG_VERSION,             1, '\0', },
    2064                 :            :                 { "w",  PP_d, PP_PKG_HOME_PAGE,           1, '\0', },
    2065                 :            :                 { "x",  PP_d, PP_PKG_PKGSIZE,             1, '\0', },
    2066                 :            :                 { "z",  PP_d, PP_PKG_SHORT_CHECKSUM,      1, '\0', },
    2067                 :            :                 { "%",  PP_d, PP_LITERAL_PERCENT,         1, '\0', },
    2068                 :            :                 { "Z",  PP_d, PP_UNKNOWN,                 0, 'Z',  },
    2069                 :            : 
    2070                 :            :                 { "Bn", PP_r, PP_UNKNOWN,                 0, 'B',  },
    2071                 :            :                 { "B",  PP_r, PP_UNKNOWN,                 0, 'B',  },
    2072                 :            :                 { "Cn", PP_r, PP_UNKNOWN,                 0, 'C',  },
    2073                 :            :                 { "C",  PP_r, PP_UNKNOWN,                 0, 'C',  },
    2074                 :            :                 { "Dg", PP_r, PP_UNKNOWN,                 0, 'D',  },
    2075                 :            :                 { "Dk", PP_r, PP_UNKNOWN,                 0, 'D',  },
    2076                 :            :                 { "Dn", PP_r, PP_UNKNOWN,                 0, 'D',  },
    2077                 :            :                 { "Dp", PP_r, PP_UNKNOWN,                 0, 'D',  },
    2078                 :            :                 { "Dt", PP_r, PP_UNKNOWN,                 0, 'D',  },
    2079                 :            :                 { "Du", PP_r, PP_UNKNOWN,                 0, 'D',  },
    2080                 :            :                 { "D",  PP_r, PP_UNKNOWN,                 0, 'D',  },
    2081                 :            :                 { "Fg", PP_r, PP_UNKNOWN,                 0, 'F',  },
    2082                 :            :                 { "Fk", PP_r, PP_UNKNOWN,                 0, 'F',  },
    2083                 :            :                 { "Fn", PP_r, PP_UNKNOWN,                 0, 'F',  },
    2084                 :            :                 { "Fp", PP_r, PP_UNKNOWN,                 0, 'F',  },
    2085                 :            :                 { "Fs", PP_r, PP_UNKNOWN,                 0, 'F',  },
    2086                 :            :                 { "Fu", PP_r, PP_UNKNOWN,                 0, 'F',  },
    2087                 :            :                 { "F",  PP_r, PP_UNKNOWN,                 0, 'F',  },
    2088                 :            :                 { "Gn", PP_r, PP_UNKNOWN,                 0, 'G',  },
    2089                 :            :                 { "G",  PP_r, PP_UNKNOWN,                 0, 'G',  },
    2090                 :            :                 { "I",  PP_r, PP_ROW_COUNTER,             1, '\0', },
    2091                 :            :                 { "Ln", PP_r, PP_UNKNOWN,                 0, 'L',  },
    2092                 :            :                 { "L",  PP_r, PP_UNKNOWN,                 0, 'L',  },
    2093                 :            :                 { "M",  PP_r, PP_PKG_MESSAGE,             1, '\0', },
    2094                 :            :                 { "N",  PP_r, PP_PKG_REPO_IDENT,          1, '\0', },
    2095                 :            :                 { "On", PP_r, PP_UNKNOWN,                 0, 'O',  },
    2096                 :            :                 { "Ov", PP_r, PP_UNKNOWN,                 0, 'O',  },
    2097                 :            :                 { "Od", PP_r, PP_UNKNOWN,                 0, 'O',  },
    2098                 :            :                 { "OD", PP_r, PP_UNKNOWN,                 0, 'O',  },
    2099                 :            :                 { "O",  PP_r, PP_UNKNOWN,                 0, 'O',  },
    2100                 :            :                 { "R",  PP_r, PP_PKG_REPO_PATH,           1, '\0', },
    2101                 :            :                 { "S",  PP_r, PP_UNKNOWN,                 0, 'S',  },
    2102                 :            :                 { "Un", PP_r, PP_UNKNOWN,                 0, 'U',  },
    2103                 :            :                 { "U",  PP_r, PP_UNKNOWN,                 0, 'U',  },
    2104                 :            :                 { "V",  PP_r, PP_PKG_OLD_VERSION,         1, '\0', },
    2105                 :            :                 { "a",  PP_r, PP_PKG_AUTOREMOVE,          1, '\0', },
    2106                 :            :                 { "bn", PP_r, PP_UNKNOWN,                 0, 'b',  },
    2107                 :            :                 { "b",  PP_r, PP_UNKNOWN,                 0, 'b',  },
    2108                 :            :                 { "c",  PP_r, PP_PKG_COMMENT,             1, '\0', },
    2109                 :            :                 { "dk", PP_r, PP_UNKNOWN,                 0, 'd',  },
    2110                 :            :                 { "dn", PP_r, PP_UNKNOWN,                 0, 'd',  },
    2111                 :            :                 { "do", PP_r, PP_UNKNOWN,                 0, 'd',  },
    2112                 :            :                 { "dv", PP_r, PP_UNKNOWN,                 0, 'd',  },
    2113                 :            :                 { "d",  PP_r, PP_UNKNOWN,                 0, 'd',  },
    2114                 :            :                 { "e",  PP_r, PP_PKG_DESCRIPTION,         1, '\0', },
    2115                 :            :                 { "k",  PP_r, PP_PKG_LOCK_STATUS,         1, '\0', },
    2116                 :            :                 { "l",  PP_r, PP_PKG_LICENSE_LOGIC,       1, '\0', },
    2117                 :            :                 { "m",  PP_r, PP_PKG_MAINTAINER,          1, '\0', },
    2118                 :            :                 { "n",  PP_r, PP_PKG_NAME,                1, '\0', },
    2119                 :            :                 { "o",  PP_r, PP_PKG_ORIGIN,              1, '\0', },
    2120                 :            :                 { "p",  PP_r, PP_PKG_PREFIX,              1, '\0', },
    2121                 :            :                 { "q",  PP_r, PP_PKG_ARCHITECTURE,        1, '\0', },
    2122                 :            :                 { "rk", PP_r, PP_PKG_REQUIREMENT_LOCK,    2, '\0', },
    2123                 :            :                 { "rn", PP_r, PP_PKG_REQUIREMENT_NAME,    2, '\0', },
    2124                 :            :                 { "ro", PP_r, PP_PKG_REQUIREMENT_ORIGIN,  2, '\0', },
    2125                 :            :                 { "rv", PP_r, PP_PKG_REQUIREMENT_VERSION, 2, '\0', },
    2126                 :            :                 { "r",  PP_r, PP_UNKNOWN,                 0, 'r',  },
    2127                 :            :                 { "s",  PP_r, PP_PKG_FLATSIZE,            1, '\0', },
    2128                 :            :                 { "t",  PP_r, PP_PKG_INSTALL_TIMESTAMP,   1, '\0', },
    2129                 :            :                 { "u",  PP_r, PP_PKG_CHECKSUM,            1, '\0', },
    2130                 :            :                 { "v",  PP_r, PP_PKG_VERSION,             1, '\0', },
    2131                 :            :                 { "w",  PP_r, PP_PKG_HOME_PAGE,           1, '\0', },
    2132                 :            :                 { "x",  PP_r, PP_PKG_PKGSIZE,             1, '\0', },
    2133                 :            :                 { "z",  PP_r, PP_PKG_SHORT_CHECKSUM,      1, '\0', },
    2134                 :            :                 { "%",  PP_r, PP_LITERAL_PERCENT,         1, '\0', },
    2135                 :            :                 { "Z",  PP_r, PP_UNKNOWN,                 0, 'Z',  },
    2136                 :            : 
    2137                 :            :                 { NULL, 0,    0,                          0, '\0', },
    2138                 :            :         };
    2139                 :            : 
    2140                 :         13 :         p = new_percent_esc();
    2141                 :            : 
    2142         [ +  - ]:         13 :         ATF_REQUIRE_EQ(p != NULL, true);
    2143                 :            : 
    2144         [ +  + ]:      10231 :         for (i = 0; fc_test_vals[i].in != NULL; i++) {
    2145                 :      10218 :                 p->width = 0;
    2146                 :      10218 :                 f = format_code(fc_test_vals[i].in, fc_test_vals[i].context, p);
    2147                 :            : 
    2148         [ +  - ]:      10218 :                 ATF_CHECK_EQ_MSG(p->fmt_code, fc_test_vals[i].fmt_code,
    2149                 :            :                                     "(test %d: %d != %d)", i,
    2150                 :            :                                     p->fmt_code, fc_test_vals[i].fmt_code);
    2151         [ +  - ]:      10218 :                 ATF_CHECK_EQ_MSG(f - fc_test_vals[i].in,
    2152                 :            :                                  fc_test_vals[i].fend_offset,
    2153                 :            :                                  "(test %d)", i);
    2154         [ +  - ]:      10218 :                 ATF_CHECK_EQ_MSG(*f, fc_test_vals[i].fend_val,
    2155                 :            :                                  "(test %d)", i);
    2156                 :      10218 :         }
    2157                 :            : 
    2158                 :         13 :         free_percent_esc(p);
    2159                 :         13 : }
    2160                 :            : 
    2161                 :            : ATF_TC(format_trailer);
    2162                 :        221 : ATF_TC_HEAD(format_trailer, tc)
    2163                 :            : {
    2164                 :        221 :         atf_tc_set_md_var(tc, "descr",
    2165                 :            :             "Testing format_trailer() format parsing routine");
    2166                 :        221 : }
    2167                 :         13 : ATF_TC_BODY(format_trailer, tc)
    2168                 :            : {
    2169                 :            :         struct percent_esc      *p;
    2170                 :            :         const char              *f;
    2171                 :            :         int                     i;
    2172                 :            : 
    2173                 :            :         struct ft_test_vals {
    2174                 :            :                 const char *in;
    2175                 :            :                 const char *item;
    2176                 :            :                 const char *sep;
    2177                 :            :                 ptrdiff_t   fend_offset; /* Where f is left pointing */
    2178                 :            :                 char        fend_val; /* expected first char in fend */
    2179                 :         13 :         } ft_test_vals[] = {
    2180                 :            :                 { "%{aaaaaaaa", "",   "",    0, '%',  },
    2181                 :            :                 { "%{bb%|cccc", "",   "",    0, '%',  },
    2182                 :            :                 { "ddd%|eee%}", "",   "",    0, 'd',  },
    2183                 :            :                 { "%{ff%|gg%}", "ff", "gg", 10, '\0', },
    2184                 :            :                 { "%{hh%}",     "hh", "",    6, '\0', },
    2185                 :            :                 { "%{%|iii%}",  "",   "iii", 9, '\0', },
    2186                 :            : 
    2187                 :            :                 { NULL,         NULL, NULL,  0, '\0', },
    2188                 :            :         };
    2189                 :            : 
    2190                 :         13 :         p = new_percent_esc();
    2191                 :            : 
    2192         [ +  - ]:         13 :         ATF_REQUIRE_EQ(p != NULL, true);
    2193                 :            : 
    2194         [ +  + ]:         91 :         for (i = 0; ft_test_vals[i].in != NULL; i++) {
    2195                 :         78 :                 clear_percent_esc(p);
    2196                 :            : 
    2197                 :         78 :                 f = format_trailer(ft_test_vals[i].in, p);
    2198                 :         78 :                 fflush(p->item_fmt->fp);
    2199                 :         78 :                 fflush(p->sep_fmt->fp);
    2200                 :            : 
    2201         [ +  - ]:         78 :                 ATF_CHECK_STREQ_MSG(p->item_fmt->buf,
    2202                 :            :                                     ft_test_vals[i].item,
    2203                 :            :                                     "(test %d)", i);
    2204         [ +  - ]:         78 :                 ATF_CHECK_STREQ_MSG(p->sep_fmt->buf,
    2205                 :            :                                     ft_test_vals[i].sep,
    2206                 :            :                                     "(test %d)", i);
    2207         [ +  - ]:         78 :                 ATF_CHECK_EQ_MSG(f - ft_test_vals[i].in,
    2208                 :            :                                  ft_test_vals[i].fend_offset,
    2209                 :            :                                  "(test %d)", i);
    2210         [ +  - ]:         78 :                 ATF_CHECK_EQ_MSG(*f, ft_test_vals[i].fend_val,
    2211                 :            :                                  "(test %d)", i);
    2212                 :         78 :         }
    2213                 :            : 
    2214                 :         13 :         free_percent_esc(p);
    2215                 :         13 : }
    2216                 :            : 
    2217                 :            : ATF_TC(parse_format);
    2218                 :        221 : ATF_TC_HEAD(parse_format, tc)
    2219                 :            : {
    2220                 :        221 :         atf_tc_set_md_var(tc, "descr",
    2221                 :            :             "Testing parse_format() format parsing routine");
    2222                 :        221 : }
    2223                 :         13 : ATF_TC_BODY(parse_format, tc)
    2224                 :            : {
    2225                 :            :         struct percent_esc      *p;
    2226                 :            :         const char              *f;
    2227                 :            :         int                     i;
    2228                 :            : 
    2229                 :            :         struct pf_test_vals {
    2230                 :            :                 const char *in;
    2231                 :            :                 unsigned context;
    2232                 :            : 
    2233                 :            :                 unsigned flags;
    2234                 :            :                 int width;
    2235                 :            :                 fmt_code_t fmt_code;
    2236                 :            :                 const char *item;
    2237                 :            :                 const char *sep;
    2238                 :            :                 ptrdiff_t   fend_offset; /* Where f is left pointing */
    2239                 :            :                 char        fend_val; /* expected first char in fend */
    2240                 :         13 :         } pf_test_vals[] = {
    2241                 :            :                 { "%n",    PP_PKG, 0,             0,  PP_PKG_NAME, "",   "",   2, '\0', },
    2242                 :            :                 { "%-20n", PP_PKG, PP_LEFT_ALIGN, 20, PP_PKG_NAME, "",   "",   5, '\0', },
    2243                 :            :                 { "%?B",   PP_PKG, PP_ALTERNATE_FORM1, 0, PP_PKG_SHLIBS_REQUIRED, "", "", 3, '\0', },
    2244                 :            :                 { "%#F",   PP_PKG, PP_ALTERNATE_FORM2, 0, PP_PKG_FILES,  "", "", 3, '\0', },
    2245                 :            : 
    2246                 :            :                 { "%L%{%Ln%| %l %}", PP_PKG, 0, 0, PP_PKG_LICENSES, "%Ln", " %l ", 15, '\0', },
    2247                 :            :                 { "%Ln",   PP_L,   0,             0,  PP_PKG_LICENSE_NAME,  "", "", 3, '\0', },
    2248                 :            :                 { "%l",    PP_L,   0,             0,  PP_PKG_LICENSE_LOGIC, "", "", 2, '\0', },
    2249                 :            : 
    2250                 :            :                 { "%Ln",   PP_PKG, 0,             0,  PP_PKG_LICENSE_NAME,  "", "", 3, '\0', },
    2251                 :            :                 { "%l",    PP_PKG, 0,             0,  PP_PKG_LICENSE_LOGIC, "", "", 2, '\0', },
    2252                 :            : 
    2253                 :            :                 { "%I",    PP_PKG, 0,             0,  PP_UNKNOWN,          "", "", 1, 'I', },
    2254                 :            : 
    2255                 :            :                 { "%^D",   PP_PKG, 0,             0,  PP_UNKNOWN,          "", "", 1, '^', },
    2256                 :            : 
    2257                 :            :                 { NULL,    0,      0,             0,  0,           NULL, NULL, 0, '\0', },
    2258                 :            :         };
    2259                 :            : 
    2260                 :         13 :         p = new_percent_esc();
    2261                 :            : 
    2262         [ +  - ]:         13 :         ATF_REQUIRE(p != NULL);
    2263                 :            : 
    2264         [ +  + ]:        156 :         for (i = 0; pf_test_vals[i].in != NULL; i++) {
    2265                 :        286 :                 f = parse_format(pf_test_vals[i].in, pf_test_vals[i].context,
    2266                 :        143 :                                  p);
    2267                 :            : 
    2268         [ +  - ]:        143 :                 ATF_CHECK_EQ_MSG(p->flags, pf_test_vals[i].flags,
    2269                 :            :                                     "(test %d)", i);
    2270         [ +  - ]:        143 :                 ATF_CHECK_EQ_MSG(p->width, pf_test_vals[i].width,
    2271                 :            :                                     "(test %d)", i);
    2272         [ +  - ]:        143 :                 ATF_CHECK_EQ_MSG(p->fmt_code, pf_test_vals[i].fmt_code,
    2273                 :            :                                     "(test %d)", i);
    2274                 :            : 
    2275                 :        143 :                 fflush(p->item_fmt->fp);
    2276                 :        143 :                 fflush(p->sep_fmt->fp);
    2277         [ +  - ]:        143 :                 ATF_CHECK_STREQ_MSG(p->item_fmt->buf,
    2278                 :            :                                     pf_test_vals[i].item,
    2279                 :            :                                     "(test %d)", i);
    2280         [ +  - ]:        143 :                 ATF_CHECK_STREQ_MSG(p->sep_fmt->buf,
    2281                 :            :                                     pf_test_vals[i].sep,
    2282                 :            :                                     "(test %d)", i);
    2283         [ +  - ]:        143 :                 ATF_CHECK_EQ_MSG(f - pf_test_vals[i].in,
    2284                 :            :                                  pf_test_vals[i].fend_offset,
    2285                 :            :                                  "(test %d)", i);
    2286         [ +  - ]:        143 :                 ATF_CHECK_EQ_MSG(*f, pf_test_vals[i].fend_val,
    2287                 :            :                                  "(test %d)", i);
    2288                 :            : 
    2289                 :        143 :                 p = clear_percent_esc(p);
    2290                 :        143 :         }
    2291                 :            : 
    2292                 :         13 :         free_percent_esc(p);
    2293                 :         13 : }
    2294                 :            : 
    2295                 :            : 
    2296                 :            : 
    2297                 :        442 : ATF_TP_ADD_TCS(tp)
    2298                 :            : {
    2299                 :            :         /* Output routines */
    2300   [ +  -  -  +  :        221 :         ATF_TP_ADD_TC(tp, gen_format);
                   -  + ]
    2301   [ +  -  -  +  :        221 :         ATF_TP_ADD_TC(tp, human_number);
                   -  + ]
    2302   [ +  -  -  +  :        221 :         ATF_TP_ADD_TC(tp, string_val);
                   -  + ]
    2303   [ +  -  -  +  :        221 :         ATF_TP_ADD_TC(tp, int_val);
                   -  + ]
    2304   [ +  -  -  +  :        221 :         ATF_TP_ADD_TC(tp, bool_val);
                   -  + ]
    2305   [ +  -  -  +  :        221 :         ATF_TP_ADD_TC(tp, mode_val);
                   -  + ]
    2306   [ +  -  -  +  :        221 :         ATF_TP_ADD_TC(tp, liclog_val);
                   -  + ]
    2307   [ +  -  -  +  :        221 :         ATF_TP_ADD_TC(tp, list_count);
                   -  + ]
    2308                 :            : 
    2309                 :            :         /* Format string parsing routines */
    2310   [ +  -  -  +  :        221 :         ATF_TP_ADD_TC(tp, maybe_read_hex_byte);
                   -  + ]
    2311   [ +  -  -  +  :        221 :         ATF_TP_ADD_TC(tp, read_oct_byte);
                   -  + ]
    2312   [ +  -  -  +  :        221 :         ATF_TP_ADD_TC(tp, process_escape);
                   -  + ]
    2313                 :            : 
    2314   [ +  -  -  +  :        221 :         ATF_TP_ADD_TC(tp, field_modifier);
                   -  + ]
    2315   [ -  +  -  +  :        221 :         ATF_TP_ADD_TC(tp, field_width);
                   -  + ]
    2316   [ +  -  -  +  :        221 :         ATF_TP_ADD_TC(tp, format_code);
                   -  + ]
    2317   [ +  -  -  +  :        221 :         ATF_TP_ADD_TC(tp, format_trailer);
                   -  + ]
    2318   [ +  -  -  +  :        221 :         ATF_TP_ADD_TC(tp, parse_format);
                   -  + ]
    2319                 :            : 
    2320                 :            : 
    2321                 :        221 :         return atf_no_error();
    2322                 :        221 : }
    2323                 :            : /*
    2324                 :            :  * That's All Folks!
    2325                 :            :  */

Generated by: LCOV version 1.15