[fitsbits] CFITSIO, IRAF format, and HP-UX

Stephen Walton swalton at sfo.csun.edu
Mon Aug 14 19:27:31 EDT 2000


William Pence wrote:

> I don't have a HP system available to test on, so will send you some
> suggestions off-line for tracking down the cause of this problem.
>
> Stephen Walton wrote:
> > [basically that ftopen/ffopen segfault on HP-UX when opening IRAF
> >  format images.]

Thanks to Bill's off-line suggestions, I tracked the problem down. It is
not HP-UX specific, but was dependent on the ordering of items in
memory.  Bill will include my fix in the next version of CFITSIO, but
here is the context diff for anyone who needs it now:

*** iraffits.c  Tue Jun 20 11:30:41 2000
--- /home/swalton/src/cfitsio/iraffits.c        Mon Aug 14 11:44:39 2000
***************
*** 1397,1402 ****
--- 1397,1406 ----
      if (pval == NULL)
        return (pval);
  
+     /* Return NULL if keyword is first word in header */
+     if (pval == hstring)
+         return (NULL);
+ 
      /* Find last nonblank line before requested keyword */
      bval = pval - 80;
      while (!strncmp (bval,"        ",8))

A few words of explanation:  This is in static routine blsearch, which
returns a pointer to the location of the first blank line before the
given keyword in an already-filled-in FITS header.  If the keyword is
the first one in the header, the routine erroneously checked in memory
_before_ the header for 8 blanks in a row, which were there in the HP-UX
version of my test program as luck would have it.  The fix: return NULL
if the keyword appears first in the header.

--
Stephen Walton, Professor, Dept. of Physics & Astronomy, Cal State
Northridge
stephen.walton at csun.edu




More information about the fitsbits mailing list