#define NUMBER	'0'
#define TOOBIG	'9'
#include <stdio.h>

getop(s,lim)	/* get next operator or operand */
char s[];
int lim;
{
     int i, c;

     while ((c = getchar()) == ' ' || c == '\t' || c == '\n')
	  ;
     if (c != '.' && (c < '0' || c > '9'))
	  return (c);
     s[0] = c;
     for (i = 1; (c = getchar ()) >= '0' && c <= '9'; i++)
	  if (i < lim)
	       s[i] = c;
     if (c == '.') {	/* collect fraction */
	  if (i < lim)
	       s[i] = c;
	  for (i++; (c=getchar()) >= '0' && c <= '9'; i++)
	       if (i < lim)
		    s[i] = c;
     }
     if (i < lim) {	/* number is ok */
	  ungetc (c, stdin);
	  s[i] = '\0';
	  return (NUMBER);
      } else {		/* it's too big; skip rest of line */
	  while (c != '\n' && c != EOF)
	       c = getchar();
	  s[lim-1]='\0';
	  return(TOOBIG);
     }

}
