Fresco/Berlin/server server.cc,1.65,1.66

Neil John Pilgrim <[email protected]>
Newsgroups gmane.comp.video.fresco.cvs
Message-ID <[email protected]>
Update of /cvs/fresco/Fresco/Berlin/server
In directory purcel:/tmp/cvs-serv11810/Berlin/server

Modified Files:
	server.cc 
Log Message:
- Tidy comments
- Add -C/--list-available-consoles option to server (towards bug129)
- Implement support in the console for the new option
- Refactor Console::open to use the new support functions


Index: server.cc
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/server/server.cc,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- server.cc	23 Jan 2003 00:43:01 -0000	1.65
+++ server.cc	8 Feb 2003 20:45:16 -0000	1.66
@@ -203,8 +203,11 @@
              "the resource file to load");
   getopt.add('e', "execute", GetOpt::mandatory,
              "the command to execute upon startup");
-  getopt.add('c', "console", GetOpt::mandatory, "the console to choose");
-  getopt.add('s', "pixels", GetOpt::mandatory, "number of pixels (eg. '640x480')");
+  getopt.add('c', "console", GetOpt::mandatory, "the console to use");
+  getopt.add('C', "list-available-consoles", GetOpt::novalue, 
+             "list known consoles");
+  getopt.add('s', "pixels", GetOpt::mandatory, 
+             "number of pixels (eg. '640x480')");
   size_t argo = getopt.parse(argc, argv);
   argc -= argo;
   argv += argo;
@@ -228,7 +231,7 @@
     getopt.get("export-ref",&value);
     set_server_reference_export_method(value);
   }
-  
+
   value="";
   if (getopt.get("logger", &value))
   {
@@ -345,6 +348,13 @@
       Logger::log(Logger::loader) << "Tracing enabled." << std::endl;
   }
 
+  if (getopt.is_set("list-available-consoles"))
+  {
+      std::cout << "Available consoles:" << endl;
+      Console::list_available(std::cout);
+      return 0;
+  }
+
 #ifdef JPROF
   if (getopt.is_set("profiler"))
   {
@@ -448,7 +458,7 @@
        catch (const std::runtime_error &e)
        {
 	 std::cerr << "ERROR: Failed to open the Console \"" << value
-		   << "\": " << e.what() << std::endl;
+		   << "\":\n\t" << e.what() << std::endl;
 	 exit(2);
        }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.