[alt.sources] small bug in resent arc posting

michaele@vice.TEK.COM (Michael Enkelis) (04/16/88)

BSD4.3 unix on a VAX 11-780, Change arcusq.c
Michael Enkelis
503-627-4099

Feed me to patch

*** arcusq.c.orig	Fri Apr 15 13:31:51 1988
--- arcusq.c	Fri Apr 15 13:32:38 1988
***************
*** 50,56 ****
  get_int(f)			/* get an integer */
  	FILE           *f;	/* file to get it from */
  {
! 	return (getc_unp(f) | (getc_unp(f) << 8)) & 0xFFFF;
  }
  
  INT
--- 50,56 ----
  get_int(f)			/* get an integer */
  	FILE           *f;	/* file to get it from */
  {
! 	return ((getc_unp(f) << 8) | getc_unp(f)) & 0xFFFF;
  }
  
  INT
-- 
 _ _ _                          __
' ) ) )      /          /)     /  `       /      /)	Michael Enkelis
 / / / o _. /_  __. _  //     /--   __   /_  _  // o _ 	tektronix!vice!michaele
/ ' (_(_(__/ /_(_(_(<_(/_    (___, /) )_/ <_(<_(/_(_/_)_

bb@spdcc.COM (Brent Byer) (04/16/88)

In article <2460@vice.TEK.COM> michaele@vice.TEK.COM (Michael Enkelis) writes:
>BSD4.3 unix on a VAX 11-780, Change arcusq.c
>Michael Enkelis
>503-627-4099
>
>Feed me to patch

I suggest you don't.  (Unless it is Mr. Enkelis you feed to patch :-) )
				
>
>*** arcusq.c.orig	Fri Apr 15 13:31:51 1988
>--- arcusq.c	Fri Apr 15 13:32:38 1988
>***************
>*** 50,56 ****
>  get_int(f)			/* get an integer */
>  	FILE           *f;	/* file to get it from */
>  {
>! 	return (getc_unp(f) | (getc_unp(f) << 8)) & 0xFFFF;
>  }
>  
>  INT
>--- 50,56 ----
>  get_int(f)			/* get an integer */
>  	FILE           *f;	/* file to get it from */
>  {
>! 	return ((getc_unp(f) << 8) | getc_unp(f)) & 0xFFFF;
>  }
>
  
	Gaaack!   I am afraid that this is typical of the kind of
	garbage code I recall seeing in the initial posting of
	*nix 'arc' (the one that claimed to be for BSD; back in 1986).

	That original posting should never have been put on the wires.

	About a week later, Mike Stump ( csun!aeusemrs ) posted
	a much saner version which he had cobbled together for
	sysV.  Interestingly, his version required about 5 minutes
	effort to bring up on BSD, whereas the original one, which
	claimed to be for BSD was hopeless (example(s) above).
	It seems that the garbage one has prevailed.

	Some would say, "Don't look a gift horse in the mouth."
	But occasionally, you find that you're really looking
	at the horse's arsehole.  (Someone shaved it and taught
	the horse to walk backwards.)

	As much as I am impressed with the performance of Katz'
	PKARC (on DrOsS), we Unixoids had better get a comparable
	implementation here, or we should shift our support to
	Dhesi's ZOO.  While ZOO represents a completely different
	(ie incompat) storage format, I am confident that its
	implementation at least represents software engineering.

		"You can't learn to program;
		 either you know how or you don't."

	Sure, I'm feeling ornery tonight; I just gave those
	b?st?rds enough money for another Bolivian buy.

hyc@umix.cc.umich.edu (Howard Chu) (04/20/88)

Ah well... I was never one to appreciate compiler or system specific
side effects...  }-)  A more reliable fix is to replace the offending
line with something like:
	int xx;
	xx = getc_unp();
	xx |= getc_unp() << 8;
	return xx & 0xFFFF;

That's pretty much what I'm using in the "official" release version,
which will be out soon.