Skip \r character while printing Plan/etc. text files, it allows to

handle \r\n and \n\r files properly.
Previous variant put ^M for \r\n and ^M\n for \n\r
This commit is contained in:
Andrey A. Chernov 1997-03-17 17:07:39 +00:00
parent 2eaf474aea
commit 3429a30406

View File

@ -313,7 +313,8 @@ show_text(directory, file_name, header)
if (cnt <= 1) {
(void)printf("%s: ", header);
for (p = tbuf, cnt = nr; cnt--; ++p)
vputc(lastc = *p);
if (*p != '\r')
vputc(lastc = *p);
if (lastc != '\n')
(void)putchar('\n');
(void)close(fd);
@ -326,7 +327,8 @@ show_text(directory, file_name, header)
return(0);
(void)printf("%s:\n", header);
while ((ch = getc(fp)) != EOF)
vputc(lastc = ch);
if (ch != '\r')
vputc(lastc = ch);
if (lastc != '\n')
(void)putchar('\n');
(void)fclose(fp);