/[gnats]/gnats/libiberty/strtol.c
ViewVC logotype

Diff of /gnats/libiberty/strtol.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by jsm, Tue Oct 26 07:10:16 1999 UTC revision 1.3 by pdm, Mon Dec 10 23:03:26 2001 UTC
# Line 10  Line 10 
10   * 2. Redistributions in binary form must reproduce the above copyright   * 2. Redistributions in binary form must reproduce the above copyright
11   *    notice, this list of conditions and the following disclaimer in the   *    notice, this list of conditions and the following disclaimer in the
12   *    documentation and/or other materials provided with the distribution.   *    documentation and/or other materials provided with the distribution.
13   * 3. All advertising materials mentioning features or use of this software   * 3. [rescinded 22 July 1999]
  *    must display the following acknowledgement:  
  *      This product includes software developed by the University of  
  *      California, Berkeley and its contributors.  
14   * 4. Neither the name of the University nor the names of its contributors   * 4. Neither the name of the University nor the names of its contributors
15   *    may be used to endorse or promote products derived from this software   *    may be used to endorse or promote products derived from this software
16   *    without specific prior written permission.   *    without specific prior written permission.
# Line 31  Line 28 
28   * SUCH DAMAGE.   * SUCH DAMAGE.
29   */   */
30    
31    #ifdef HAVE_CONFIG_H
32    #include "config.h"
33    #endif
34    #ifdef HAVE_LIMITS_H
35  #include <limits.h>  #include <limits.h>
36  #include <ctype.h>  #endif
37    #ifdef HAVE_SYS_PARAM_H
38    #include <sys/param.h>
39    #endif
40  #include <errno.h>  #include <errno.h>
41  #if 0  #ifdef NEED_DECLARATION_ERRNO
42  #include <stdlib.h>  extern int errno;
43  #endif  #endif
44  #include "ansidecl.h"  #include "safe-ctype.h"
45    
46  /* FIXME: It'd be nice to configure around these, but the include files are too  /* FIXME: It'd be nice to configure around these, but the include files are too
47     painful.  These macros should at least be more portable than hardwired hex     painful.  These macros should at least be more portable than hardwired hex
# Line 80  strtol(nptr, endptr, base) Line 84  strtol(nptr, endptr, base)
84           */           */
85          do {          do {
86                  c = *s++;                  c = *s++;
87          } while (isspace(c));          } while (ISSPACE(c));
88          if (c == '-') {          if (c == '-') {
89                  neg = 1;                  neg = 1;
90                  c = *s++;                  c = *s++;
# Line 116  strtol(nptr, endptr, base) Line 120  strtol(nptr, endptr, base)
120          cutlim = cutoff % (unsigned long)base;          cutlim = cutoff % (unsigned long)base;
121          cutoff /= (unsigned long)base;          cutoff /= (unsigned long)base;
122          for (acc = 0, any = 0;; c = *s++) {          for (acc = 0, any = 0;; c = *s++) {
123                  if (isdigit(c))                  if (ISDIGIT(c))
124                          c -= '0';                          c -= '0';
125                  else if (isalpha(c))                  else if (ISALPHA(c))
126                          c -= isupper(c) ? 'A' - 10 : 'a' - 10;                          c -= ISUPPER(c) ? 'A' - 10 : 'a' - 10;
127                  else                  else
128                          break;                          break;
129                  if (c >= base)                  if (c >= base)

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26