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

Function init_funcs

src/pr.c:1396–1475  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1394 printing a column (p->start_position). */
1395
1396static void
1397init_funcs (void)
1398{
1399 int i, h, h_next;
1400 COLUMN *p;
1401
1402 h = chars_per_margin;
1403
1404 if (!truncate_lines)
1405 h_next = ANYWHERE;
1406 else
1407 {
1408 /* When numbering lines of parallel files, we enlarge the
1409 first column to accommodate the number. Looks better than
1410 the Sys V approach. */
1411 if (parallel_files && numbered_lines)
1412 h_next = h + chars_per_column + number_width;
1413 else
1414 h_next = h + chars_per_column;
1415 }
1416
1417 /* Enlarge p->start_position of first column to use the same form of
1418 padding_not_printed with all columns. */
1419 h = h + col_sep_length;
1420
1421 /* This loop takes care of all but the rightmost column. */
1422
1423 for (p = column_vector, i = 1; i < columns; ++p, ++i)
1424 {
1425 if (storing_columns) /* One file, multi columns down. */
1426 {
1427 p->char_func = store_char;
1428 p->print_func = print_stored;
1429 }
1430 else
1431 /* One file, multi columns across; or parallel files. */
1432 {
1433 p->char_func = print_char;
1434 p->print_func = read_line;
1435 }
1436
1437 /* Number only the first column when printing files in
1438 parallel. */
1439 p->numbered = numbered_lines && (!parallel_files || i == 1);
1440 p->start_position = h;
1441
1442 /* If we don't truncate lines, all start_positions are
1443 ANYWHERE, except the first column's start_position when
1444 using a margin. */
1445
1446 if (!truncate_lines)
1447 {
1448 h = ANYWHERE;
1449 h_next = ANYWHERE;
1450 }
1451 else
1452 {
1453 h = h_next + col_sep_length;

Callers 1

print_filesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected