# include "data.h"

int vroll (int argc, char **argv) {

  int Npix;
  float first;
  Vector *vec;

  if (argc != 2) {
    gprint (GP_ERR, "USAGE: vroll (vector)\n");
    gprint (GP_ERR, "  roll vector elements (first goes to end)\n");
    return (FALSE);
  }

  if ((vec = SelectVector (argv[1], OLDVECTOR, TRUE)) == NULL) return (FALSE);
  Npix = vec[0].Nelements;
  if (Npix < 2) return (TRUE);

  first = vec[0].elements[0];
  memmove (&vec[0].elements[0], &vec[0].elements[1], Npix*sizeof(float));
  vec[0].elements[Npix-1] = first;
  return (TRUE);
}
