MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ttyinq_findchar

Function ttyinq_findchar

freebsd/kern/tty_inq.c:351–375  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

349}
350
351size_t
352ttyinq_findchar(struct ttyinq *ti, const char *breakc, size_t maxlen,
353 char *lastc)
354{
355 struct ttyinq_block *tib = ti->ti_firstblock;
356 unsigned int boff = ti->ti_begin;
357 unsigned int bend = MIN(MIN(TTYINQ_DATASIZE, ti->ti_linestart),
358 ti->ti_begin + maxlen);
359
360 MPASS(maxlen > 0);
361
362 if (tib == NULL)
363 return (0);
364
365 while (boff < bend) {
366 if (strchr(breakc, tib->tib_data[boff]) && !GETBIT(tib, boff)) {
367 *lastc = tib->tib_data[boff];
368 return (boff - ti->ti_begin + 1);
369 }
370 boff++;
371 }
372
373 /* Not found - just process the entire block. */
374 return (bend - ti->ti_begin);
375}
376
377void
378ttyinq_flush(struct ttyinq *ti)

Callers 1

ttydisc_read_canonicalFunction · 0.85

Calls 1

strchrFunction · 0.85

Tested by

no test coverage detected