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

Function get_paragraph

src/fmt.c:569–639  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

567 paragraph, else true. */
568
569static bool
570get_paragraph (FILE *f)
571{
572 int c;
573
574 last_line_length = 0;
575 c = next_char;
576
577 /* Scan (and copy) blank lines, and lines not introduced by the prefix. */
578
579 while (c == '\n' || c == EOF
580 || next_prefix_indent < prefix_lead_space
581 || in_column < next_prefix_indent + prefix_full_length)
582 {
583 c = copy_rest (f, c);
584 if (c == EOF)
585 {
586 next_char = EOF;
587 return false;
588 }
589 putchar ('\n');
590 c = get_prefix (f);
591 }
592
593 /* Got a suitable first line for a paragraph. */
594
595 prefix_indent = next_prefix_indent;
596 first_indent = in_column;
597 wptr = parabuf;
598 word_limit = word;
599 c = get_line (f, c);
600 set_other_indent (same_para (c));
601
602 /* Read rest of paragraph (unless split is specified). */
603
604 if (split)
605 {
606 /* empty */
607 }
608 else if (crown)
609 {
610 if (same_para (c))
611 {
612 do
613 { /* for each line till the end of the para */
614 c = get_line (f, c);
615 }
616 while (same_para (c) && in_column == other_indent);
617 }
618 }
619 else if (tagged)
620 {
621 if (same_para (c) && in_column != first_indent)
622 {
623 do
624 { /* for each line till the end of the para */
625 c = get_line (f, c);
626 }

Callers 1

fmtFunction · 0.85

Calls 5

copy_restFunction · 0.85
get_prefixFunction · 0.85
set_other_indentFunction · 0.85
same_paraFunction · 0.85
get_lineFunction · 0.70

Tested by

no test coverage detected