Ruby  2.1.10p492(2016-04-01revision54464)
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 }
long strtol(const char *nptr, char **endptr, int base)
Definition: strtol.c:7
char * endptr
Definition: tcltklib.c:3774
register C_block * p
Definition: crypt.c:309
volatile VALUE result
Definition: enum.c:1989