# include "fits.h"

/******************** fits create header ***********************************/
int fits_create_header (Header *header) {

  int i;
  char axis[10];
  
  header[0].size = 2880;
  ALLOCATE (header[0].buffer, char, 2880);

  for (i = 0; i < 2880; i++) 
    header[0].buffer[i] = ' ';
  strncpy (header[0].buffer, "END", 3);

  fits_modify (header, "SIMPLE", "%t", 1, header[0].simple);
  fits_modify (header, "BITPIX", "%d", 1, header[0].bitpix);
  fits_modify (header, "NAXIS",  "%d", 1, header[0].Naxes);
				       
  for (i = 0; i < header[0].Naxes; i++) {
    sprintf (axis, "NAXIS%d", i + 1);
    fits_modify (header,  axis, "%d", 1, header[0].Naxis[i]);
  }

  /* PCOUNT & GCOUNT are not implemented, but they are required to be here */
  fits_modify (header, "PCOUNT", "%d", 1, 0);
  fits_modify (header, "GCOUNT", "%d", 1, 1);
  fits_modify (header, "BSCALE", "%lf", 1, header[0].bscale);
  fits_modify (header, "BZERO",  "%lf", 1, header[0].bzero);
  fits_modify (header, "EXTEND", "%t",  1, header[0].extend);
  return (TRUE);

}	


