diff options
author | John Wiegley <johnw@newartisans.com> | 2009-02-22 17:51:11 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-02-22 17:51:11 -0400 |
commit | ea75613760440604ba5bdc2ab7f89892dc28c079 (patch) | |
tree | c6cd3ec4871f9598dfe2191f0cb7e2933da8b920 /src/utils.h | |
parent | f2e4f4c6d1f20949232ab776cb24bfbd2db2797b (diff) | |
download | fork-ledger-ea75613760440604ba5bdc2ab7f89892dc28c079.tar.gz fork-ledger-ea75613760440604ba5bdc2ab7f89892dc28c079.tar.bz2 fork-ledger-ea75613760440604ba5bdc2ab7f89892dc28c079.zip |
--exchange option now accepts multiple commodities
They must be separated by a comma, and all whitespace is ignored.
Diffstat (limited to 'src/utils.h')
-rw-r--r-- | src/utils.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/utils.h b/src/utils.h index 4beff305..38fd2439 100644 --- a/src/utils.h +++ b/src/utils.h @@ -522,6 +522,14 @@ inline char * skip_ws(char * ptr) { return ptr; } +inline char * trim_ws(char * ptr) { + std::size_t len = std::strlen(ptr); + int i = int(len) - 1; + while (i >= 0 && ptr[i] == ' ' || ptr[i] == '\t' || ptr[i] == '\n') + ptr[i--] = '\0'; + return skip_ws(ptr); +} + inline char * next_element(char * buf, bool variable = false) { for (char * p = buf; *p; p++) { if (! (*p == ' ' || *p == '\t')) |