]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/termtable.c
zebra, lib: fix the ZEBRA_INTERFACE_VRF_UPDATE zapi message
[mirror_frr.git] / lib / termtable.c
index f7aec431181263517c865edd06c77b4ab8abce39..4f5f9ff218ef724de1e9e40c3b6966b3c21d57ea 100644 (file)
@@ -31,48 +31,60 @@ struct ttable_style ttable_styles[] = {
                .corner = '+',
                .rownums_on = false,
                .indent = 1,
-               .border.top = '-',
-               .border.bottom = '-',
-               .border.left = '|',
-               .border.right = '|',
-               .border.top_on = true,
-               .border.bottom_on = true,
-               .border.left_on = true,
-               .border.right_on = true,
-               .cell.lpad = 1,
-               .cell.rpad = 1,
-               .cell.align = LEFT,
-               .cell.border.bottom = '-',
-               .cell.border.bottom_on = true,
-               .cell.border.top = '-',
-               .cell.border.top_on = false,
-               .cell.border.right = '|',
-               .cell.border.right_on = true,
-               .cell.border.left = '|',
-               .cell.border.left_on = false,
+               .border = {
+                       .top = '-',
+                       .bottom = '-',
+                       .left = '|',
+                       .right = '|',
+                       .top_on = true,
+                       .bottom_on = true,
+                       .left_on = true,
+                       .right_on = true,
+               },
+               .cell = {
+                       .lpad = 1,
+                       .rpad = 1,
+                       .align = LEFT,
+                       .border = {
+                               .bottom = '-',
+                               .bottom_on = true,
+                               .top = '-',
+                               .top_on = false,
+                               .right = '|',
+                               .right_on = true,
+                               .left = '|',
+                               .left_on = false,
+                       },
+               },
        }, {    // blank, suitable for plaintext alignment
                .corner = ' ',
                .rownums_on = false,
                .indent = 1,
-               .border.top = ' ',
-               .border.bottom = ' ',
-               .border.left = ' ',
-               .border.right = ' ',
-               .border.top_on = false,
-               .border.bottom_on = false,
-               .border.left_on = false,
-               .border.right_on = false,
-               .cell.lpad = 0,
-               .cell.rpad = 3,
-               .cell.align = LEFT,
-               .cell.border.bottom = ' ',
-               .cell.border.bottom_on = false,
-               .cell.border.top = ' ',
-               .cell.border.top_on = false,
-               .cell.border.right = ' ',
-               .cell.border.right_on = false,
-               .cell.border.left = ' ',
-               .cell.border.left_on = false,
+               .border = {
+                       .top = ' ',
+                       .bottom = ' ',
+                       .left = ' ',
+                       .right = ' ',
+                       .top_on = false,
+                       .bottom_on = false,
+                       .left_on = false,
+                       .right_on = false,
+               },
+               .cell = {
+                       .lpad = 0,
+                       .rpad = 3,
+                       .align = LEFT,
+                       .border = {
+                               .bottom = ' ',
+                               .bottom_on = false,
+                               .top = ' ',
+                               .top_on = false,
+                               .right = ' ',
+                               .right_on = false,
+                               .left = ' ',
+                               .left_on = false,
+                       },
+               }
    }
 };
 /* clang-format on */
@@ -128,8 +140,8 @@ static struct ttable_cell *ttable_insert_row_va(struct ttable *tt, int i,
        int ncols = 0;
 
        /* count how many columns we have */
-       for (int i = 0; format[i]; i++)
-               ncols += !!(format[i] == '|');
+       for (int j = 0; format[j]; j++)
+               ncols += !!(format[j] == '|');
        ncols++;
 
        if (tt->ncols == 0)
@@ -383,7 +395,7 @@ char *ttable_dump(struct ttable *tt, const char *newline)
                        memcpy(&buf[pos], left, lsize);
                        pos += lsize;
 
-                       for (size_t i = 0; i < width - lsize - rsize; i++)
+                       for (size_t l = 0; l < width - lsize - rsize; l++)
                                buf[pos++] = row[0].style.border.top;
 
                        pos -= width - lsize - rsize;
@@ -409,7 +421,7 @@ char *ttable_dump(struct ttable *tt, const char *newline)
                                buf[pos++] = row[j].style.border.left;
 
                        /* print left padding */
-                       for (int i = 0; i < row[j].style.lpad; i++)
+                       for (int k = 0; k < row[j].style.lpad; k++)
                                buf[pos++] = ' ';
 
                        /* calculate padding for sprintf */
@@ -431,7 +443,7 @@ char *ttable_dump(struct ttable *tt, const char *newline)
                        pos += sprintf(&buf[pos], fmt, abspad, row[j].text);
 
                        /* print right padding */
-                       for (int i = 0; i < row[j].style.rpad; i++)
+                       for (int k = 0; k < row[j].style.rpad; k++)
                                buf[pos++] = ' ';
 
                        /* if right border && not last col print right border */
@@ -447,7 +459,7 @@ char *ttable_dump(struct ttable *tt, const char *newline)
                        memcpy(&buf[pos], left, lsize);
                        pos += lsize;
 
-                       for (size_t i = 0; i < width - lsize - rsize; i++)
+                       for (size_t l = 0; l < width - lsize - rsize; l++)
                                buf[pos++] = row[0].style.border.bottom;
 
                        pos -= width - lsize - rsize;
@@ -471,7 +483,7 @@ char *ttable_dump(struct ttable *tt, const char *newline)
                memcpy(&buf[pos], left, lsize);
                pos += lsize;
 
-               for (size_t i = 0; i < width - lsize - rsize; i++)
+               for (size_t l = 0; l < width - lsize - rsize; l++)
                        buf[pos++] = tt->style.border.bottom;
 
                memcpy(&buf[pos], right, rsize);