# include "astro.h"
# define NARGS 2

void rhelp () 
{

  fprintf (stderr, "rastro -- a relative astrometry routine\n");

  fprintf (stderr, "  USAGE: rastro <ref>\n");
  fprintf (stderr, "  optional flags:\n");
  fprintf (stderr, "  -N          -- number of input stars used (default: 100) \n");
  fprintf (stderr, "  -F n        -- quadrant for search        (default: all) \n");
  fprintf (stderr, "  -R radius   -- default radius of search   (default: %d asec) \n",  DEFAULT_RADIUS);
  fprintf (stderr, "  -G N        -- grid search spacing        (default: %d ) \n", DEFAULT_NPIX);
  fprintf (stderr, "\n");
  fprintf (stderr, "  -help -- print this list\n");
  exit (0);
  
}

  


void rargs (argc, argv)
int     *argc;
char   **argv;
{
  
  int N;
  char line[500];

  if (N = get_argument (*argc, argv, "-help")) {
    remove_argument (N, argc, argv);
    rhelp ();
  }

  /** optional arguments **/
  if (N = get_argument (*argc, argv, "-N")) {
    remove_argument (N, argc, argv);
    N2NUMBER = atof (argv[N]);
    remove_argument (N, argc, argv);
  }
  else {
    N2NUMBER = 100;
  }
  
  if (N = get_argument (*argc, argv, "-F")) {
    remove_argument (N, argc, argv);
    FLIP = atof (argv[N]);
    remove_argument (N, argc, argv);
  }
  else {
    FLIP = 0;
  }
  
  if (N = get_argument (*argc, argv, "-R")) {
    remove_argument (N, argc, argv);
    RADIUS = atof (argv[N]);
    remove_argument (N, argc, argv);
  }
  else {
    RADIUS = DEFAULT_RADIUS;
  }
  
  if (N = get_argument (*argc, argv, "-G")) {
    remove_argument (N, argc, argv);
    NPIX = atof (argv[N]);
    remove_argument (N, argc, argv);
  }
  else {
    NPIX = DEFAULT_NPIX;
  }
  
  if (*argc != NARGS) {
    fprintf (stderr, "USAGE: rastro [-N NN -F mode -R radius] <ref>  \n");
    fprintf (stderr, "  enter filenames, followed by EOF\n");
    exit (0);
  }
  
 
}

