Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Weirdness in comm(1)



On Sat 28 Nov 2009 at 20:29:23 -0500, Greg A. Woods wrote:
> At Sun, 29 Nov 2009 01:42:08 +0700, Robert Elz <kre%munnari.OZ.AU@localhost> 
> wrote:
> Subject: Re: Weirdness in comm(1)
> >
> > Personally, I think that all text processing applications (ones intended
> > to process text files) should be defined to have undefined behaviour when
> > given a non-text file as input (including not being composed of a number of
> > lines (including 0) each of which ends in a \n.
> 
> I think it may be easier and safer all around to always think of
> newlines as separators rather than as _necessary_ terminators in unix
> text files.

No. Newlines are required at the end of each line.

Quote from K&R, 2nd edition, page 151, par 7.1, "Standard Input and
Output":

    A text stream consists of a sequence of lines; each line ends with a
    newline character.

and next, to reinforce this:

    If the system doesn't operate that way, the library does whatever is
    necessary to make it appear as if it does.

EMacs, which is a common editor that may get this wrong, didn't
originate on Unix but a system with different conventions.

-Olaf.
-- 
___ Olaf 'Rhialto' Seibert    -- You author it, and I'll reader it.
\X/ rhialto/at/xs4all.nl      -- Cetero censeo "authored" delendum esse.


Home | Main Index | Thread Index | Old Index