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

Function skip_whitespace_run

src/cut.c:369–395  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

367}
368
369static inline enum field_terminator
370skip_whitespace_run (mbbuf_t *mbuf, struct mbfield_parser *parser,
371 bool *have_pending_line,
372 bool have_initial_whitespace)
373{
374 mcel_t g;
375
376 do
377 {
378 g = mbbuf_get_char (mbuf);
379 if (g.ch != MBBUF_EOF)
380 *have_pending_line = true;
381 }
382 while (g.ch != MBBUF_EOF && g.ch != line_delim && mcel_isblank (g));
383
384 bool trim_start = parser->trim_outer_whitespace && parser->at_line_start;
385
386 if (parser->trim_outer_whitespace
387 && (g.ch == MBBUF_EOF || g.ch == line_delim))
388 {
389 return g.ch == MBBUF_EOF ? FIELD_EOF : FIELD_LINE_DELIMITER;
390 }
391
392 parser->saved_g = g;
393 parser->have_saved = true;
394 return trim_start && !have_initial_whitespace ? FIELD_DATA : FIELD_DELIMITER;
395}
396
397/* Like fwrite, but avoid a function call for smaller amounts,
398 and exit immediately upon error. */

Callers 1

scan_mb_blank_fieldFunction · 0.85

Calls 2

mbbuf_get_charFunction · 0.85
mcel_isblankFunction · 0.85

Tested by

no test coverage detected