[comp.os.minix] Bug fix to commands/fix.c

nick@nswitgould.OZ (Nick Andrew) (11/03/87)

	This is a fix to fix to allow it to process insertions before
the first line of a file. The fix also 'clarifies' (my opinion) the error
messages produced by fix.

	To reproduce the bug, create a diff file for any old file beginning
with:

0a1,3
> ......
> ......
> ......

	The original fix didn't allow counts of zero.

Here's the diff to commands/fix.c:

43c43
< #define copy(str) printf("%s", str)
---
> #define copy(str) fputs(str,stdout);
60a61
> 
69c70
< 				fatal("delete count conflict");
---
> 				fatal("delete count conflict n1 != n2");
75c76
< 					fatal("illegal delete line");
---
> 					fatal("no < in delete line");
77c78
< 					fatal("delete line conflict");
---
> 					fatal("delete line mismatch");
83c84
< 				fatal("illegal separator in chunk");
---
> 				fatal("no --- at end of change chunk");
88,90c89,93
< 					fatal("append count conflict");
< 				copy(getline(fpf, obuf));
< 				here++;
---
> 					fatal("append count conflict o1 != o2");
> 				if (o1) {
> 					copy(getline(fpf, obuf));
> 					here++;
> 				}
94c97
< 					fatal("illegal append line");
---
> 					fatal("no > in append line");
128c131
< 	if (v1 == 0 || v2 == 0 || v1 > v2)
---
> 	if (v1 > v2)


ACSnet:    nick@nswitgould.oz
UUCP:      ...uunet!munnari!nswitgould.oz!zeta
Fidonet:   [3:713/602]
ACSgate:   nick@zeta.fido (in development)

"Anything that is moral for a group to do is moral for one person to do"
			- Clark Fries in Heinlein's "Podkayne of Mars".