summaryrefslogtreecommitdiffstats
path: root/usr.bin/more
diff options
context:
space:
mode:
authorhoek <hoek@FreeBSD.org>1999-04-29 18:03:38 +0000
committerhoek <hoek@FreeBSD.org>1999-04-29 18:03:38 +0000
commit8a895b7c3427d09f8666f86280b3e4830ecd6ade (patch)
tree60da8f844eb0aa1ca6e191fd66b8283cb3e233e9 /usr.bin/more
parent9b7add1cb84e1329fdea5d5fbc3d202c9e55cbfb (diff)
downloadFreeBSD-src-8a895b7c3427d09f8666f86280b3e4830ecd6ade.zip
FreeBSD-src-8a895b7c3427d09f8666f86280b3e4830ecd6ade.tar.gz
Remove documentation of CRLF bug from more.1. Sync code with manpage.
PR: bin/961 bin/7296 (fix) Submitted by: Garance Alistair Drosehn <gad@eclipse.acs.rpi.edu>
Diffstat (limited to 'usr.bin/more')
-rw-r--r--usr.bin/more/ch.c27
-rw-r--r--usr.bin/more/more.15
-rw-r--r--usr.bin/more/output.c12
3 files changed, 18 insertions, 26 deletions
diff --git a/usr.bin/more/ch.c b/usr.bin/more/ch.c
index 3e402cc..6dccea7 100644
--- a/usr.bin/more/ch.c
+++ b/usr.bin/more/ch.c
@@ -101,7 +101,6 @@ static off_t last_piped_pos;
static
fch_get()
{
- extern int bs_mode;
register struct buf *bp;
register int n, ch;
register char *p, *t;
@@ -187,28 +186,10 @@ read_more:
bp->data[bp->datasize++] = EOI;
}
- if (bs_mode) {
- for (p = &bp->data[bp->datasize]; --n >= 0;) {
- *--p;
- if (*p == EOI)
- *p = 0200;
- }
- }
- else {
- for (t = p; --n >= 0; ++p) {
- ch = *p;
- if (ch == '\r' && n && p[1] == '\n') {
- ++p;
- *t++ = '\n';
- }
- else
- *t++ = (ch == EOI) ? 0200 : ch;
- }
- if (p != t) {
- bp->datasize -= p - t;
- if (ispipe)
- last_piped_pos -= p - t;
- }
+ for (p = &bp->data[bp->datasize]; --n >= 0;) {
+ *--p;
+ if (*p == EOI)
+ *p = 0200;
}
found:
diff --git a/usr.bin/more/more.1 b/usr.bin/more/more.1
index 2289fe8..8ed2d71 100644
--- a/usr.bin/more/more.1
+++ b/usr.bin/more/more.1
@@ -122,7 +122,7 @@ adjacent to an underscore character are displayed as underlined text.
Backspaces which appear between two identical characters are displayed
as emboldened text.
.Dv CR-LF
-sequences are compressed to a single linefeed
+sequences are compressed to a single newline
character. The
.Fl u
option causes backspaces to always be displayed as
@@ -289,8 +289,7 @@ characteristics necessary to manipulate the screen.
.Xr ctags 1 ,
.Xr vi 1
.Sh BUGS
-Incorrect output can result from omitting the -u flag when accessing regular
-files with CRLF line termination.
+Reading files with long lines is slow.
.Sh AUTHORS
This software is derived from software contributed to Berkeley
by
diff --git a/usr.bin/more/output.c b/usr.bin/more/output.c
index 0d01550..80884c9 100644
--- a/usr.bin/more/output.c
+++ b/usr.bin/more/output.c
@@ -47,6 +47,7 @@ static char sccsid[] = "@(#)output.c 8.1 (Berkeley) 6/6/93";
int errmsgs; /* Count of messages displayed by error() */
+extern int bs_mode;
extern int sigs;
extern int sc_width, sc_height;
extern int ul_width, ue_width;
@@ -116,6 +117,17 @@ put_line()
putbs();
column--;
break;
+ case '\r':
+ /* treat \r\n sequences like \n if -u flag not set. */
+ if (bs_mode || p[1] != '\0')
+ {
+ /* -u was set, or this CR is not a CRLF, so
+ * treat this CR like any other control_char */
+ putchr('^');;
+ putchr(CARAT_CHAR(c));
+ column += 2;
+ }
+ break;
default:
if (c == 0200 || CONTROL_CHAR(c))
{
OpenPOWER on IntegriCloud