r279: msvc compatibility changes
[ctsim.git] / tools / ifinfo.cpp
index 09ddfd677d07471e123ac8f7a9a56848264b36e0..f423460765779356433ad95ec00530fa20e3871a 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ifinfo.cpp,v 1.1 2000/07/13 07:01:35 kevin Exp $
+**  $Id: ifinfo.cpp,v 1.5 2000/12/17 23:30:48 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -46,29 +46,32 @@ static struct option my_options[] =
   {0, 0, 0, 0}
 };
 
+static const char* g_szIdStr = "$Id: ifinfo.cpp,v 1.5 2000/12/17 23:30:48 kevin Exp $";
+
+
 void 
 ifinfo_usage (const char *program)
 {
-  cout << "usage: " << fileBasename(program) << " image-filename [OPTIONS]" << endl;
-  cout << "Imagefile information" << endl;
-  cout << endl;
-  cout << "     infile       Name of input IF file" << endl;
-  cout << "     --display    Display image" << endl;
-  cout << "     --labels     Print image labels (default)" << endl;
-  cout << "     --no-labels  Do not print image labels" << endl;
-  cout << "     --stats      Print image statistics (default)" << endl;
-  cout << "     --no-stats   Do not print image statistics" << endl;
-  cout << "     --debug      Debug mode" << endl;
-  cout << "     --verbose    Verbose mode" << endl;
-  cout << "     --version    Print version" << endl;
-  cout << "     --help       Print this help message" << endl;
+  std::cout << "usage: " << fileBasename(program) << " image-filename [OPTIONS]\n";
+  std::cout << "Imagefile information\n";
+  std::cout << std::endl;
+  std::cout << "     infile       Name of input IF file\n";
+  std::cout << "     --display    Display image\n";
+  std::cout << "     --labels     Print image labels (default)\n";
+  std::cout << "     --no-labels  Do not print image labels\n";
+  std::cout << "     --stats      Print image statistics (default)\n";
+  std::cout << "     --no-stats   Do not print image statistics\n";
+  std::cout << "     --debug      Debug mode\n";
+  std::cout << "     --verbose    Verbose mode\n";
+  std::cout << "     --version    Print version\n";
+  std::cout << "     --help       Print this help message\n";
 }
 
 int 
 ifinfo_main (int argc, char *const argv[])
 {
   ImageFile *im = NULL;
-  string in_file;
+  std::string in_file;
   int opt_verbose = 0;
   int opt_stats = 1;
   int opt_labels = 1;
@@ -103,9 +106,9 @@ ifinfo_main (int argc, char *const argv[])
          break;
         case O_VERSION:
 #ifdef VERSION
-          cout << "Version " <<  VERSION << endl;
+         std::cout << "Version " << VERSION << std::endl << g_szIdStr << std::endl;
 #else
-          cout << "Unknown version number" << endl;
+          std::cout << "Unknown version number\n";
 #endif
          return (0);
        case O_HELP:
@@ -132,11 +135,11 @@ ifinfo_main (int argc, char *const argv[])
   }
 
   if (opt_labels) 
-    im->printLabels (cout);
+    im->printLabels (std::cout);
 
   if (opt_stats) {
-    cout << "Size: (" << im->nx() << "," << im->ny() << ")" << endl;
-    im->printStatistics (cout);
+    std::cout << "Size: (" << im->nx() << "," << im->ny() << ")\n";
+    im->printStatistics (std::cout);
   }
 
   return (0);
@@ -151,9 +154,9 @@ main (int argc, char *const argv[])
   try {
     retval = ifinfo_main(argc, argv);
   } catch (exception e) {
-    cerr << "Exception: " << e.what() << endl;
+         std::cerr << "Exception: " << e.what() << std::endl;
   } catch (...) {
-    cerr << "Unknown exception" << endl;
+         std::cerr << "Unknown exception\n";
   }
 
   return (retval);