Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4680 right-hear 1
#include 
2
#include 
3
#include 
4
#include 
5
#include 
6
 
7
long long int strtoll(const char *nptr, char **endptr, int base)
8
{
9
  int neg=0;
10
  unsigned long long int v;
11
  const char*orig=nptr;
12
 
13
  while(isspace(*nptr)) nptr++;
14
 
15
  if (*nptr == '-' && isalnum(nptr[1])) { neg=-1; nptr++; }
16
  v=strtoull(nptr,endptr,base);
17
  if (endptr && *endptr==nptr) *endptr=(char *)orig;
18
  if (v>LLONG_MAX) {
19
    if (v==0x8000000000000000ull && neg) {
20
      errno=0;
21
      return v;
22
    }
23
    errno=ERANGE;
24
    return (neg?LLONG_MIN:LLONG_MAX);
25
  }
26
  return (neg?-v:v);
27
}
28