1*48274Sbostic /*- 2*48274Sbostic * Copyright (c) 1988 The Regents of the University of California. 3*48274Sbostic * All rights reserved. 4*48274Sbostic * 5*48274Sbostic * %sccs.include.proprietary.c% 6*48274Sbostic */ 7*48274Sbostic 834681Sjak #ifndef lint 9*48274Sbostic static char sccsid[] = "@(#)getnum.c 5.1 (Berkeley) 04/17/91"; 10*48274Sbostic #endif /* not lint */ 1134681Sjak 1234681Sjak #include <stdio.h> 1334681Sjak 1434681Sjak getnum() 1534681Sjak { 1634681Sjak int c, n; 1734681Sjak 1834681Sjak n = 0; 1934681Sjak while ((c=getchar()) >= '0' && c <= '9') 2034681Sjak n = n*10 + c - '0'; 2134681Sjak if (c == EOF) 2234681Sjak return(-1); 2334681Sjak return(n); 2434681Sjak } 25