lpb@csadfa.oz (Lawrie Brown) (12/03/87)
> 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 <stdio.h> --- 36,46 ----- ! ! Final integration by the original author [c]. ! Questions, suggestions, and fixes should be e-mailed to him. + ! + ! Fixes: + ! L. Brown <lpb@csadfa.oz> 2/12/87 + ! - fixed bad ras decl in chartlegend() + ! - fixed bad double scanf in findconst() */ #include <stdio.h> *************** *** 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';
tml@santra.UUCP (Tor Lillqvist) (12/04/87)
*** starchart.c~ Thu Dec 3 15:06:48 1987 --- starchart.c Thu Dec 3 18:54:23 1987 *************** *** 758,764 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'; --- 758,764 ----- 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'; -- Tor Lillqvist, Technical Research Centre of Finland tml@fingate.bitnet == tml@santra.uucp == mcvax!santra!tml