[PATCH xorg-gtest 5/9] Split usage help text into a helper function

Peter Hutterer peter.hutterer at who-t.net
Mon Jul 2 22:48:17 PDT 2012


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/xorg-gtest_main.cpp |   25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/src/xorg-gtest_main.cpp b/src/xorg-gtest_main.cpp
index bbf232b..08927a0 100644
--- a/src/xorg-gtest_main.cpp
+++ b/src/xorg-gtest_main.cpp
@@ -105,6 +105,18 @@ static void setup_signal_handlers() {
                 << signals[i] << "\n";
 }
 
+static int usage(int exitcode) {
+  std::cout << "\nAdditional options:\n";
+  std::cout << "    --no-dummy-server: Use the currently running X server "
+               "for testing\n";
+  std::cout << "    --xorg-conf: Path to xorg dummy configuration file\n";
+  std::cout << "    --server: Path to X server executable\n";
+  std::cout << "    --xorg-display: xorg dummy display port\n";
+  std::cout << "    --xorg-logfile: xorg logfile filename. See -logfile in \"man Xorg\".\n"
+               "                    Its default value is "DEFAULT_XORG_LOGFILE".\n";
+  return exitcode;
+}
+
 int main(int argc, char *argv[]) {
   std::string xorg_conf_path;
   std::string xorg_log_file_path;
@@ -151,17 +163,8 @@ int main(int argc, char *argv[]) {
     }
   }
 
-  if (help) {
-    std::cout << "\nAdditional options:\n";
-    std::cout << "    --no-dummy-server: Use the currently running X server "
-        "for testing\n";
-    std::cout << "    --xorg-conf: Path to xorg dummy configuration file\n";
-    std::cout << "    --server: Path to X server executable\n";
-    std::cout << "    --xorg-display: xorg dummy display port\n";
-    std::cout << "    --xorg-logfile: xorg logfile filename. See -logfile in \"man Xorg\".\n"
-                 "                    Its default value is "DEFAULT_XORG_LOGFILE".\n";
-    exit(-1);
-  }
+  if (help)
+    return usage(-1);
 
   if (!no_dummy_server) {
     environment = new xorg::testing::Environment;
-- 
1.7.10.2



More information about the xorg-devel mailing list