trivial, but annoying, bug in tail
utzoo!decvax!ittvax!shp
utzoo!decvax!ittvax!shp
Wed Dec 15 09:47:46 AEST 1982
[ ] The tail command does not work properly when copying begins at a
distance + number from the beginning and number is less than 10.
If copying lines, and the file has less than 10 lines in it,
nothing would be printed.
The reason for this is that the default use of tail is to copy
from the end of the file, and if no distance is given, the
distance is set to 10 (otherwise nothing would be printed).
The fix is:
================================================================
diff /usr/src/cmd/tail.c /usr/new/src/cmd/tail/tail.c
49,50c49,52
< n = 0;
< while(isdigit(*arg))
---
> n = -1;
> while(isdigit(*arg)) {
> if (n == -1)
> n = 0;
52,53c54
< if(!fromend&&n>0)
< n--;
---
> }
88c89
< if (n==0) n = 10;
---
> if (n == -1 && fromend) n = 10;
Sam Praul
...!decvax!ittvax!shp
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list