From 7dc0bc621e9dfa3bcc0d2aee4f2b15a5945829f5 Mon Sep 17 00:00:00 2001 From: Jesse Pavel Date: Sun, 10 Sep 2000 16:17:32 +0000 Subject: Fixed a bug regarding the extraction of the region. svn path=/trunk/; revision=5302 --- e-util/ename/e-address-western.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'e-util/ename') diff --git a/e-util/ename/e-address-western.c b/e-util/ename/e-address-western.c index d4dcda995e..b6ced3bebf 100644 --- a/e-util/ename/e-address-western.c +++ b/e-util/ename/e-address-western.c @@ -13,8 +13,15 @@ #include #include +#ifdef E_ADDRESS_WESTERN_TEST + +#include "e-address-western.h" + +#else + #include +#endif static gboolean e_address_western_is_line_blank (gchar *line) @@ -195,6 +202,10 @@ e_address_western_extract_locality (gchar *line) return g_strndup (line, index); } + +/* Whatever resides between the comma and the start of the + postal code is deemed to be the region. */ + gchar * e_address_western_extract_region (gchar *line) { @@ -205,10 +216,17 @@ e_address_western_extract_region (gchar *line) while (isspace(line[start])) start++; - end = start; + end = strlen(line) - 1; + while (isspace (line[end])) + end--; + while (!isspace (line[end])) - end++; - + end--; + + while (isspace (line[end])) + end--; + end++; + /* Between start and end lie the string. */ return g_strndup ( (line+start), end-start); } -- cgit v1.2.3