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

Function process_field

src/numfmt.c:1449–1474  ·  view source on GitHub ↗

Convert and output the given field. If it is not included in the set of fields to process just output the original */

Source from the content-addressed store, hash-verified

1447/* Convert and output the given field. If it is not included in the set
1448 of fields to process just output the original */
1449static bool
1450process_field (char *text, uintmax_t field)
1451{
1452 long double val = 0;
1453 size_t precision = 0;
1454 bool valid_number = true;
1455
1456 if (include_field (field))
1457 {
1458 valid_number =
1459 process_suffixed_number (text, &val, &precision, field);
1460
1461 intmax_t padding;
1462 if (valid_number)
1463 valid_number = prepare_padded_number (val, precision, &padding);
1464
1465 if (valid_number)
1466 print_padded_number (padding);
1467 else
1468 fputs (text, stdout);
1469 }
1470 else
1471 fputs (text, stdout);
1472
1473 return valid_number;
1474}
1475
1476/* Convert number in a given line of text.
1477 NEWLINE specifies whether to output a '\n' for this "line". */

Callers 1

process_lineFunction · 0.85

Calls 4

include_fieldFunction · 0.85
process_suffixed_numberFunction · 0.85
prepare_padded_numberFunction · 0.85
print_padded_numberFunction · 0.85

Tested by

no test coverage detected