util: Add stub unit tests for the call types in the m5 utility.
[gem5.git] / util / m5 / src / usage.cc
index a472b1e7cc109abb03eca430978aa842087d0fbf..78bfb413638b06e8b0ab706b0a7e2eb914e9da46 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <cinttypes>
-#include <cstdio>
 #include <cstdlib>
+#include <iostream>
 
 #include "call_type.hh"
-#include "commands.hh"
+#include "command.hh"
 #include "usage.hh"
 
-const char *progname = "{progname}";
+std::string progname;
 
 void
 usage()
 {
-    fprintf(stderr, "Usage: %s [call type] <command> [arguments]\n", progname);
-    fprintf(stderr, "\n");
-    fprintf(stderr, "Call types:\n");
-    fprintf(stderr, CallType::usageSummary().c_str());
-    fprintf(stderr, "\n");
-    fprintf(stderr, "Commands:\n");
-    for (int i = 0; i < num_commands; ++i) {
-        fprintf(stderr, "    %s %s\n",
-                command_table[i].name, command_table[i].usage);
-    }
-    fprintf(stderr, "\n");
-    fprintf(stderr, "All times in nanoseconds!\n");
+    std::cerr << "Usage: " << progname <<
+        "[call type] <command> [arguments]" << std::endl <<
+        std::endl <<
+        "Call types:" << std::endl <<
+        CallType::usageSummary() <<
+        std::endl <<
+        "Commands:" << std::endl <<
+        Command::usageSummary() <<
+        std::endl <<
+        "All times in nanoseconds!" << std::endl;
 
     exit(1);
 }