*** empty log message ***

This commit is contained in:
John Wiegley 2004-04-10 11:52:43 +00:00
parent b5097ced2b
commit 9ffdff9510
3 changed files with 23 additions and 17 deletions

View file

@ -227,8 +227,10 @@ amount * gmp_amount::street(bool get_quotes) const
{ {
amount * amt = copy(); amount * amt = copy();
int max = 10; if (! amt->commdty())
return amt;
int max = 10;
while (--max >= 0) { while (--max >= 0) {
if (! amt->commdty()->price && ! amt->commdty()->sought) { if (! amt->commdty()->price && ! amt->commdty()->sought) {
if (get_quotes) if (get_quotes)

View file

@ -292,7 +292,7 @@ void parse_automated_transactions(std::istream& in, book * ledger)
// //
book * parse_ledger(std::istream& in, regexps_map& regexps, book * parse_ledger(std::istream& in, regexps_map& regexps,
bool compute_balances) bool compute_balances)
{ {
static char line[MAX_LINE + 1]; static char line[MAX_LINE + 1];
char c; char c;
@ -334,7 +334,9 @@ book * parse_ledger(std::istream& in, regexps_map& regexps,
break; break;
case '=': // automated transactions case '=': // automated transactions
do_compute = false;
parse_automated_transactions(in, ledger); parse_automated_transactions(in, ledger);
do_compute = compute_balances;
break; break;
default: default:

View file

@ -126,8 +126,7 @@ void report_balances(std::ostream& out, regexps_map& regexps)
} }
else { else {
bool by_exclusion = false; bool by_exclusion = false;
bool match = matches(regexps, acct->as_str(), bool match = matches(regexps, acct->as_str(), &by_exclusion);
&by_exclusion);
if (! match) { if (! match) {
acct->checked = 2; acct->checked = 2;
} }
@ -237,7 +236,7 @@ void print_register(const std::string& acct_name, std::ostream& out,
// gnucash does. // gnucash does.
transaction * xact; transaction * xact;
if ((*i)->xacts.size() == 2) { if (! full_names && (*i)->xacts.size() == 2) {
if (*x == (*i)->xacts.front()) if (*x == (*i)->xacts.front())
xact = (*i)->xacts.back(); xact = (*i)->xacts.back();
else else
@ -302,7 +301,6 @@ static void equity_entry(account * acct, regexps_map& regexps,
opening.cleared = true; opening.cleared = true;
opening.desc = "Opening Balance"; opening.desc = "Opening Balance";
transaction * xact;
for (totals::const_iterator i = acct->balance.amounts.begin(); for (totals::const_iterator i = acct->balance.amounts.begin();
i != acct->balance.amounts.end(); i != acct->balance.amounts.end();
i++) { i++) {
@ -310,7 +308,7 @@ static void equity_entry(account * acct, regexps_map& regexps,
if ((*i).second->is_zero()) if ((*i).second->is_zero())
continue; continue;
xact = new transaction(); transaction * xact = new transaction();
xact->acct = const_cast<account *>(acct); xact->acct = const_cast<account *>(acct);
xact->cost = (*i).second->street(get_quotes); xact->cost = (*i).second->street(get_quotes);
opening.xacts.push_back(xact); opening.xacts.push_back(xact);
@ -551,7 +549,7 @@ int main(int argc, char * argv[])
have_beginning = true; have_beginning = true;
if (! parse_date(optarg, &begin_date)) { if (! parse_date(optarg, &begin_date)) {
std::cerr << "Error: Bad begin date: " << optarg << std::endl; std::cerr << "Error: Bad begin date: " << optarg << std::endl;
std::exit(1); return 1;
} }
break; break;
@ -559,7 +557,7 @@ int main(int argc, char * argv[])
have_ending = true; have_ending = true;
if (! parse_date(optarg, &end_date)) { if (! parse_date(optarg, &end_date)) {
std::cerr << "Error: Bad end date: " << optarg << std::endl; std::cerr << "Error: Bad end date: " << optarg << std::endl;
std::exit(1); return 1;
} }
break; break;
@ -572,7 +570,7 @@ int main(int argc, char * argv[])
have_date_mask = true; have_date_mask = true;
if (! parse_date_mask(optarg, &date_mask)) { if (! parse_date_mask(optarg, &date_mask)) {
std::cerr << "Error: Bad date mask: " << optarg << std::endl; std::cerr << "Error: Bad date mask: " << optarg << std::endl;
std::exit(1); return 1;
} }
break; break;
@ -618,7 +616,7 @@ int main(int argc, char * argv[])
if (optind == argc) { if (optind == argc) {
show_help(std::cout); show_help(std::cout);
std::exit(1); return 1;
} }
index = optind; index = optind;
@ -632,9 +630,8 @@ int main(int argc, char * argv[])
if (! file || ! *file) { if (! file || ! *file) {
std::cerr << ("Please specify ledger file using -f option " std::cerr << ("Please specify ledger file using -f option "
"or LEDGER environment variable.") "or LEDGER environment variable.") << std::endl;
<< std::endl; return 1;
std::exit(1);
} }
} }
@ -644,10 +641,10 @@ int main(int argc, char * argv[])
int name_index = index; int name_index = index;
if (command == "register" || command == "reg") { if (command == "register" || command == "reg") {
if (optind == argc) { if (name_index == argc) {
std::cerr << ("Error: Must specify an account name " std::cerr << ("Error: Must specify an account name "
"after the 'register' command.") << std::endl; "after the 'register' command.") << std::endl;
std::exit(1); return 1;
} }
index++; index++;
} }
@ -675,7 +672,7 @@ int main(int argc, char * argv[])
delete file; delete file;
if (! main_ledger) if (! main_ledger)
std::exit(1); return 1;
// Record any prices specified by the user // Record any prices specified by the user
@ -714,6 +711,11 @@ int main(int argc, char * argv[])
else if (command == "entry") { else if (command == "entry") {
add_new_entry(index, argc, argv); add_new_entry(index, argc, argv);
} }
else {
std::cerr << "Error: Unrecognized command '" << command << "'."
<< std::endl;
return 1;
}
#ifdef DEBUG #ifdef DEBUG
// Ordinarily, deleting the main ledger isn't necessary, since the // Ordinarily, deleting the main ledger isn't necessary, since the