changelog shortlog tags branches files raw gz bz2 help

Mercurial > hg > plan9front / changeset: sed: only dollars as first address are a problem for -u

changeset 6864: f3a4d3232a3d
parent 6863: a3c7b36f7225
child 6866: 9781f1a24395
author: aiju
date: Mon, 05 Nov 2018 20:17:48 +0000
files: sys/src/cmd/sed.c
description: sed: only dollars as first address are a problem for -u
     1.1--- a/sys/src/cmd/sed.c
     1.2+++ b/sys/src/cmd/sed.c
     1.3@@ -96,7 +96,7 @@ SedCom pspace[MAXCMDS];			/* Command sto
     1.4 SedCom *pend = pspace+MAXCMDS;		/* End of command storage */
     1.5 SedCom *rep = pspace;			/* Current fill point */
     1.6 
     1.7-int	dollars;			/* Number of dollar addresses */
     1.8+int	dollars;			/* Number of dollar (first) addresses */
     1.9 
    1.10 Reprog	*lastre;			/* Last regular expression */
    1.11 Resub	subexp[MAXSUB];			/* sub-patterns of pattern match*/
    1.12@@ -290,6 +290,8 @@ comploop:
    1.13 
    1.14 		address(&rep->ad1);
    1.15 		if (rep->ad1.type != A_NONE) {
    1.16+			if (rep->ad1.type == A_DOL)
    1.17+				dollars++;
    1.18 			if (rep->ad1.type == A_LAST) {
    1.19 				if (!lastre)
    1.20 					quit("First RE may not be null");
    1.21@@ -765,10 +767,9 @@ address(Addr *ap)
    1.22 	int c;
    1.23 	long lno;
    1.24 
    1.25-	if((c = *cp++) == '$'){
    1.26+	if((c = *cp++) == '$')
    1.27 		ap->type = A_DOL;
    1.28-		dollars++;
    1.29-	}else if(c == '/') {
    1.30+	else if(c == '/') {
    1.31 		seof = c;
    1.32 		if (ap->rp = compile())
    1.33 			ap->type = A_RE;