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

Function next_field

src/numfmt.c:1408–1428  ·  view source on GitHub ↗

Return a pointer to the beginning of the next field in line. The line pointer is moved to the end of the next field. */

Source from the content-addressed store, hash-verified

1406/* Return a pointer to the beginning of the next field in line.
1407 The line pointer is moved to the end of the next field. */
1408static char *
1409next_field (char **line)
1410{
1411 char *field_start = *line;
1412 char *field_end = field_start;
1413
1414 if (delimiter)
1415 {
1416 if (! (field_end = mbsmbchr (field_start, delimiter)))
1417 field_end = strchr (field_start, '\0');
1418 }
1419 else
1420 {
1421 /* keep any space prefix in the returned field */
1422 field_end = skip_str_matching (field_end, newline_or_blank, true);
1423 field_end = skip_str_matching (field_end, newline_or_blank, false);
1424 }
1425
1426 *line = field_end;
1427 return field_start;
1428}
1429
1430ATTRIBUTE_PURE
1431static bool

Callers 1

process_lineFunction · 0.85

Calls 2

mbsmbchrFunction · 0.85
skip_str_matchingFunction · 0.85

Tested by

no test coverage detected