Hi there,
the 'l' command in base ed currently does not mark the end of line with a '$'.
This is documented in the man page (POSIX wants each '$' escaped, and a final
'$' at EOL). Interestingly, the code to mark EOL is already there, just hidden
by the BACKWARDS flag ed is compiled with. Here is a small diff that removes
the BACKWARDS guard around the EOL marker. The resulting behavior is equal to
GNU ed, base vi and vim (:set list).
Removing the BACKWARDS flag would fix it as well, but i don't see the need for
that. There is some code that could be deleted in that case, though (mostly
different error messages).
Any comments?
Kind regards
Nils
Index: ed.1
===================================================================
RCS file: /cvs/src/bin/ed/ed.1,v
retrieving revision 1.69
diff -u -p -r1.69 ed.1
--- ed.1 5 Jul 2017 12:23:46 -0000 1.69
+++ ed.1 27 Feb 2018 10:11:52 -0000
@@ -24,7 +24,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd $Mdocdate: July 5 2017 $
+.Dd $Mdocdate: February 27 2018 $
.Dt ED 1
.Os
.Sh NAME
@@ -812,13 +812,10 @@ The
.St -p1003.1-2008
specification says the
.Ic l
-command should mark the ends of lines with a
-.Sq $
-character,
-and that
+command should precede
.Sq $
characters
-within the text should be output preceded by a backslash;
+within the text by a backslash;
this implementation does not support that.
.Sh HISTORY
An
Index: io.c
===================================================================
RCS file: /cvs/src/bin/ed/io.c,v
retrieving revision 1.20
diff -u -p -r1.20 io.c
--- io.c 26 Apr 2017 21:25:43 -0000 1.20
+++ io.c 27 Feb 2018 10:11:52 -0000
@@ -348,10 +348,8 @@ put_tty_line(char *s, int l, int n, int
} else
putchar(*s);
}
-#ifndef BACKWARDS
if (gflag & GLS)
putchar('$');
-#endif
putchar('\n');
return 0;
}