Ruby 2.0.0p353(2013-11-22revision43784)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

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 }
p
Win32OLEIDispatch * p
Definition: win32ole.c:786
missing.h
result
q result
Definition: tcltklib.c:7070
strtol
long strtol(const char *nptr, char **endptr, int base)
Definition: strtol.c:7
endptr
char * endptr
Definition: tcltklib.c:3782