diff options
author | Pedro F. Giffuni <pfg@FreeBSD.org> | 2017-07-03 15:54:44 +0000 |
---|---|---|
committer | Pedro F. Giffuni <pfg@FreeBSD.org> | 2017-07-03 15:54:44 +0000 |
commit | be9e8bfaea0093d7612b7ee5b357c5f70f1b7463 (patch) | |
tree | 012dfee211b8a98a7a9ac450cd0b4be4946667ae /bin/ed | |
parent | 5567474c4a6551e911009e6eb80bf599bc20ae2c (diff) | |
download | src-test-be9e8bfaea0093d7612b7ee5b357c5f70f1b7463.tar.gz src-test-be9e8bfaea0093d7612b7ee5b357c5f70f1b7463.zip |
ed(1): Allow the omission of one address in (.,.) and (.;.) address ranges
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.
Also, piping to a shell command does not count as a save, so don't reset
the modified flag.
Obtained from: OpenBSD (CVS Rev. 1.58, 1.59)
Notes
Notes:
svn path=/head/; revision=320603
Diffstat (limited to 'bin/ed')
-rw-r--r-- | bin/ed/main.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/bin/ed/main.c b/bin/ed/main.c index 6cb7d03364d0d..babffa813088e 100644 --- a/bin/ed/main.c +++ b/bin/ed/main.c @@ -350,7 +350,8 @@ next_addr(void) ibufp++; addr_cnt++; second_addr = (c == ';') ? current_addr : 1; - addr = addr_last; + if ((addr = next_addr()) < 0) + addr = addr_last; break; } /* FALLTHROUGH */ @@ -809,7 +810,7 @@ exec_command(void) if ((addr = write_file(*fnp ? fnp : old_filename, (c == 'W') ? "a" : "w", first_addr, second_addr)) < 0) return ERR; - else if (addr == addr_last) + else if (addr == addr_last && *fnp != '!') modified = 0; else if (modified && !scripted && n == 'q') gflag = EMOD; |