From dbc0c54ced49c24fbfbb88b0ccf02f8bc0cc78e1 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 4 Jul 2019 22:21:14 +0200 Subject: [PATCH] Use exit-status macros for compatibility 1/3 --- headless/load_session.cc | 17 ++++++++--------- session_utils/copy-mixer.cc | 12 ++++++------ session_utils/export.cc | 4 ++-- session_utils/fix_bbtppq.cc | 6 +++--- session_utils/new_empty_session.cc | 4 ++-- tools/fmt-luadoc.php | 2 +- 6 files changed, 22 insertions(+), 23 deletions(-) diff --git a/headless/load_session.cc b/headless/load_session.cc index 47fd5151b1..8551b4a4d5 100644 --- a/headless/load_session.cc +++ b/headless/load_session.cc @@ -51,12 +51,12 @@ load_session (string dir, string state) if (!engine->set_backend (backend_name, backend_client_name, "")) { std::cerr << "Cannot set Audio/MIDI engine backend\n"; - ::exit (1); + exit (EXIT_FAILURE); } if (engine->start () != 0) { std::cerr << "Cannot start Audio/MIDI engine\n"; - ::exit (1); + exit (EXIT_FAILURE); } Session* session = new Session (*engine, dir, state); @@ -165,12 +165,12 @@ int main (int argc, char* argv[]) case 'v': print_version (); - ::exit (0); + exit (EXIT_SUCCESS); break; case 'h': print_help (); - exit (0); + exit (EXIT_SUCCESS); break; case 'c': @@ -187,7 +187,7 @@ int main (int argc, char* argv[]) case 'D': if (PBD::parse_debug_options (optarg)) { - ::exit (1); + exit (EXIT_SUCCESS); } break; @@ -207,18 +207,18 @@ int main (int argc, char* argv[]) default: print_help (); - ::exit (1); + exit (EXIT_FAILURE); } } if (argc < 3) { print_help (); - ::exit (1); + exit (EXIT_FAILURE); } if (!ARDOUR::init (use_vst, try_hw_optimization, localedir)) { cerr << "Ardour failed to initialize\n" << endl; - ::exit (1); + exit (EXIT_FAILURE); } Session* s = 0; @@ -258,6 +258,5 @@ int main (int argc, char* argv[]) AudioEngine::instance()->stop (); AudioEngine::destroy (); - return 0; } diff --git a/session_utils/copy-mixer.cc b/session_utils/copy-mixer.cc index 88ed8a0f20..660b8a59e0 100644 --- a/session_utils/copy-mixer.cc +++ b/session_utils/copy-mixer.cc @@ -290,7 +290,7 @@ int main (int argc, char* argv[]) break; case 'h': - usage (0); + usage (EXIT_SUCCESS); break; case 'l': @@ -304,7 +304,7 @@ int main (int argc, char* argv[]) case 'V': printf ("ardour-utils version %s\n\n", VERSIONSTRING); printf ("Copyright (C) GPL 2016 Robin Gareus \n"); - exit (0); + exit (EXIT_SUCCESS); break; case 'v': @@ -330,19 +330,19 @@ int main (int argc, char* argv[]) if (!ends_with (src, statefile_suffix)) { fprintf (stderr, "source is not a .ardour session file.\n"); - exit (1); + exit (EXIT_FAILURE); } if (!ends_with (dst, statefile_suffix)) { fprintf (stderr, "target is not a .ardour session file.\n"); - exit (1); + exit (EXIT_FAILURE); } if (!Glib::file_test (src, Glib::FILE_TEST_IS_REGULAR)) { fprintf (stderr, "source is not a regular file.\n"); - exit (1); + exit (EXIT_FAILURE); } if (!Glib::file_test (dst, Glib::FILE_TEST_IS_REGULAR)) { fprintf (stderr, "target is not a regular file.\n"); - exit (1); + exit (EXIT_FAILURE); } std::string src_path = Glib::path_get_dirname (src); diff --git a/session_utils/export.cc b/session_utils/export.cc index 4531595abf..2f63d14ac5 100644 --- a/session_utils/export.cc +++ b/session_utils/export.cc @@ -287,11 +287,11 @@ int main (int argc, char* argv[]) case 'V': printf ("ardour-utils version %s\n\n", VERSIONSTRING); printf ("Copyright (C) GPL 2015,2017 Robin Gareus \n"); - exit (0); + exit (EXIT_SUCCESS); break; case 'h': - usage (0); + usage (EXIT_SUCCESS); break; default: diff --git a/session_utils/fix_bbtppq.cc b/session_utils/fix_bbtppq.cc index 952202856e..d8a04a120c 100644 --- a/session_utils/fix_bbtppq.cc +++ b/session_utils/fix_bbtppq.cc @@ -416,18 +416,18 @@ int main (int argc, char* argv[]) case 'o': outfile = optarg; if (outfile.empty()) { - usage (0); + usage (EXIT_SUCCESS); } break; case 'V': printf ("ardour-utils version %s\n\n", VERSIONSTRING); printf ("Copyright (C) GPL 2015 Robin Gareus \n"); - exit (0); + exit (EXIT_SUCCESS); break; case 'h': - usage (0); + usage (EXIT_SUCCESS); break; default: diff --git a/session_utils/new_empty_session.cc b/session_utils/new_empty_session.cc index 6dc0151d0b..b44c32fc20 100644 --- a/session_utils/new_empty_session.cc +++ b/session_utils/new_empty_session.cc @@ -70,11 +70,11 @@ int main (int argc, char* argv[]) case 'V': printf ("ardour-utils version %s\n\n", VERSIONSTRING); printf ("Copyright (C) GPL 2017 Robin Gareus \n"); - exit (0); + exit (EXIT_SUCCESS); break; case 'h': - usage (0); + usage (EXIT_SUCCESS); break; default: diff --git a/tools/fmt-luadoc.php b/tools/fmt-luadoc.php index b13e38617c..79c0a791bc 100755 --- a/tools/fmt-luadoc.php +++ b/tools/fmt-luadoc.php @@ -52,7 +52,7 @@ foreach (json_decode ($json, true) as $b) { if (count ($doc) == 0) { fwrite (STDERR, "Failed to read luadoc.json\n"); - exit (1); + exit (EXIT_FAILURE); } ################################################################################