
#include "yodl.h"

void
gram_SETCOUNTER ()
{
  int
    index;
  char
   *name, *value;

  /* read counter name */
  name = gram_parlist (builtin[idx_SETCOUNTER], 0);
  index = gram_findcounter (builtin[idx_SETCOUNTER], name);

  while (lextok == tok_space ||	/* skip spaces, newlines */
	 lextok == tok_newline
    )
    lexer ();
  /* read counter value */
  value = gram_parlist (builtin[idx_SETCOUNTER], 1);

  message (3, "%s %s to %s\n", builtin[idx_SETCOUNTER], name, value);
  counterval[index] = gram_onenumber (builtin[idx_SETCOUNTER], value);

  free (name);
  free (value);
}
