diff options
author | ache <ache@FreeBSD.org> | 1997-03-17 17:07:39 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1997-03-17 17:07:39 +0000 |
commit | e528107672ed8e30ad612b4b33599e0237ddb8a8 (patch) | |
tree | a4a6e4dfae4628b0a6eb087c7d094fe1375d434b | |
parent | d6d561981e80ff9eec40ff71d36e99a0e79f3634 (diff) | |
download | FreeBSD-src-e528107672ed8e30ad612b4b33599e0237ddb8a8.zip FreeBSD-src-e528107672ed8e30ad612b4b33599e0237ddb8a8.tar.gz |
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
-rw-r--r-- | usr.bin/finger/lprint.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/finger/lprint.c b/usr.bin/finger/lprint.c index 847f26d..9ab0673 100644 --- a/usr.bin/finger/lprint.c +++ b/usr.bin/finger/lprint.c @@ -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); |