summaryrefslogtreecommitdiff
path: root/bin/ed
AgeCommit message (Collapse)Author
2018-06-19Revert previous, there were some unintended beviour changes.Martijn van Duren
2018-06-18Remove the parse_char_class and let regcomp determine if our bracketsMartijn van Duren
are balanced. OK millert@ and tb@
2018-06-15Remove references to BACKWARDS.Martijn van Duren
OK tb@
2018-06-15Make sure we always return more than a single '!' in get_shell_command.Martijn van Duren
This is similar to what vi/ex does and removes the final BACKWARDS flag. Behaviour requested by and OK tb@
2018-06-15Remove the non-BACKWARDS option for GET_THIRD_ADDR. No change to currentMartijn van Duren
behaviour. OK tb@
2018-06-04Remove the extra pager code when compiled without the BACKWARDS flag.Martijn van Duren
Most terminals have scrollback options, or can be achieved via tmux, so it's not needed. OK millert@
2018-06-04Definitively choose the existing semantics for the scroll and null command.Martijn van Duren
POSIX states: "An empty command list shall be equivalent to the p command", so changing the behaviour of a null-command in any other case is a violation of POSIX. OK millert@
2018-05-24Fail earlier if we don't have a current filename. This simlifies theMartijn van Duren
code and removes a few BACKWARDS flags. OK otto@
2018-04-26Make ed's 'l' command end lines with a '$' and make sure that literalMartijn van Duren
'$' characters are escaped, so that we are POSIX compliant. The omission of trailing '$' was originally hidden behind a BACKWARDS flag. This flag was most likely introduced to be compatible with 4.4BSD. Thanks to naddy@ for pointing me to the 4.4BSD ed implementation. I tried to trace the origin and enabling of the BACKWARDS flag, since both FreeBSD and NetBSD have the flag, but only FreeBSD doesn't have it enabled. Both projects had an alm@ working on ed during 1993-1995 during which he added this flag to both projects and only enabled it on NetBSD, but I wasn't able to reach him on any known address. Thanks to Ed Schouten (ed@freebsd), and Michael W. Lucas of the ed Mastery book for helping me trying to locate Andrew Moore. Problem originally prodded by garzon.lucero@gmail.com and later independently re-requested by n.reusse@hxgn.net. OK tb@, guenther@, and mwl@mwl.io
2018-02-26Make ed(1) warn about modifications if 'r'ead in an empty file andMartijn van Duren
trying to quit. Diff from Tim Chase OK tb@ and millert@
2018-01-09Rename test file =.err to eq.err for simpler make file scripts.Alexander Bluhm
2017-07-05nits about trailing punctuation found with mandoc -TlintIngo Schwarze
2017-04-26silence clang warnings: add an extra pair of parentheses and stopChristian Weisgerber
passing empty format strings to printf-family functions; ok millert@
2017-01-03Allow the omission of one address in (.,.) and (.;.) address rangesTheo Buehler
as per POSIX. With this patch, ",n" is an abbreviation for "1,n", ";n" abbreviates ".;n". The "n," and "n;" variants mean "n,n" and "n;n", respectively. Patch from Jerome FRGAGIC; ok stefan, deraadt
2016-10-11Reimplement g flag for s commands. Got lost in previous commit.Martijn van Duren
Found because of a hint by and OK schwarze@.
2016-10-10Remove infinite loop detection from the s-command.Martijn van Duren
If a zero-length match is found do the replacement and increment the start point for the next search by one. This allows for commands like s/^/- / This brings the behaviour closer to the way sed and vi work. OK schwarze@
2016-09-23remove the note about the list command (l) displaying a --More--Jason McIntyre
prompt for huge lines (according to otto this happens only when BACKWARDS is not defined); ok otto
2016-08-16Piping to a shell command does not count as a save, so don't reset theMartin Natano
modified flag. from Jerome Frgacic (jerome.frgacic (at) yahoo.fr) ok tb
2016-08-02Fix the begin of word bug in s-command, similar to sed.Martijn van Duren
nit fix and OK schwarze@
2016-03-27actually remove unnecessary includesMichael McConville
from Edgar Pettijohn, ok and with input from tb@
2016-03-22header cleanupmmcc
from Edgar Pettijohn, correction from deraadt@
2015-11-20honestly i think you should just zap that paragraph - it doesn;t maketb
sense to document that posix more or less says something should happen, and that it does. jmc
2015-11-20make ed restore the user defined prompt (specified with -p) when it was turnedtb
off and then on again with 'P'. ok daniel@
2015-10-25POSIX says that you can't capture the return value of sigsetjmp().Philip Guenther
Fortunately, we don't need it as we only pass siglongjmp() a single value. ok deraadt@
2015-10-21Style fixes; from Ilya KalimanTodd C. Miller
2015-10-09The variable errmsg can be static in main.c if code in re.c uses an ownTobias Stoeckmann
buffer to construct error messages. with input by and ok millert@
2015-10-09Define functions as static when they are not used outside their own c-files.Tobias Stoeckmann
ok millert@
2015-10-09Mark static globals that are only used in their respective .c files.Todd C. Miller
Also make stdin unbuffered since that is the same as using a single-byte buffer. OK tobias@
2015-10-09Change all tame callers to namechange to pledge(2).Theo de Raadt
2015-10-07tame "stdio rpath wpath cpath proc exec tty". proc and exec because edTheo de Raadt
it is a shell (it has a !command). tty because it uses TIOCGWINSZ in a SIGWINCH handler.
2015-10-04Remove useless pattern_t typedef, POSIX regex is here to stay soTodd C. Miller
just use regex_t directly.
2015-10-04Remove #ifdefs for non-POSIX systems. Also remove #ifdef forTodd C. Miller
SIGWINCH, it is not POSIX but it is a defacto standard. OK deraadt@
2015-09-14Avoid .Ns right after .Pf, it's pointless.Ingo Schwarze
In some cases, do additional cleanup in the immediate vicinity.
2015-07-28remove gratuitous castsTheo de Raadt
2015-07-14use atomic operations on sig_atomic_t variables inside the signal handlers,Theo de Raadt
rather than sharing one variable unsafely. ok millert
2015-07-11XXX annotate another signal raceTheo de Raadt
2015-06-22theo buehler points out that posix specifies a prompt defined using -pJason McIntyre
be reinstated when toggled off then on again; this seems to make sense, but posix is not explicit. we know that gnu ed and freebsd do reinstate the user defined prompt, but we do not. no one has yet stepped up to change this, so i'm adding a note to this effect until such a time as we do/ i have not tweaked the text for -p or "P" to allow for an easy back out if behaviour does change;
2015-01-16Replace <sys/param.h> with <limits.h> and other less dirty headers whereTheo de Raadt
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
2014-12-04document some more commands that are POSIX extensions. ok jmc@Daniel Dickman
2014-12-04Allow POSIX 0i; from Jeremy Mates.Daniel Dickman
Tested to match gnu by sobrado@; on solaris you probably need to use xpg6 utils to get this behaviour. ok krw@, deraadt@.
2014-12-02Remove prototypes for functions that were already removed.Todd C. Miller
From Benjamin Scher Purcell.
2014-12-02The t.t test is missing and so the t.* test is not being run.Daniel Dickman
Reconstruct a passing t.t based on the input data (t.d) and the expected result (t.r).
2014-11-26Prefer setvbuf() to setlinebuf() for portability; ok deraadt@Todd C. Miller
2014-11-26document in STANDARDS that we do not mark eols with $;Jason McIntyre
originally reported by ezequiel garz?n
2014-11-20remove sys/file.h includes in favor of fcntl.h where needed.Ted Unangst
ok deraadt guenther
2014-07-12If a constant string needs a name, use a static const array insteadPhilip Guenther
of a pointer or non-const array, as that minimizes the symbols, maximizes the placement into read-only memory, and avoids warnings from gcc -Wformat=2 when they're used as format strings.
2014-05-24delete restricted ed. no one will ever use this. never documented or enabled.Daniel Dickman
ok millert@
2014-05-18use reallocarrayMarc Espie
okay miod@, millert@
2014-04-20Remove more commentary about recently removed des supportTheo de Raadt
from Daniel Dickman
2014-04-14more x removal;Jason McIntyre