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

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

Point of no return.

  • Property mode set to 100644
File size: 550 bytes
RevLine 
[f40a309]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
[0580615]11int atoi(char *cp)
[f40a309]12{
13 register unsigned i;
14 register short 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 (i = 0; isdigit(*cp); )
30 i = i * 10 + (0x7F & *cp++) - '0';
31
32 return(sign ? -i : i);
33}
34
Note: See TracBrowser for help on using the repository browser.