Ruby
2.0.0p648(2015-12-16revision53162)
missing
strtol.c
Go to the documentation of this file.
1
/* public domain rewrite of strtol(3) */
2
3
#include "
ruby/missing.h
"
4
#include <ctype.h>
5
6
long
7
strtol
(
const
char
*nptr,
char
**endptr,
int
base)
8
{
9
long
result
;
10
const
char
*
p
= nptr;
11
12
while
(isspace(*
p
)) {
13
p
++;
14
}
15
if
(*
p
==
'-'
) {
16
p
++;
17
result
= -strtoul(
p
, endptr, base);
18
}
19
else
{
20
if
(*
p
==
'+'
)
p
++;
21
result
= strtoul(
p
, endptr, base);
22
}
23
if
(endptr != 0 && *endptr ==
p
) {
24
*endptr = (
char
*)nptr;
25
}
26
return
result
;
27
}
missing.h
p
Win32OLEIDispatch * p
Definition:
win32ole.c:786
result
static VALUE result
Definition:
nkf.c:40
strtol
long strtol(const char *nptr, char **endptr, int base)
Definition:
strtol.c:7
Generated by
1.8.14