# include "data.h"

int queuelist (int argc, char **argv) {
  
  if (argc != 1) {
    fprintf (stderr, "USAGE: queuelist\n");
    return (FALSE);
  }

  ListQueues ();
  return (TRUE);
}


int queuesize (int argc, char **argv) {
  
  int N;
  char *var;
  Queue *queue;

  var = (char *) NULL;
  if (N = get_argument (argc, argv, "-var")) {
    remove_argument (N, &argc, argv);
    var = strcreate (argv[N]);
    remove_argument (N, &argc, argv);
  }

  if (argc != 2) {
    fprintf (stderr, "USAGE: queuesize (name) [-var variable]\n");
    return (FALSE);
  }

  queue = FindQueue (argv[1]);
  if (queue == NULL) {
    fprintf (stderr, "ERROR: queue %s not found\n", argv[1]);
    return (FALSE);
  }

  if (var == (char *) NULL) {
    fprintf (stderr, "Nlines: %d\n", queue[0].Nlines);
    return (TRUE);
  }

  set_int_variable (var, queue[0].Nlines);
  free (var);
  return (TRUE);
}

