# include <ohana.h>
# include <gfitsio.h>

/*********************** fits copy header ***********************************/
int gfits_copy_matrix (Matrix *matrix1, Matrix *matrix2) {

  int i;

  matrix2[0].unsign = matrix1[0].unsign;
  matrix2[0].bitpix = matrix1[0].bitpix;
  matrix2[0].size   = matrix1[0].size;
  matrix2[0].bzero  = matrix1[0].bzero;
  matrix2[0].bscale = matrix1[0].bscale;
  matrix2[0].Naxes  = matrix1[0].Naxes;
  for (i = 0; i < FT_MAX_NAXES; i++) 
    matrix2[0].Naxis[i] = matrix1[0].Naxis[i];

  if (matrix2[0].buffer != NULL) free (matrix2[0].buffer);
  ALLOCATE (matrix2[0].buffer, char, matrix2[0].size);
  
  memcpy (matrix2[0].buffer, matrix1[0].buffer, matrix2[0].size);

  return (TRUE);
}	


