# include "data.h"

int mcreate (int argc, char **argv) {
  
  int Nx, Ny;
  Buffer *buf;

  if (argc != 4) {
    fprintf (stderr, "USAGE: mcreate <buffer> Nx Ny\n");
    return (FALSE);
  }

  if ((buf = SelectBuffer (argv[1], ANYVECTOR, TRUE)) == NULL) return (FALSE);
  Nx = atof (argv[2]);
  Ny = atof (argv[3]);

  buf[0].matrix.Naxis[0] = Nx;
  buf[0].matrix.Naxis[1] = Ny;

  /* I should encapsulate this in a create_default_buffer */
  fits_free_matrix (&buf[0].matrix);
  fits_free_header (&buf[0].header);
  buf[0].header.bitpix = buf[0].bitpix = -32;
  buf[0].header.unsign = buf[0].unsign = FALSE;
  buf[0].header.bscale = buf[0].bscale = 1.0;
  buf[0].header.bzero  = buf[0].bzero  = 0.0;
  buf[0].header.Naxes = 2;
  buf[0].header.Naxis[0] = Nx;
  buf[0].header.Naxis[1] = Ny;
  fits_create_header (&buf[0].header);
  fits_create_matrix (&buf[0].header, &buf[0].matrix);
  return (TRUE);

}


