apps/dtnrespond/dtnrespond.c
changeset 65 333724f2f7cf
parent 64 1296a0283271
child 66 e1101c5d54a1
--- a/apps/dtnrespond/dtnrespond.c	Mon Oct 24 18:28:33 2011 +0100
+++ b/apps/dtnrespond/dtnrespond.c	Wed Oct 26 13:33:11 2011 +0100
@@ -78,7 +78,7 @@
     fprintf(stderr, " -h  help\n");
     fprintf(stderr, " -v  verbose\n");
 
-    return 0;
+    return DTN_SUCCESS;
 }
 
 /*******************************************************************************
@@ -220,7 +220,7 @@
     if (*reply_eid_name == NULL)
         strncpy(reply_eid_name, local_eid_name, PATH_MAX);
 
-    return 0;
+    return DTN_SUCCESS;
 }
 
 /*******************************************************************************
@@ -403,8 +403,7 @@
     for (j = strlen(out)-1; strchr(whitespace, in[i]) != NULL; --j)
     	out[j--] = 0;
 
-    return 0;
-
+    return DTN_SUCCESS;
 }   
 
 /*******************************************************************************
@@ -464,7 +463,7 @@
 		return -1;
     } else {
     	fclose (file);
-		return 0;
+		return DTN_SUCCESS;
     }
 }
 
@@ -504,14 +503,18 @@
     	// TODO: handle malformed input from matching file
     	if (fgets(line, PATH_MAX, file) == NULL) {
     		break;
-    	} else {
-    		matching_rule 	= strtok(line, ",");
-    		query 			= strtok(NULL, ",");
-    		path 	        = strtok(NULL, ",");
-    		kind  			= strtok(NULL, ",");
-    		expiry			= strtok(NULL, ",");
     	}
 
+    	if (strncmp(line, "#", 1) == 0)
+    		continue;
+
+    	matching_rule 	= strtok(line, ",");
+		query 			= strtok(NULL, ",");
+		path 	        = strtok(NULL, ",");
+		kind  			= strtok(NULL, ",");
+		expiry			= strtok(NULL, ",");
+
+
     	// match query
         if (atoi(matching_rule) != (int)bpq->matching_rule		||
 			BPQ_MATCHING_RULE_EXACT != bpq->matching_rule		||
@@ -539,7 +542,7 @@
     }
     fclose (file);
 
-    return 0;
+    return DTN_SUCCESS;
 }
 
 /*******************************************************************************
@@ -1120,7 +1123,7 @@
     dtn_close(handle);
     if (verbose) fprintf(stdout, "closed connection to dtn router...\n");
 
-    return 0;
+    return DTN_SUCCESS;
 
 // UNREACHABLE CODE if count = 0 //////////////////////////////////////////////
 }