From 4c1dfe63ca8ef89a0f5b997be562f34f6d5a8d1c Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Fri, 5 Sep 2008 08:49:54 +0000 Subject: [PATCH] Fixed problem with quick filters and ^xxx$ search SVN revision: 2127 --- src/elogd.c | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/src/elogd.c b/src/elogd.c index c9a0ea90..fad3a80a 100755 --- a/src/elogd.c +++ b/src/elogd.c @@ -19226,7 +19226,16 @@ void show_elog_list(LOGBOOK * lbs, int past_n, int last_n, int page_n, BOOL defa /* search for parameter without '_' coming from quick filter */ if (isparam(attr_list[i])) { searched = TRUE; - if (strstr(attrib[i], getparam(attr_list[i]))) + + strlcpy(str, getparam(attr_list[i]), sizeof(str)); + if (str[0] == '^' && str[strlen(str)-1] == '$') { + str[strlen(str)-1] = 0; + strlcpy(comment, str+1, NAME_LENGTH); + } else + strlcpy(comment, str, NAME_LENGTH); + strlcpy(str, comment, sizeof(str)); + + if (strstr(attrib[i], str)) found = TRUE; } @@ -19881,9 +19890,17 @@ void show_elog_list(LOGBOOK * lbs, int past_n, int last_n, int page_n, BOOL defa if (line[0]) strlcat(line, " | ", sizeof(line)); - if (comment[0] == 0) - strencode2(line + strlen(line), getparam(iattr), sizeof(line) - strlen(line)); - else + if (comment[0] == 0) { + strlcpy(str, getparam(iattr), sizeof(str)); + if (str[0] == '^' && str[strlen(str)-1] == '$') { + str[strlen(str)-1] = 0; + strlcpy(comment, str+1, NAME_LENGTH); + } else + strlcpy(comment, str, NAME_LENGTH); + strlcpy(str, comment, sizeof(str)); + + strencode2(line + strlen(line), str, sizeof(line) - strlen(line)); + } else strlcat(line, comment, sizeof(line)); } } @@ -19898,9 +19915,16 @@ void show_elog_list(LOGBOOK * lbs, int past_n, int last_n, int page_n, BOOL defa if (line[0]) strlcat(line, " | ", sizeof(line)); - if (comment[0] == 0) - strencode2(line + strlen(line), getparam(attr_list[i]), sizeof(line) - strlen(line)); - else + if (comment[0] == 0) { + strlcpy(str, getparam(attr_list[i]), sizeof(str)); + if (str[0] == '^' && str[strlen(str)-1] == '$') { + str[strlen(str)-1] = 0; + strlcpy(comment, str+1, NAME_LENGTH); + } else + strlcpy(comment, str, NAME_LENGTH); + strlcpy(str, comment, sizeof(str)); + strencode2(line + strlen(line), str, sizeof(line) - strlen(line)); + } else strlcat(line, comment, sizeof(line)); }