small logging additions to dtnrespond matching function
authoraidan
Tue, 26 Apr 2011 17:51:01 +0100
changeset 2 9daf757dfa63
parent 1 44c5e3fa6d30
small logging additions to dtnrespond matching function
apps/dtnrespond/dtnrespond.c
apps/dtnrespond/matching_file.csv
--- a/apps/dtnrespond/dtnrespond.c	Tue Apr 26 14:43:43 2011 +0100
+++ b/apps/dtnrespond/dtnrespond.c	Tue Apr 26 17:51:01 2011 +0100
@@ -454,7 +454,8 @@
 match_bpq(const dtn_bpq_extension_block_data_t * bpq,
     const char * matching_filename,
     char * pathname,
-    int * found)
+    int * found,
+    int verbose)
 {
     char line[PATH_MAX];
     char trim_response_path[PATH_MAX];
@@ -463,9 +464,13 @@
     
     *found = 0;
 
-    if ((file = fopen(matching_filename, "r")) == 0)
+    if ((file = fopen(matching_filename, "r")) == 0) {
+        if (verbose) fprintf(stderr, "ERROR: Unable to open matching file: %s\n", matching_filename);    
         return -1;
+    }
     
+    if (verbose) fprintf(stderr, "trying to match the query: %s\n", bpq->query.query_val);    
+
     memset(line, 0 , PATH_MAX);
     while (fgets(line, PATH_MAX, file) != NULL) {
         strtok(line, ",");
@@ -782,7 +787,7 @@
                     return ret;
                 }
 
-                match_bpq(&bpq_block_data, matching_filename, pathname, &found);
+                match_bpq(&bpq_block_data, matching_filename, pathname, &found, verbose);
                 break;
             }                
         }
--- a/apps/dtnrespond/matching_file.csv	Tue Apr 26 14:43:43 2011 +0100
+++ b/apps/dtnrespond/matching_file.csv	Tue Apr 26 17:51:01 2011 +0100
@@ -1,1 +1,2 @@
-matching_rule,encoding,query,/home/aidan/Desktop,300
+1,asd,qwe,/home/aidan/bpq_files,2011-01-01
+1,asd,qwe,/home/aidan/more bpq files/,2011-03-01