1 /*- 2 * Copyright (c) 1988 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.proprietary.c% 6 */ 7 8 #ifndef lint 9 static char sccsid[] = "@(#)getnum.c 5.1 (Berkeley) 04/17/91"; 10 #endif /* not lint */ 11 12 #include <stdio.h> 13 14 getnum() 15 { 16 int c, n; 17 18 n = 0; 19 while ((c=getchar()) >= '0' && c <= '9') 20 n = n*10 + c - '0'; 21 if (c == EOF) 22 return(-1); 23 return(n); 24 } 25