static int UpdateHdr (char *output) { extern int status; Hdr phdr; /* primary header */ IODescPtr im; /* descriptor for output image */ int PutKeyBool (Hdr *, char *, Bool, char *); sprintf(MsgText, "Trying to open %s...",output); trlmessage (MsgText); initHdr (&phdr); /* Open input image in order to read its primary header. */ im = openUpdateImage (output, "", 0, &phdr); if (hstio_err()) { trlopenerr (output); closeImage(im); return (status = OPEN_FAILED); } if (PutKeyBool (&phdr, "ASN_PROD", True, "") ) { freeHdr (&phdr); trlerror ("Couldn't update ASN_PROD keyword in ASN table header"); return(status = KEYWORD_MISSING); } /* write out primary header */ if (putHeader (im)) status = HEADER_PROBLEM; if (hstio_err() || status) { trlreaderr (output); closeImage (im); return (status = OPEN_FAILED); } closeImage (im); /* Close the ASN table's primary header. */ freeHdr (&phdr); sprintf(MsgText, "Updated Global Header for %s...",output); trlmessage (MsgText); return (status); }
int LoadHdr (char *input, Hdr *phdr) { extern int status; IODescPtr im; /* descriptor for input image */ sprintf(MsgText, "Trying to open %s...",input); trlmessage (MsgText); /* Open input image in order to read its primary header. */ im = openInputImage (input, "", 0); if (hstio_err()) { trlopenerr (input); return (status = OPEN_FAILED); } initHdr (phdr); /* get primary header */ if (getHeader (im, phdr) ) status = HEADER_PROBLEM; if (hstio_err() || status) { trlreaderr (input); closeImage (im); freeHdr (phdr); return (status = OPEN_FAILED); } closeImage (im); sprintf(MsgText, "Read in Primary header from %s...",input); trlmessage (MsgText); return (status); }