Date: Mon, 3 Jul 2017 15:54:45 +0000 (UTC) From: "Pedro F. Giffuni" <pfg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320603 - head/bin/ed Message-ID: <201707031554.v63Fsjvg074071@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pfg Date: Mon Jul 3 15:54:44 2017 New Revision: 320603 URL: https://svnweb.freebsd.org/changeset/base/320603 Log: 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) Modified: head/bin/ed/main.c Modified: head/bin/ed/main.c ============================================================================== --- head/bin/ed/main.c Mon Jul 3 15:34:21 2017 (r320602) +++ head/bin/ed/main.c Mon Jul 3 15:54:44 2017 (r320603) @@ -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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201707031554.v63Fsjvg074071>