busybox/editors
Sören Tempel f26eb796e2 ed: fix current line number for file passed via the command-line
POSIX.1-2008 mandates the following regarding the file command-line
argument:

	If the file argument is given, ed shall simulate an e command
	on the file named by the pathname […]

The specification for the e command mandates the following behaviour
regarding the current line number in POSIX.1-2008:

	The current line number shall be set to the address of the last
	line of the buffer.

However, without this commit, busybox ed will set the current line
number to 1 if a file is given on the command-line and this file is not
empty (lastNum != 0). This is incorrect and fixed in this commit by not
modifying the current line number in ed_main(). As such, the current
line number will be zero for empty files and otherwise be set to the
address of the last line of the buffer.

function                                             old     new   delta
ed_main                                              144     128     -16

Signed-off-by: Sören Tempel <soeren+git@soeren-tempel.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-12-19 23:16:02 +01:00
..
awk.c awk: never return NULL from awk_printf() 2021-09-09 19:26:39 +02:00
cmp.c cmp: code shrink 2021-12-17 22:43:45 +01:00
Config.src restore documentation on the build config language 2018-06-06 15:16:48 +02:00
diff.c diff: code shrink 2021-02-22 19:00:07 +01:00
ed.c ed: fix current line number for file passed via the command-line 2021-12-19 23:16:02 +01:00
Kbuild.src switch editors/* to embedded-in-source kbuild system 2013-11-13 12:45:33 +01:00
patch_bbox.c libbb: reduce the overhead of single parameter bb_error_msg() calls 2019-07-02 11:35:03 +02:00
patch_toybox.c libbb: reduce the overhead of single parameter bb_error_msg() calls 2019-07-02 11:35:03 +02:00
patch.c help text: replace [OPTIONS] with actual options (if not too long) 2020-12-13 22:34:05 +01:00
sed1line.txt add sed mini-doc 2007-11-13 17:13:31 +00:00
sed_summary.htm doc: add info about sed s/.../.../I modifier 2008-03-01 19:29:56 +00:00
sed.c *: --help tweaks 2021-06-13 01:08:48 +02:00
vi.c vi: further changes to colon addresses 2021-08-29 20:07:20 +02:00