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

Function get_line

src/fmt.c:688–737  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

686 Return the first non-blank character of the next line. */
687
688static int
689get_line (FILE *f, int c)
690{
691 int start;
692 char *end_of_parabuf;
693 WORD *end_of_word;
694
695 end_of_parabuf = &parabuf[MAXCHARS];
696 end_of_word = &word[MAXWORDS - 2];
697
698 do
699 { /* for each word in a line */
700
701 /* Scan word. */
702
703 word_limit->text = wptr;
704 do
705 {
706 if (wptr == end_of_parabuf)
707 {
708 set_other_indent (true);
709 flush_paragraph ();
710 }
711 *wptr++ = c;
712 c = getc (f);
713 }
714 while (c != EOF && !c_isspace (c));
715 in_column += word_limit->length = wptr - word_limit->text;
716 check_punctuation (word_limit);
717
718 /* Scan inter-word space. */
719
720 start = in_column;
721 c = get_space (f, c);
722 word_limit->space = in_column - start;
723 word_limit->final = (c == EOF
724 || (word_limit->period
725 && (c == '\n' || word_limit->space > 1)));
726 if (c == '\n' || c == EOF || uniform)
727 word_limit->space = word_limit->final ? 2 : 1;
728 if (word_limit == end_of_word)
729 {
730 set_other_indent (true);
731 flush_paragraph ();
732 }
733 word_limit++;
734 }
735 while (c != '\n' && c != EOF);
736 return get_prefix (f);
737}
738
739/* Read a prefix from input file F. Return either first non-matching
740 character, or first non-blank character after the prefix. */

Callers 1

get_paragraphFunction · 0.70

Calls 5

set_other_indentFunction · 0.85
flush_paragraphFunction · 0.85
check_punctuationFunction · 0.85
get_spaceFunction · 0.85
get_prefixFunction · 0.85

Tested by

no test coverage detected