#include "getop.h"
#include <stdio.h>
#include <ctype.h>
#include "calc_defs.h"
#include "getch.h"

int getop(char s[])
{
  int i,c;

  while((s[0] = c = getch()) == ' ' || c == '\t') {
  }/*endwhile*/
  s[1] = '\0';
  if (!isdigit(c) && c != '.') {
    return c;
  }/*endif*/
  i=0;
  if (isdigit(c)) {
    while (isdigit(s[++i] = c = getch())) {
    }/*endwhile*/
  }/*endif*/
  if (c == '.') {
    while (isdigit(s[++i] = c = getch())) {
    }/*endwhile*/
  }/*endif*/
  s[i] = '\0';
  if (c != EOF) {
    ungetch(c);
  }/*endif*/
  return NUMBER;
}
