Last change
on this file since 5f1d169 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 8 years ago |
Imported original source code.
|
-
Property mode
set to
100755
|
File size:
579 bytes
|
Rev | Line | |
---|
[3ae31e9] | 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 |
|
---|
| 11 | long
|
---|
| 12 | atol(cp)
|
---|
| 13 | register char *cp;
|
---|
| 14 | {
|
---|
| 15 | register long n;
|
---|
| 16 | register short sign;
|
---|
| 17 |
|
---|
| 18 | sign = 0;
|
---|
| 19 |
|
---|
| 20 | if (*cp EQ '-') {
|
---|
| 21 |
|
---|
| 22 | ++cp;
|
---|
| 23 | sign = 1;
|
---|
| 24 |
|
---|
| 25 | } else {
|
---|
| 26 |
|
---|
| 27 | if (*cp EQ '+')
|
---|
| 28 | ++cp;
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | for (n = 0; isdigit(*cp); )
|
---|
| 32 | n = n * 10 + *cp++ - '0';
|
---|
| 33 |
|
---|
| 34 | return(sign ? -n : n);
|
---|
| 35 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.