summaryrefslogtreecommitdiff
path: root/sys/src/cmd/sed.c
diff options
context:
space:
mode:
authoraiju <devnull@localhost>2018-11-05 20:17:48 +0000
committeraiju <devnull@localhost>2018-11-05 20:17:48 +0000
commit1d0f8a7e512e5abfea9c5d2fdf2fb4c05efc720b (patch)
treedc0fa106676d0f6136670c6f95630240a06ac2a8 /sys/src/cmd/sed.c
parenta86de839ca16c1d12780d3dcf245b8db81ac21cb (diff)
sed: only dollars as first address are a problem for -u
Diffstat (limited to 'sys/src/cmd/sed.c')
-rw-r--r--sys/src/cmd/sed.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/src/cmd/sed.c b/sys/src/cmd/sed.c
index 914aab7f3..46d3cad6a 100644
--- a/sys/src/cmd/sed.c
+++ b/sys/src/cmd/sed.c
@@ -96,7 +96,7 @@ SedCom pspace[MAXCMDS]; /* Command storage */
SedCom *pend = pspace+MAXCMDS; /* End of command storage */
SedCom *rep = pspace; /* Current fill point */
-int dollars; /* Number of dollar addresses */
+int dollars; /* Number of dollar (first) addresses */
Reprog *lastre; /* Last regular expression */
Resub subexp[MAXSUB]; /* sub-patterns of pattern match*/
@@ -290,6 +290,8 @@ comploop:
address(&rep->ad1);
if (rep->ad1.type != A_NONE) {
+ if (rep->ad1.type == A_DOL)
+ dollars++;
if (rep->ad1.type == A_LAST) {
if (!lastre)
quit("First RE may not be null");
@@ -765,10 +767,9 @@ address(Addr *ap)
int c;
long lno;
- if((c = *cp++) == '$'){
+ if((c = *cp++) == '$')
ap->type = A_DOL;
- dollars++;
- }else if(c == '/') {
+ else if(c == '/') {
seof = c;
if (ap->rp = compile())
ap->type = A_RE;