From ea75613760440604ba5bdc2ab7f89892dc28c079 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 22 Feb 2009 17:51:11 -0400 Subject: --exchange option now accepts multiple commodities They must be separated by a comma, and all whitespace is ignored. --- src/utils.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/utils.h') 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')) -- cgit v1.2.3