diff --git a/src/QIFIO.c b/src/QIFIO.c index ee2cb8da59..38c518f388 100644 --- a/src/QIFIO.c +++ b/src/QIFIO.c @@ -393,100 +393,6 @@ void xaccParseQIFDate (Date * dat, char * str) dat->year += 1900; } -/********************************************************************\ - * xaccParseQIFAmount * - * parses dollar ammount of the form DDD,DDD,DDD.CC * - * * - * Args: str -- pointer to string rep of sum * - * Return: int -- in pennies * -\********************************************************************/ - -double xaccParseQIFAmount (char * str) -{ - char * tok; - double dollars = 0.0; - int len; - int isneg = 0; - - if (!str) return 0.0; - - if ('-' == str[0]) { - isneg = 1; - str += sizeof(char); - } - - tok = strchr (str, ','); - if (tok) { - *tok = 0x0; - dollars = ((double) (1000 * atoi (str))); - str = tok+sizeof(char); - } - - tok = strchr (str, ','); - if (tok) { - *tok = 0x0; - dollars *= 1000.0; - dollars += ((double) (1000 * atoi (str))); - str = tok+sizeof(char); - } - - tok = strchr (str, '.'); - if (tok) { - *tok = 0x0; - dollars += ((double) (atoi (str))); - str = tok+sizeof(char); - - tok = strchr (str, '\r'); - if (!tok) { - tok = strchr (str, '\n'); - if (!tok) return dollars; - } - *tok = 0x0; - - /* strip off garbage at end of the line */ - tok = strchr (str, '\n'); - if (tok) *tok = 0x0; - - tok = strchr (str, ' '); - if (tok) *tok = 0x0; - - /* adjust for number of decimal places */ - len = strlen(str); - if (6 == len) { - dollars += 0.000001 * ((double) atoi (str)); - } else - if (5 == len) { - dollars += 0.00001 * ((double) atoi (str)); - } else - if (4 == len) { - dollars += 0.0001 * ((double) atoi (str)); - } else - if (3 == len) { - dollars += 0.001 * ((double) atoi (str)); - } else - if (2 == len) { - dollars += 0.01 * ((double) atoi (str)); - } else - if (1 == len) { - dollars += 0.1 * ((double) atoi (str)); - } - - } else { - tok = strchr (str, '\r'); - if (tok) *tok = 0x0; - tok = strchr (str, '\n'); - if (tok) *tok = 0x0; - tok = strchr (str, ' '); - if (tok) *tok = 0x0; - - dollars += ((double) (atoi (str))); - } - - if (isneg) dollars = -dollars; - - return dollars; -} - /********************************************************************\ \********************************************************************/