diff options
author | 2018-11-14 10:59:33 +0000 | |
---|---|---|
committer | 2018-11-14 10:59:33 +0000 | |
commit | 442efec3da5e5dc19d5771789ef01b92d773183a (patch) | |
tree | da6d5aa48278dc7bfcbb8aa560f8beab5156adcf /usr.bin/sed/process.c | |
parent | Add back part of the changes to takeover the firmware framebuffer on (diff) | |
download | wireguard-openbsd-442efec3da5e5dc19d5771789ef01b92d773183a.tar.xz wireguard-openbsd-442efec3da5e5dc19d5771789ef01b92d773183a.zip |
Make sed's -i flag more compatible with what gsed does.
- Reset the hold-space in between files
- quit the editor as soon as a 'q' command is found
- Make sure the temp-file is written back to the original file if we quit
the editor
temp-file not written back issue found by Time Chase.
Lots of feedback from millert@ and schwarze@
OK millert@
Diffstat (limited to 'usr.bin/sed/process.c')
-rw-r--r-- | usr.bin/sed/process.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/sed/process.c b/usr.bin/sed/process.c index 654cf758ab8..cc31fcb57a3 100644 --- a/usr.bin/sed/process.c +++ b/usr.bin/sed/process.c @@ -1,4 +1,4 @@ -/* $OpenBSD: process.c,v 1.33 2017/12/13 16:06:34 millert Exp $ */ +/* $OpenBSD: process.c,v 1.34 2018/11/14 10:59:33 martijn Exp $ */ /*- * Copyright (c) 1992 Diomidis Spinellis. @@ -196,6 +196,7 @@ redirect: if (!nflag && !pd) OUT(); flush_appends(); + finish_file(); exit(0); case 'r': if (appendx >= appendnum) { @@ -312,10 +313,13 @@ applies(struct s_command *cp) * Reset all inrange markers. */ void -resetranges(void) +resetstate(void) { struct s_command *cp; + free(HS.back); + memset(&HS, 0, sizeof(HS)); + for (cp = prog; cp; cp = cp->code == '{' ? cp->u.c : cp->next) if (cp->a2) cp->inrange = 0; |