Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
647 andrew_pro 1
#include "stdio.h"
2
#include "stdlib.h"
3
#include "ctype.h"
4
 
5
 
6
/*
7
** atoi(s) - convert s to integer.
8
*/
9
int atoi(char *s)
10
{
11
  int sign, n;
12
  while(isspace(*s)) ++s;
13
  sign = 1;
14
  switch(*s) {
15
    case '-': sign = -1;
16
    case '+': ++s;
17
    }
18
  n = 0;
19
  while(isdigit(*s)) n = 10 * n + *s++ - '0';
20
  return (sign * n);
21
}