
/*
 *  int ATOI(str)
 *
 *  (c)Copyright 1990, Matthew Dillon, All Rights Reserved
 */

#include <stdlib.h>

int
atoi(str)
const char *str;
{
    short neg = 0;
    long v = 0;

    while (*str == ' ' || *str == '\t')
	++str;
    if (*str == '-') {
	neg = 1;
	++str;
    }
    while (*str >= '0' && *str <= '9')
	v = v * 10 + *str++ - '0';
    if (neg)
	v = -v;
    return(v);
}


