FILE is the name of the file (or null for standard input) associated with the specified counters. */
| 258 | /* FILE is the name of the file (or null for standard input) |
| 259 | associated with the specified counters. */ |
| 260 | static void |
| 261 | write_counts (uintmax_t lines, |
| 262 | uintmax_t words, |
| 263 | uintmax_t chars, |
| 264 | uintmax_t bytes, |
| 265 | intmax_t linelength, |
| 266 | char const *file) |
| 267 | { |
| 268 | static char const format_sp_int[] = " %*s"; |
| 269 | char const *format_int = format_sp_int + 1; |
| 270 | char buf[MAX (INT_BUFSIZE_BOUND (intmax_t), |
| 271 | INT_BUFSIZE_BOUND (uintmax_t))]; |
| 272 | |
| 273 | if (print_lines) |
| 274 | { |
| 275 | printf (format_int, number_width, umaxtostr (lines, buf)); |
| 276 | format_int = format_sp_int; |
| 277 | } |
| 278 | if (print_words) |
| 279 | { |
| 280 | printf (format_int, number_width, umaxtostr (words, buf)); |
| 281 | format_int = format_sp_int; |
| 282 | } |
| 283 | if (print_chars) |
| 284 | { |
| 285 | printf (format_int, number_width, umaxtostr (chars, buf)); |
| 286 | format_int = format_sp_int; |
| 287 | } |
| 288 | if (print_bytes) |
| 289 | { |
| 290 | printf (format_int, number_width, umaxtostr (bytes, buf)); |
| 291 | format_int = format_sp_int; |
| 292 | } |
| 293 | if (print_linelength) |
| 294 | printf (format_int, number_width, imaxtostr (linelength, buf)); |
| 295 | if (file) |
| 296 | printf (" %s", strchr (file, '\n') ? quotef (file) : file); |
| 297 | putchar ('\n'); |
| 298 | |
| 299 | if (ferror (stdout)) |
| 300 | write_error (); |
| 301 | } |
| 302 | |
| 303 | /* Read FD and return a summary. */ |
| 304 | static struct wc_lines |
no test coverage detected