MCPcopy Create free account
hub / github.com/coreutils/coreutils / print_header

Function print_header

src/pr.c:2381–2412  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2379 the page. */
2380
2381static void
2382print_header (void)
2383{
2384 char page_text[256 + INT_STRLEN_BOUND (page_number)];
2385 int available_width;
2386 int lhs_spaces;
2387 int rhs_spaces;
2388
2389 output_position = 0;
2390 pad_across_to (chars_per_margin);
2391 print_white_space ();
2392
2393 if (page_number == 0)
2394 error (EXIT_FAILURE, 0, _("page number overflow"));
2395
2396 /* The translator must ensure that formatting the translation of
2397 "Page %ju" does not generate more than (sizeof page_text - 1)
2398 bytes. */
2399 sprintf (page_text, _("Page %ju"), page_number);
2400 available_width = header_width_available - mbswidth (page_text, 0);
2401 available_width = MAX (0, available_width);
2402 lhs_spaces = available_width >> 1;
2403 rhs_spaces = available_width - lhs_spaces;
2404
2405 printf ("\n\n%*s%s%*s%s%*s%s\n\n\n",
2406 chars_per_margin, "",
2407 date_text, lhs_spaces, " ",
2408 file_text, rhs_spaces, " ", page_text);
2409
2410 print_a_header = false;
2411 output_position = 0;
2412}
2413
2414/* Print (or store, if p->char_func is store_char()) a line.
2415

Callers 2

read_lineFunction · 0.85
print_storedFunction · 0.85

Calls 2

pad_across_toFunction · 0.85
print_white_spaceFunction · 0.85

Tested by

no test coverage detected