projects
/
unix-history
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
new copyright; att/bsd/shared
[unix-history]
/
usr
/
src
/
usr.bin
/
learn
/
objects
/
getnum.c
/*-
* Copyright (c) 1988 The Regents of the University of California.
* All rights reserved.
*
* %sccs.include.proprietary.c%
*/
#ifndef lint
static char
sccsid
[] =
"@(#)getnum.c 5.1 (Berkeley) %G%"
;
#endif
/* not lint */
#include <stdio.h>
getnum
()
{
int
c
,
n
;
n
=
0
;
while
((
c
=
getchar
()) >=
'0'
&&
c
<=
'9'
)
n
=
n
*
10
+
c
-
'0'
;
if
(
c
==
EOF
)
return
(-
1
);
return
(
n
);
}