Alternate End-of-Line Delimiter
Alternate End-of-Line Delimiter

In some applications, the null character (end-of-text) is a better way to mark end-of-line then the normal '\n' character.

Notes
Without the alternate end-of-line concern, it would still be a good idea to use the symbolic constant eolchar.

Define default end of line (eolchar)
Variable definition
Notes
Without this concern, eolchar could be declared as "const int" or a "#define". Not only does this provide a mutable version of the end-of-line, it also joins the input and output notions of end-of-line.
Segment Source
  73: /* The character marking end of line. Default to \n. */
  74: int eolchar = '\n';
  75: 

User message text
Text insertion
Segment Source
 238:   -z               end lines with 0 byte, not newline, for find -print0\n\

End-of-line Testing
Notes
Without this concern, fillbuf() assumes that the notion of end-of-line is fixed in the universe.
Segment Element
Argument modification

 493:   while (!feof (fp) && (buf->used == 0 || !memchr (buf->buf, eolchar, buf->used)))

Segment Element
Argument modification

 510:   if (feof (fp) && buf->used && buf->buf[buf->used - 1] != eolchar)

Segment Element
Code modification

 517:       buf->buf[buf->used++] = eolchar;

End-of-line Testing
Argument modification
Notes
Without this concern, findlines() assumes that the notion of end-of-line is fixed in the universe.
Segment Source
 696:   while (beg < lim && (ptr = memchr (beg, eolchar, lim - beg))

End-of-line Generation in mergefps()
Notes
Without this concern, mergefps() assumes that the notion of end-of-line is fixed in the universe.

This could be part of the output concern.

Segment Element
Argument modification

1360:               putc (eolchar, ofp);

Segment Element
Argument modification

1393:           putc (eolchar, ofp);

Segment Element
Argument modification

1446:       putc (eolchar, ofp);

Generate end-of-line output
Argument modification
Notes
Without this concern, sort() assumes that the notion of end-of-line is fixed in the universe.

This could be part of the output concern.

Segment Source
1599:                 putc (eolchar, tfp);

Parse AltEoln option (-z)
Code insertion
Segment Source
2003:                   case 'z':
2004:                     eolchar = 0;
2005:                     break;