v04i088: Merged SysV/BSD echo

David MacKenzie edf at rocky2.rockefeller.edu
Sat Oct 1 16:08:27 AEST 1988


I didn't think it was possible to botch echo, but . . . somehow the
octal number escape came out broken.  below is a diff that corrects it.
As I seem to be the first one to post about it, this was obviously a
_very_ popular program . . . .

*** echo.c.old	Sat Oct  1 02:02:58 1988
--- echo.c	Sat Oct  1 02:03:35 1988
***************
*** 21,27 ****
   * \\		backslash
   *
   * David MacKenzie
!  * Latest revision: 08/07/88
   */
  
  #include <stdio.h>
--- 21,27 ----
   * \\		backslash
   *
   * David MacKenzie
!  * Latest revision: 10/01/88
   */
  
  #include <stdio.h>
***************
*** 65,71 ****
  		break;
  	    case '0':
  		for (i = n = 0, ++s; i < 3 && *s >= '0' && *s <= '7'; ++i, ++s)
! 		    n += *s - '0';
  		--s;
  		putchar(n);
  		break;
--- 65,71 ----
  		break;
  	    case '0':
  		for (i = n = 0, ++s; i < 3 && *s >= '0' && *s <= '7'; ++i, ++s)
! 		    n = n * 8 + *s - '0';
  		--s;
  		putchar(n);
  		break;
-----
David MacKenzie
Environmental Defense Fund
edf at rocky2.rockefeller.edu (...rutgers!cmcl2!rocky2!edf)



More information about the Comp.sources.bugs mailing list