- if(a_file_name != NULL) { /* -f switch in use */
- a_file = fopen(a_file_name, "r");
- if(a_file == NULL)
- g_error("textFilter::parse_filter_content() cannot open file %s", a_file_name);
-
- fscanf(a_file,"%s",parsed_string);
-
- fclose(a_file);
- }
- if(a_filter_string != NULL) /* -s switch in use */
- parsed_string = a_filter_string;
-
- if(parsed_string==NULL)
- g_warning("textFilter::parser_filter_options() no filtering options specified !");
-
- /* send the filtering string to the core */
- lttv_filter_new(parsed_string,lt);
-
+ a_file = fopen(a_file_name, "r");
+ if(a_file == NULL) {
+ g_warning("file %s does not exist", a_file_name);
+ return;
+ }
+
+ char* line = NULL;
+ size_t len = 0;
+
+ if(a_filter_string == NULL) {
+ a_filter_string = g_string_new("");
+ }
+ else {
+ g_string_append(a_filter_string,"&"); /*conjonction between expression*/
+ }
+
+ while(!feof(a_file)) {
+ getline(&line,&len,a_file);
+ g_string_append(a_filter_string,line);
+ line = NULL;
+ }
+
+ lttv_filter_new(a_filter_string->str,NULL);
+ fclose(a_file);
+}
+
+/**
+ * filters the string input from user
+ * @param hook_data the hook data
+ * @return success/failure of operation
+ */
+void filter_analyze_string(void *hook_data) {
+
+ g_print("textFilter::filter_analyze_string\n");
+
+ /*
+ * User may specify filtering options through static file
+ * and/or command line string. From these sources, an
+ * option string is rebuilded and sent to the filter core
+ */
+ if(a_filter_string==NULL) {
+ a_filter_string = g_string_new("");
+ g_string_append(a_filter_string,a_string);
+ }
+ else {
+ g_string_append(a_filter_string,"&"); /*conjonction between expression*/
+ g_string_append(a_filter_string,a_string);
+ }
+