# include "data.h"
# include "display.h"

int style_args (Graphdata *graphmode, int *argc, char **argv, int Nforce) {
  
  int N, Ngraph;
  char *name;

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

  if (*argc == 1) {
    name = KapaColorName (graphmode[0].color);
    gprint (GP_ERR, "current style (%d): -x %d -c %s -pt %d -lt %d -lw %f -sz %f\n", Ngraph,
	     graphmode[0].style, name, graphmode[0].ptype, 
	     graphmode[0].ltype, graphmode[0].lweight,
	     graphmode[0].size);
    return (TRUE);
  }

  if ((N = get_argument (*argc, argv, "-lt"))) {
    remove_argument (N, argc, argv);
    graphmode[0].ltype = atof(argv[N]);
    remove_argument (N, argc, argv);
  }
  if ((N = get_argument (*argc, argv, "-lw"))) {
    remove_argument (N, argc, argv);
    graphmode[0].lweight = atof(argv[N]);
    remove_argument (N, argc, argv);
  }
  if ((N = get_argument (*argc, argv, "-pt"))) {
    remove_argument (N, argc, argv);
    graphmode[0].ptype = atof(argv[N]);
    remove_argument (N, argc, argv);
  }
  if ((N = get_argument (*argc, argv, "+eb"))) {
    remove_argument (N, argc, argv);
    graphmode[0].ebar = TRUE;
  }
  if ((N = get_argument (*argc, argv, "-eb"))) {
    remove_argument (N, argc, argv);
    graphmode[0].ebar = FALSE;
  }
  if ((N = get_argument (*argc, argv, "-sz"))) {
    remove_argument (N, argc, argv);
    graphmode[0].size = atof(argv[N]);
    remove_argument (N, argc, argv);
  }
  if ((N = get_argument (*argc, argv, "-c"))) {
    remove_argument (N, argc, argv);
    graphmode[0].color = KapaColorByName (argv[N]);
    if (graphmode[0].color == -1) return (FALSE);
    remove_argument (N, argc, argv);
  }
  if ((N = get_argument (*argc, argv, "-x"))) {
    remove_argument (N, argc, argv);
    graphmode[0].style = atof(argv[N]);
    remove_argument (N, argc, argv);
  }

  return (TRUE);
}
