# include "data.h"

int clear (int argc, char **argv) {
  
  int N, ClearSection;
  int Ngraph, Xgraph;

  Ngraph = -1;
  if (N = get_argument (argc, argv, "-n")) {
    remove_argument (N, &argc, argv);
    Ngraph = atof (argv[N]);
    remove_argument (N, &argc, argv);
  }
  if (!GetGraph (NULL, &Xgraph, &Ngraph)) return (FALSE);

  ClearSection = FALSE;
  if (N = get_argument (argc, argv, "-s")) {
    remove_argument (N, &argc, argv);
    ClearSection = TRUE;
  }

  if (argc != 1) {
    fprintf (stderr, "USAGE: clear [-n Xgraph]\n");
    return (FALSE);
  }

  if (ClearSection) {
    write (Xgraph, "ERAS", 4);
  } else {
    write (Xgraph, "ERSS", 4);
  }
  
  return (TRUE);
  
}

