Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!munnari!neumann!csadfa!lpb
From: lpb@csadfa.oz (Lawrie Brown)
Newsgroups: comp.sources.bugs
Subject: Re: v12i071:  StarChart program and Yale star data, Part01/07
Message-ID: <1238@csadfa.oz>
Date: Wed, 2-Dec-87 17:46:25 EST
Article-I.D.: csadfa.1238
Posted: Wed Dec  2 17:46:25 1987
Date-Received: Mon, 7-Dec-87 00:12:22 EST
References: <3634@uunet.UU.NET>
Organization: Dept. of Computer Science, University College, UNSW, ADFA, Canberra, Australia
Lines: 88

> Submitted-by: awpaeth@watcgl.waterloo.edu (Alan W. Paeth)
> Posting-number: Volume 12, Issue 71
> Archive-name: starchart/part01
> 
	Whilst installing this software, I discovered two bugs:

 - The first appears to be a dropped 0 in the declaration ras in chartlegend(),
	which meant that another output buffer got hit. Fix by correcting
	array size to 20 not 2.
 - The second in in the scanning of RA, DE, & SC values in findconst(), the
	method used failed on the Pyramid (I assume due to byte order).
	Fix by using "%lf" to scan the doubles directly.

	Anyway, below is a patch file to install the two fixes I used.
	(It replaces an earlier cancelled posting in which I managed to zap
	the hh.mm handling of the ra & de values - sorry).

	Regards
	Lawrie Brown.
----
Mr. Lawrie Brown,		Phone ISD:   +61 62 688167   Fax: +61 62 470702
Dept. Computer Science,		Telex:	     ADFADM AA62030
University College, UNSW,	ACSNET/CSNET:	lpb@csadfa.oz
Aust. Defence Force Academy,	UUCP:		...!uunet!munnari!csadfa.oz!lpb
Canberra. ACT 2600.		ARPA:		lpb%csadfa.oz@uunet.uu.net
AUSTRALIA			JANET:		lpb@oz.csadfa
				Other Gateways:	see CACM 29(10) Oct. 1986

---------- Patch file, cut here ----------
*** starchart.old.c	Wed Dec  2 17:40:49 1987
--- starchart.c	Thu Dec  3 09:34:47 1987
***************
*** 36,41
   !
   ! Final integration by the original author [c].
   ! Questions, suggestions, and fixes should be e-mailed to him.
   */
  
  #include 

--- 36,46 -----
   !
   ! Final integration by the original author [c].
   ! Questions, suggestions, and fixes should be e-mailed to him.
+  !
+  !	Fixes:
+  !		L. Brown  2/12/87
+  !			- fixed bad ras decl in chartlegend()
+  !			- fixed bad double scanf in findconst()
   */
  
  #include 
***************
*** 240,246
  chartlegend(chart)
      map chart;
      {
!     char ras[2], dls[20], outstr[40];
      if (!title) title = "LEGEND";
      rastr(ras, chart->racen);
      declstr(dls, chart->dlcen);

--- 245,251 -----
  chartlegend(chart)
      map chart;
      {
!     char ras[20], dls[20], outstr[40];
      if (!title) title = "LEGEND";
      rastr(ras, chart->racen);
      declstr(dls, chart->dlcen);
***************
*** 754,760
  	if (feof(cfile)) break;
  	if (strncmp(tag, cbuf, taglen) == 0)	/* FOUND */
  	    {	
! 	    sscanf(cbuf, "%*5s%f%f%f %[^\n]", &ra, &de, &sc, legend);
  	    ra    = ftod(ra);
  	    de    = ftod(de);
  	    if ((newline=index(legend, '\n')) != 0) *newline = '\0';

--- 759,765 -----
  	if (feof(cfile)) break;
  	if (strncmp(tag, cbuf, taglen) == 0)	/* FOUND */
  	    {	
! 	    sscanf(cbuf, "%*5s%lf%lf%lf %[^\n]", &ra, &de, &sc, legend);
  	    ra    = ftod(ra);
  	    de    = ftod(de);
  	    if ((newline=index(legend, '\n')) != 0) *newline = '\0';