ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/libstatgrab/tools.c
(Generate patch)

Comparing projects/libstatgrab/src/libstatgrab/tools.c (file contents):
Revision 1.12 by tdb, Mon Nov 10 21:07:04 2003 UTC vs.
Revision 1.13 by ats, Mon Nov 10 22:46:32 2003 UTC

# Line 60 | Line 60 | char *get_string_match(char *line, regmatch_t *match){
60          return match_string;
61   }
62  
63 + #ifndef HAVE_ATOLL
64 + static long long atoll(const char *s) {
65 +        long long value = 0;
66 +        int isneg = 0;
67 +
68 +        while (*s == ' ' || *s == '\t') {
69 +                s++;
70 +        }
71 +        if (*s == '-') {
72 +                isneg = 1;
73 +                s++;
74 +        }
75 +        while (*s >= '0' && *s <= '9') {
76 +                value = (10 * value) + (*s - '0');
77 +                s++;
78 +        }
79 +        return (isneg ? -value : value);
80 + }
81 + #endif
82 +
83   long long get_ll_match(char *line, regmatch_t *match){
84          char *ptr;
85          long long num;
86  
87          ptr=line+match->rm_so;
68 #ifdef HAVE_ATOLL
88          num=atoll(ptr);
70 #else
71        /* Don't have atoll, so use this bodge instead */
72        {
73                long numl;
74                numl=atol(ptr);
75                num=numl;
76        }
77 #endif
89  
90          return num;
91   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines