#include <msp430x44x.h>

typedef int word;
typedef unsigned int uword;
typedef char byte;
typedef unsigned char ubyte;

long test(char *str, char **endp, char base, int * err)
{
    long value = 0;
    char sign = 1;
    unsigned char digit = 0;
    unsigned char tempChar;
    *err = 10;

    tempChar = *str;
    while (((tempChar >= '0') && (tempChar < ('0' + base)))) {


        value = (value * base) + (digit);
        str++;
        tempChar = *str;
        *err = 0;
    }

    return (sign >= 0 ? value : -value);
}
