tools: Fixing help message printing in nfd-status

Change-Id: I937e317b02989aa9f51168e101d203ecd9199de8
Refs: #1395
diff --git a/tools/nfd-autoreg.cpp b/tools/nfd-autoreg.cpp
index ec64a55..9ed5840 100644
--- a/tools/nfd-autoreg.cpp
+++ b/tools/nfd-autoreg.cpp
@@ -153,13 +153,14 @@
 
 
   void
-  usage(const po::options_description& optionDesciption,
+  usage(std::ostream& os,
+        const po::options_description& optionDesciption,
         const char* programName)
   {
-    std::cerr << "General Usage\n  "
-              << programName << " --prefix=</autoreg/prefix> [--prefix=/another/prefix] ..."
-              << std::endl << std::endl;
-    std::cerr << optionDesciption << std::endl;
+    os << "Usage:\n"
+       << "  " << programName << " --prefix=</autoreg/prefix> [--prefix=/another/prefix] ...\n"
+       << "\n";
+    os << optionDesciption;
   }
 
   void
@@ -234,20 +235,20 @@
     catch (std::exception& e)
       {
         std::cerr << "ERROR: " << e.what() << std::endl << std::endl;
-        usage(optionDesciption, argv[0]);
+        usage(std::cerr, optionDesciption, argv[0]);
         return 1;
       }
 
     if (options.count("help"))
       {
-        usage(optionDesciption, argv[0]);
+        usage(std::cout, optionDesciption, argv[0]);
         return 0;
       }
 
     if (m_autoregPrefixes.empty())
       {
         std::cerr << "ERROR: at least one --prefix must be specified" << std::endl << std::endl;
-        usage(optionDesciption, argv[0]);
+        usage(std::cerr, optionDesciption, argv[0]);
         return 2;
       }