Index: trunk/src/reglookup.c
===================================================================
--- trunk/src/reglookup.c	(revision 137)
+++ trunk/src/reglookup.c	(revision 138)
@@ -86,17 +86,26 @@
   }
 
-  quoted_value = data_to_ascii(vk->data, size, vk->type, &conv_error);
-  if(quoted_value == NULL)
-  {
-    if(conv_error == NULL)
-      fprintf(stderr, "WARN: Could not quote value for '%s/%s'.  "
-	      "Memory allocation failure likely.\n", prefix, quoted_name);
-    else if(print_verbose)
-      fprintf(stderr, "WARN: Could not quote value for '%s/%s'.  "
-	      "Returned error: %s\n", prefix, quoted_name, conv_error);
-  }
-  else if(conv_error != NULL && print_verbose)
-    fprintf(stderr, "VERBOSE: While quoting value for '%s/%s', "
-	    "warning returned: %s\n", prefix, quoted_name, conv_error);
+  if(vk->data == NULL)
+  {
+    if(print_verbose)
+      fprintf(stderr, "INFO: While quoting value for '%s/%s', "
+	      "data pointer was NULL.\n", prefix, quoted_name);
+  }
+  else
+  {
+    quoted_value = data_to_ascii(vk->data, size, vk->type, &conv_error);
+    if(quoted_value == NULL)
+    {
+      if(conv_error == NULL)
+	fprintf(stderr, "WARN: Could not quote value for '%s/%s'.  "
+		"Memory allocation failure likely.\n", prefix, quoted_name);
+      else
+	fprintf(stderr, "WARN: Could not quote value for '%s/%s'.  "
+		"Returned error: %s\n", prefix, quoted_name, conv_error);
+    }
+    else if(conv_error != NULL && print_verbose)
+      fprintf(stderr, "INFO: While quoting value for '%s/%s', "
+	      "warning returned: %s\n", prefix, quoted_name, conv_error);
+  }
 
   str_type = regfi_type_val2str(vk->type);
@@ -275,5 +284,5 @@
       printValue(value, prefix);
     value = regfi_iterator_next_value(iter);
-    printMsgs(iter);
+    printMsgs(iter->f);
   }
 }
@@ -333,5 +342,5 @@
       {
 	if(print_verbose)
-	  fprintf(stderr, "WARN: While converting classname"
+	  fprintf(stderr, "INFO: While converting classname"
 		  " for key '%s': %s.\n", full_path, error_msg);
 	free(error_msg);
@@ -341,5 +350,5 @@
       quoted_classname = empty_str;
 
-    printMsgs(iter);
+    printMsgs(iter->f);
     printf("%s,KEY,,%s,%s,%s,%s,%s,%s\n", full_path, mtime, 
 	   owner, group, sacl, dacl, quoted_classname);
@@ -372,5 +381,5 @@
   root = cur = regfi_iterator_cur_key(iter);
   sub = regfi_iterator_first_subkey(iter);
-  printMsgs(iter);
+  printMsgs(iter->f);
 
   if(root == NULL)
@@ -400,5 +409,5 @@
 	if(!regfi_iterator_up(iter))
 	{
-	  printMsgs(iter);
+	  printMsgs(iter->f);
 	  bailOut(EX_DATAERR, "ERROR: could not traverse iterator upward.\n");
 	}
@@ -407,5 +416,5 @@
 	if(cur == NULL)
 	{
-	  printMsgs(iter);
+	  printMsgs(iter->f);
 	  bailOut(EX_DATAERR, "ERROR: unexpected NULL for key.\n");
 	}
@@ -421,5 +430,5 @@
       if(!regfi_iterator_down(iter))
       {
-	printMsgs(iter);
+	printMsgs(iter->f);
 	bailOut(EX_DATAERR, "ERROR: could not traverse iterator downward.\n");
       }
@@ -429,9 +438,9 @@
       print_this = true;
     }
-    printMsgs(iter);
+    printMsgs(iter->f);
   } while(!((cur == root) && (sub == NULL)));
 
   if(print_verbose)
-    fprintf(stderr, "VERBOSE: Finished printing key tree.\n");
+    fprintf(stderr, "INFO: Finished printing key tree.\n");
 }
 
@@ -467,5 +476,5 @@
 
   if(print_verbose)
-    fprintf(stderr, "VERBOSE: Attempting to retrieve specified path: %s\n",
+    fprintf(stderr, "INFO: Attempting to retrieve specified path: %s\n",
 	    path_filter);
 
@@ -474,5 +483,5 @@
   {
     if(print_verbose)
-      fprintf(stderr, "VERBOSE: Found final path element as root key.\n");
+      fprintf(stderr, "INFO: Found final path element as root key.\n");
     free(tmp_path);
     return 2;
@@ -481,5 +490,5 @@
   if(!regfi_iterator_walk_path(iter, tmp_path))
   {
-    printMsgs(iter);
+    printMsgs(iter->f);
     free(tmp_path);
     return 0;
@@ -489,8 +498,8 @@
   {
     if(print_verbose)
-      fprintf(stderr, "VERBOSE: Found final path element as value.\n");
+      fprintf(stderr, "INFO: Found final path element as value.\n");
 
     value = regfi_iterator_cur_value(iter);
-    printMsgs(iter);
+    printMsgs(iter->f);
     tmp_path_joined = iter2Path(iter);
 
@@ -507,11 +516,11 @@
   else if(regfi_iterator_find_subkey(iter, path[i]))
   {
-    printMsgs(iter);
+    printMsgs(iter->f);
     if(print_verbose)
-      fprintf(stderr, "VERBOSE: Found final path element as key.\n");
+      fprintf(stderr, "INFO: Found final path element as key.\n");
 
     if(!regfi_iterator_down(iter))
     {
-      printMsgs(iter);
+      printMsgs(iter->f);
       bailOut(EX_DATAERR, "ERROR: Unexpected error on traversing path filter key.\n");
     }
@@ -519,8 +528,8 @@
     return 2;
   }
-  printMsgs(iter);
+  printMsgs(iter->f);
 
   if(print_verbose)
-    fprintf(stderr, "VERBOSE: Could not find last element of path.\n");
+    fprintf(stderr, "INFO: Could not find last element of path.\n");
 
   return 0;
@@ -616,4 +625,7 @@
   }
 
+  if(print_verbose)
+    regfi_set_message_mask(f, REGFI_MSG_INFO|REGFI_MSG_WARN|REGFI_MSG_ERROR);
+
   iter = regfi_iterator_new(f);
   if(iter == NULL)
@@ -634,5 +646,5 @@
   {
     retr_path_ret = retrievePath(iter, path);
-    printMsgs(iter);
+    printMsgs(iter->f);
     freePath(path);
 
