Re: Buffer contents well-defined after fgets() reaches EOF ?

Liste des GroupesRevenir à cl c 
Sujet : Re: Buffer contents well-defined after fgets() reaches EOF ?
De : janis_papanagnou+ng (at) *nospam* hotmail.com (Janis Papanagnou)
Groupes : comp.lang.c
Date : 10. Feb 2025, 07:08:22
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <voc54n$13arc$1@dont-email.me>
References : 1 2 3 4 5 6 7 8
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 10.02.2025 05:37, Keith Thompson wrote:
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
 
The most extreme context I had worked in was a company that allowed
(for every employee) a free choice of used computer technology; that
led to program text files that literally had all the inconsistencies.
Since many files were edited by different folks there where all sorts
of line terminators mixed even in the same one file, and there either
were complete last lines or not. The (some?) IDEs used were tolerant
WRT line terminators and their mixing. Other tools reacted sensibly.
The first thing I've done was to write a "C" tool to detect and fix
these sorts of inconsistencies.
 
Been there, done that.  There seems to be a tendency in the Windows
world to create text files with no terminator on the last line.

Yep.

In some cases I've been able to translate the source files to a
consistent format.  In others, doing so would have created huge
diffs in the source control system, so I left well enough alone.

Yes, that is what you buy with a fix. But it pays, IME. What I had
done was to provide scripts to automate the transformation, I did
a short-term code freeze on a whole project, transformed the data,
and since that point we had a consistent base. The good thing was
that the single CR terminators (old Apple/Macs, pre OS-X) were only
in older code. And the handling of LF vs. CR-LF was okay once that
the script streamlined the data, either converting all to LF, or,
to keep any conistent variant (whether it was LF or CR-LF).

 
My preferred editor, vim, handles files with either LF or CRLF line
endings gracefully, but if there's a mix it shows "^M" at the end of
each line that has a Windows-style CRLF ending.

Yes. With the change I described we got rid of this issue.

I found a possible
solution, but I haven't bothered using it since I'm not currently
dealing with such files.

Same here. For me it was just a historic little episode.

 
<https://vi.stackexchange.com/q/39297/2380>
 
This is already off-topic, so I won't even mention tabs vs. spaces.

But as Vim users we don't have any issues here; as long as the
indentation is _visibly_ consistent we can fix any tab/space-mix
on the fly and easily with Vim.

Janis


Date Sujet#  Auteur
9 Feb 25 * Buffer contents well-defined after fgets() reaches EOF ?83Janis Papanagnou
9 Feb 25 +- Re: Buffer contents well-defined after fgets() reaches EOF ?1Kaz Kylheku
9 Feb 25 +* Re: Buffer contents well-defined after fgets() reaches EOF ?79Andrey Tarasevich
9 Feb 25 i+* Re: Buffer contents well-defined after fgets() reaches EOF ?61Andrey Tarasevich
10 Feb 25 ii`* Re: Buffer contents well-defined after fgets() reaches EOF ?60Lawrence D'Oliveiro
10 Feb 25 ii `* Re: Buffer contents well-defined after fgets() reaches EOF ?59Andrey Tarasevich
10 Feb 25 ii  +* Re: Buffer contents well-defined after fgets() reaches EOF ?37Andrey Tarasevich
10 Feb 25 ii  i+* Re: Buffer contents well-defined after fgets() reaches EOF ?35Michael S
13 Feb 25 ii  ii`* Re: Buffer contents well-defined after fgets() reaches EOF ?34Tim Rentsch
14 Feb 25 ii  ii `* Re: Buffer contents well-defined after fgets() reaches EOF ?33Michael S
14 Feb 25 ii  ii  +* Re: Buffer contents well-defined after fgets() reaches EOF ?2Michael S
14 Feb 25 ii  ii  i`- Re: Buffer contents well-defined after fgets() reaches EOF ?1Kaz Kylheku
14 Feb 25 ii  ii  +* Re: Buffer contents well-defined after fgets() reaches EOF ?21Kaz Kylheku
14 Feb 25 ii  ii  i+* Re: Buffer contents well-defined after fgets() reaches EOF ?3Keith Thompson
14 Feb 25 ii  ii  ii`* Re: Buffer contents well-defined after fgets() reaches EOF ?2Kaz Kylheku
15 Feb 25 ii  ii  ii `- Re: Buffer contents well-defined after fgets() reaches EOF ?1Michael S
14 Feb 25 ii  ii  i+* Re: Buffer contents well-defined after fgets() reaches EOF ?14Janis Papanagnou
15 Feb 25 ii  ii  ii+- Re: Buffer contents well-defined after fgets() reaches EOF ?1Michael S
15 Feb 25 ii  ii  ii`* Re: Buffer contents well-defined after fgets() reaches EOF ?12Michael S
16 Feb 25 ii  ii  ii +* Re: Buffer contents well-defined after fgets() reaches EOF ?7Janis Papanagnou
16 Feb 25 ii  ii  ii i+* Re: Buffer contents well-defined after fgets() reaches EOF ?3James Kuyper
16 Feb 25 ii  ii  ii ii+- Re: Buffer contents well-defined after fgets() reaches EOF ?1Kaz Kylheku
16 Feb 25 ii  ii  ii ii`- Re: Buffer contents well-defined after fgets() reaches EOF ?1Janis Papanagnou
16 Feb 25 ii  ii  ii i`* Re: Buffer contents well-defined after fgets() reaches EOF ?3Michael S
16 Feb 25 ii  ii  ii i `* Re: Buffer contents well-defined after fgets() reaches EOF ?2Janis Papanagnou
17 Feb 25 ii  ii  ii i  `- Re: Buffer contents well-defined after fgets() reaches EOF ?1Michael S
16 Feb 25 ii  ii  ii `* Re: Buffer contents well-defined after fgets() reaches EOF ?4Kaz Kylheku
16 Feb 25 ii  ii  ii  +* Re: Buffer contents well-defined after fgets() reaches EOF ?2Michael S
16 Feb 25 ii  ii  ii  i`- Re: Buffer contents well-defined after fgets() reaches EOF ?1Janis Papanagnou
16 Feb 25 ii  ii  ii  `- Re: Buffer contents well-defined after fgets() reaches EOF ?1Janis Papanagnou
15 Feb 25 ii  ii  i+- Re: Buffer contents well-defined after fgets() reaches EOF ?1Michael S
15 Feb 25 ii  ii  i`* Re: Buffer contents well-defined after fgets() reaches EOF ?2Michael S
16 Feb 25 ii  ii  i `- Re: Buffer contents well-defined after fgets() reaches EOF ?1Janis Papanagnou
14 Feb 25 ii  ii  +* Re: Buffer contents well-defined after fgets() reaches EOF ?5Janis Papanagnou
14 Feb 25 ii  ii  i`* Re: Buffer contents well-defined after fgets() reaches EOF ?4James Kuyper
14 Feb 25 ii  ii  i `* Re: Buffer contents well-defined after fgets() reaches EOF ?3Janis Papanagnou
15 Feb 25 ii  ii  i  `* Re: Buffer contents well-defined after fgets() reaches EOF ?2Michael S
16 Feb 25 ii  ii  i   `- Re: Buffer contents well-defined after fgets() reaches EOF ?1Janis Papanagnou
15 Feb 25 ii  ii  +* Re: Buffer contents well-defined after fgets() reaches EOF ?3Tim Rentsch
15 Feb 25 ii  ii  i`* Re: Buffer contents well-defined after fgets() reaches EOF ?2Michael S
19 Feb 25 ii  ii  i `- Re: Buffer contents well-defined after fgets() reaches EOF ?1Tim Rentsch
21 Feb 25 ii  ii  `- Re: Buffer contents well-defined after fgets() reaches EOF ?1Lawrence D'Oliveiro
15 Feb 25 ii  i`- Re: Buffer contents well-defined after fgets() reaches EOF ?1Tim Rentsch
10 Feb 25 ii  +- Re: Buffer contents well-defined after fgets() reaches EOF ?1Janis Papanagnou
10 Feb 25 ii  `* Re: Buffer contents well-defined after fgets() reaches EOF ?20Lawrence D'Oliveiro
10 Feb 25 ii   `* Re: Buffer contents well-defined after fgets() reaches EOF ?19Andrey Tarasevich
10 Feb 25 ii    `* Re: Buffer contents well-defined after fgets() reaches EOF ?18Lawrence D'Oliveiro
10 Feb 25 ii     `* Re: Buffer contents well-defined after fgets() reaches EOF ?17James Kuyper
11 Feb 25 ii      `* Re: Buffer contents well-defined after fgets() reaches EOF ?16Lawrence D'Oliveiro
11 Feb 25 ii       +* Re: Buffer contents well-defined after fgets() reaches EOF ?11James Kuyper
11 Feb 25 ii       i+- Re: Buffer contents well-defined after fgets() reaches EOF ?1Kaz Kylheku
11 Feb 25 ii       i`* Re: Buffer contents well-defined after fgets() reaches EOF ?9Lawrence D'Oliveiro
11 Feb 25 ii       i `* Re: Buffer contents well-defined after fgets() reaches EOF ?8James Kuyper
11 Feb 25 ii       i  +* Re: Buffer contents well-defined after fgets() reaches EOF ?3Lawrence D'Oliveiro
11 Feb 25 ii       i  i`* Re: Buffer contents well-defined after fgets() reaches EOF ?2James Kuyper
12 Feb 25 ii       i  i `- Re: Buffer contents well-defined after fgets() reaches EOF ?1Lawrence D'Oliveiro
11 Feb 25 ii       i  `* Re: Buffer contents well-defined after fgets() reaches EOF ?4Keith Thompson
11 Feb 25 ii       i   `* Re: Buffer contents well-defined after fgets() reaches EOF ?3James Kuyper
12 Feb 25 ii       i    `* Re: Buffer contents well-defined after fgets() reaches EOF ?2Keith Thompson
18 Feb 25 ii       i     `- Re: Buffer contents well-defined after fgets() reaches EOF ?1Tim Rentsch
11 Feb 25 ii       `* Re: Buffer contents well-defined after fgets() reaches EOF ?4Andrey Tarasevich
11 Feb 25 ii        +- Re: Buffer contents well-defined after fgets() reaches EOF ?1Andrey Tarasevich
11 Feb 25 ii        +- Re: Buffer contents well-defined after fgets() reaches EOF ?1Kaz Kylheku
13 Feb 25 ii        `- Re: Buffer contents well-defined after fgets() reaches EOF ?1Tim Rentsch
9 Feb 25 i`* Re: Buffer contents well-defined after fgets() reaches EOF ?17Janis Papanagnou
9 Feb 25 i +* Re: Buffer contents well-defined after fgets() reaches EOF ?3Michael S
9 Feb 25 i i`* Re: Buffer contents well-defined after fgets() reaches EOF ?2Janis Papanagnou
10 Feb 25 i i `- Re: Buffer contents well-defined after fgets() reaches EOF ?1Mark Bourne
9 Feb 25 i +* Re: Buffer contents well-defined after fgets() reaches EOF ?11Andrey Tarasevich
9 Feb 25 i i`* Re: Buffer contents well-defined after fgets() reaches EOF ?10Janis Papanagnou
10 Feb 25 i i `* Re: Buffer contents well-defined after fgets() reaches EOF ?9Keith Thompson
10 Feb 25 i i  `* Re: Buffer contents well-defined after fgets() reaches EOF ?8Janis Papanagnou
10 Feb 25 i i   `* Re: Buffer contents well-defined after fgets() reaches EOF ?7Keith Thompson
10 Feb 25 i i    `* Re: Buffer contents well-defined after fgets() reaches EOF ?6Janis Papanagnou
10 Feb 25 i i     `* Re: Buffer contents well-defined after fgets() reaches EOF ?5Keith Thompson
10 Feb 25 i i      +* Re: Buffer contents well-defined after fgets() reaches EOF ?3Janis Papanagnou
11 Feb 25 i i      i+- Re: Buffer contents well-defined after fgets() reaches EOF ?1Mark Bourne
11 Feb 25 i i      i`- Re: Buffer contents well-defined after fgets() reaches EOF ?1Kaz Kylheku
17 Feb 25 i i      `- Re: Buffer contents well-defined after fgets() reaches EOF ?1Lawrence D'Oliveiro
10 Feb 25 i `* Re: Buffer contents well-defined after fgets() reaches EOF ?2Mark Bourne
11 Feb 25 i  `- Re: Buffer contents well-defined after fgets() reaches EOF ?1Mark Bourne
10 Feb 25 `* Re: Buffer contents well-defined after fgets() reaches EOF ?2Ben Bacarisse
10 Feb 25  `- Re: Buffer contents well-defined after fgets() reaches EOF ?1Janis Papanagnou

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal