important fix to vc

Andrew F. Seirup afs at bunker.UUCP
Fri Mar 15 01:42:34 AEST 1985


   The fix to the ^J function in vc that I posted a while back has at least
two very serious bugs in it.  The ^J fix that Mitch Bradly posted works
correctly, but if you try to install it after installing my fix, it dumps
core.  Since a diff is therfore useless, I am including the code in question
(about 35 lines) in its entirity.  If you installed my fix, you MUST replace
the code (it only looks like it works).  If you installed Mitch's fix, and
you don't get core dumps, you should be ok.  If you get nothing but core dumps
no matter what, check if your compiler handles structure assignment (a = b,
where both a and b are structures, and the entire contents of b is copied).

Andrew Seirup - Bunker Ramo, Trumbull CT - (203)386-2086 
uucp address:  {decvax|ittvax}!bunker!afs



>From file interp.c:

struct enode *copye (e, Rdelta, Cdelta)
register struct enode *e; {
    register struct enode *ret;
    if (e==0) ret = 0;
    else {
	ret = (struct enode *) calloc (1,sizeof (struct enode));
	*ret = *e;
	switch (ret->op) {
	case 'v':
		ret->e.v = lookat (ret->e.v->row+Rdelta, ret->e.v->col+Cdelta);
		break;
	case 'k':
		break;
	case 'f':
		ret->e.o.right = copye (ret->e.o.right,0,0);
		break;
	case O_REDUCE('+'):
	case O_REDUCE('*'):
		(struct ent *) ret->e.o.right =
		   lookat (
		          ((struct ent *)ret->e.o.right)->row+Rdelta,
		          ((struct ent *)ret->e.o.right)->col+Cdelta
		   );
		(struct ent *) ret->e.o.left =
		   lookat (
		          ((struct ent *)ret->e.o.left)->row+Rdelta,
		          ((struct ent *)ret->e.o.left)->col+Cdelta
		   );
		break;
	default:
		ret->e.o.right = copye (ret->e.o.right,Rdelta,Cdelta);
		ret->e.o.left = copye (ret->e.o.left,Rdelta,Cdelta);
		break;
	}
    }
    return ret;
}



More information about the Comp.sources.bugs mailing list