| 349 | } |
| 350 | |
| 351 | size_t |
| 352 | ttyinq_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 | |
| 377 | void |
| 378 | ttyinq_flush(struct ttyinq *ti) |
no test coverage detected