oops, included one thing too many

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@574 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 1998-03-02 02:52:42 +00:00
parent 9c6d1e8dad
commit 78fdf94f89

View File

@ -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;
}
/********************************************************************\
\********************************************************************/