source: buchla-68k/libcio/atoi.c@ 050d522

Last change on this file since 050d522 was f40a309, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Unix line breaks.

  • Property mode set to 100644
File size: 563 bytes
Line 
1/*
2 =============================================================================
3 atoi.c -- ascii to integer conversion
4 Version 4 -- 1987-07-09 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#include "stddefs.h"
9#include "ctype.h"
10
11int
12atoi(cp)
13register char *cp;
14{
15 register unsigned i;
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 (i = 0; isdigit(*cp); )
32 i = i * 10 + (0x7F & *cp++) - '0';
33
34 return(sign ? -i : i);
35}
36
Note: See TracBrowser for help on using the repository browser.