Jan Stary wrote:
> Why do we need to trim the newlines in unexpand(1)?
> The result seems to be the same without it.
> 
>       Jan
> 
> 
> Index: unexpand.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/unexpand/unexpand.c,v
> retrieving revision 1.12
> diff -u -p -r1.12 unexpand.c
> --- unexpand.c        11 Nov 2015 02:52:46 -0000      1.12
> +++ unexpand.c        10 Oct 2016 17:58:40 -0000
> @@ -72,10 +72,6 @@ main(int argc, char *argv[])
>                       argc--, argv++;
>               }
>               while (fgets(genbuf, BUFSIZ, stdin) != NULL) {
> -                     for (cp = linebuf; *cp; cp++)
> -                             continue;
> -                     if (cp > linebuf)
> -                             cp[-1] = 0;

this really looks like a bug using the wrong variable. genbuf and linebuf are
different arrays. 

Reply via email to