source: buchla-68k/libcio/atol.c@ 9519422

Last change on this file since 9519422 was 7258c6a, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Use standard integer types.

  • Property mode set to 100644
File size: 541 bytes
Line 
1/*
2 =============================================================================
3 atol.c -- ascii to long conversion
4 Version 3 -- 1987-06-29 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#include "stddefs.h"
9#include "ctype.h"
10
11int32_t atol(int8_t *cp)
12{
13 register int32_t n;
14 register int16_t sign;
15
16 sign = 0;
17
18 if (*cp EQ '-') {
19
20 ++cp;
21 sign = 1;
22
23 } else {
24
25 if (*cp EQ '+')
26 ++cp;
27 }
28
29 for (n = 0; isdigit(*cp); )
30 n = n * 10 + *cp++ - '0';
31
32 return(sign ? -n : n);
33}
Note: See TracBrowser for help on using the repository browser.