* Add a header to the table. * * Headers are not duplicated; you must ensure that the header string is * available for the lifetime of the printTableContent struct. * * If translate is true, the function will pass the header through gettext. * Otherwise, the header will not be translated. * * align is either 'l' or 'r', and specifies the alignment for cells in this * column. */
| 3095 | * column. |
| 3096 | */ |
| 3097 | void |
| 3098 | printTableAddHeader(printTableContent *const content, char *header, |
| 3099 | const bool translate, const char align) |
| 3100 | { |
| 3101 | #ifndef ENABLE_NLS |
| 3102 | (void) translate; /* unused parameter */ |
| 3103 | #endif |
| 3104 | |
| 3105 | if (content->header >= content->headers + content->ncolumns) |
| 3106 | { |
| 3107 | fprintf(stderr, _("Cannot add header to table content: " |
| 3108 | "column count of %d exceeded.\n"), |
| 3109 | content->ncolumns); |
| 3110 | exit(EXIT_FAILURE); |
| 3111 | } |
| 3112 | |
| 3113 | *content->header = (char *) mbvalidate((unsigned char *) header, |
| 3114 | content->opt->encoding); |
| 3115 | #ifdef ENABLE_NLS |
| 3116 | if (translate) |
| 3117 | *content->header = _(*content->header); |
| 3118 | #endif |
| 3119 | content->header++; |
| 3120 | |
| 3121 | *content->align = align; |
| 3122 | content->align++; |
| 3123 | } |
| 3124 | |
| 3125 | /* |
| 3126 | * Add a cell to the table. |
no test coverage detected