repo.or.cz
/
minix3.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
custom message type for VM_INFO
[minix3.git]
/
lib
/
libminc
/
atoi.c
blob
bcd3450ea518d2b4886d1cc5650a8f7b6d572af2
1
/* Extracted from sys/arch/i386/stand/lib/bootmenu.c */
2
int
atoi
(
const char
*);
3
4
#define isnum(c) ((c) >=
'0'
&& (c) <=
'9'
)
5
6
int
7
atoi
(
const char
*
in
)
8
{
9
const char
*
c
;
10
int
ret
;
11
12
ret
=
0
;
13
c
=
in
;
14
if
(*
c
==
'-'
)
15
c
++;
16
for
(;
isnum
(*
c
);
c
++)
17
ret
= (
ret
*
10
) + (*
c
-
'0'
);
18
19
return
(*
in
==
'-'
) ? -
ret
:
ret
;
20
}
21