Use exit-status macros for compatibility 1/3

This commit is contained in:
Robin Gareus 2019-07-04 22:21:14 +02:00
parent bd8897686a
commit dbc0c54ced
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
6 changed files with 22 additions and 23 deletions

View file

@ -51,12 +51,12 @@ load_session (string dir, string state)
if (!engine->set_backend (backend_name, backend_client_name, "")) { if (!engine->set_backend (backend_name, backend_client_name, "")) {
std::cerr << "Cannot set Audio/MIDI engine backend\n"; std::cerr << "Cannot set Audio/MIDI engine backend\n";
::exit (1); exit (EXIT_FAILURE);
} }
if (engine->start () != 0) { if (engine->start () != 0) {
std::cerr << "Cannot start Audio/MIDI engine\n"; std::cerr << "Cannot start Audio/MIDI engine\n";
::exit (1); exit (EXIT_FAILURE);
} }
Session* session = new Session (*engine, dir, state); Session* session = new Session (*engine, dir, state);
@ -165,12 +165,12 @@ int main (int argc, char* argv[])
case 'v': case 'v':
print_version (); print_version ();
::exit (0); exit (EXIT_SUCCESS);
break; break;
case 'h': case 'h':
print_help (); print_help ();
exit (0); exit (EXIT_SUCCESS);
break; break;
case 'c': case 'c':
@ -187,7 +187,7 @@ int main (int argc, char* argv[])
case 'D': case 'D':
if (PBD::parse_debug_options (optarg)) { if (PBD::parse_debug_options (optarg)) {
::exit (1); exit (EXIT_SUCCESS);
} }
break; break;
@ -207,18 +207,18 @@ int main (int argc, char* argv[])
default: default:
print_help (); print_help ();
::exit (1); exit (EXIT_FAILURE);
} }
} }
if (argc < 3) { if (argc < 3) {
print_help (); print_help ();
::exit (1); exit (EXIT_FAILURE);
} }
if (!ARDOUR::init (use_vst, try_hw_optimization, localedir)) { if (!ARDOUR::init (use_vst, try_hw_optimization, localedir)) {
cerr << "Ardour failed to initialize\n" << endl; cerr << "Ardour failed to initialize\n" << endl;
::exit (1); exit (EXIT_FAILURE);
} }
Session* s = 0; Session* s = 0;
@ -258,6 +258,5 @@ int main (int argc, char* argv[])
AudioEngine::instance()->stop (); AudioEngine::instance()->stop ();
AudioEngine::destroy (); AudioEngine::destroy ();
return 0; return 0;
} }

View file

@ -290,7 +290,7 @@ int main (int argc, char* argv[])
break; break;
case 'h': case 'h':
usage (0); usage (EXIT_SUCCESS);
break; break;
case 'l': case 'l':
@ -304,7 +304,7 @@ int main (int argc, char* argv[])
case 'V': case 'V':
printf ("ardour-utils version %s\n\n", VERSIONSTRING); printf ("ardour-utils version %s\n\n", VERSIONSTRING);
printf ("Copyright (C) GPL 2016 Robin Gareus <robin@gareus.org>\n"); printf ("Copyright (C) GPL 2016 Robin Gareus <robin@gareus.org>\n");
exit (0); exit (EXIT_SUCCESS);
break; break;
case 'v': case 'v':
@ -330,19 +330,19 @@ int main (int argc, char* argv[])
if (!ends_with (src, statefile_suffix)) { if (!ends_with (src, statefile_suffix)) {
fprintf (stderr, "source is not a .ardour session file.\n"); fprintf (stderr, "source is not a .ardour session file.\n");
exit (1); exit (EXIT_FAILURE);
} }
if (!ends_with (dst, statefile_suffix)) { if (!ends_with (dst, statefile_suffix)) {
fprintf (stderr, "target is not a .ardour session file.\n"); 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)) { if (!Glib::file_test (src, Glib::FILE_TEST_IS_REGULAR)) {
fprintf (stderr, "source is not a regular file.\n"); fprintf (stderr, "source is not a regular file.\n");
exit (1); exit (EXIT_FAILURE);
} }
if (!Glib::file_test (dst, Glib::FILE_TEST_IS_REGULAR)) { if (!Glib::file_test (dst, Glib::FILE_TEST_IS_REGULAR)) {
fprintf (stderr, "target is not a regular file.\n"); fprintf (stderr, "target is not a regular file.\n");
exit (1); exit (EXIT_FAILURE);
} }
std::string src_path = Glib::path_get_dirname (src); std::string src_path = Glib::path_get_dirname (src);

View file

@ -287,11 +287,11 @@ int main (int argc, char* argv[])
case 'V': case 'V':
printf ("ardour-utils version %s\n\n", VERSIONSTRING); printf ("ardour-utils version %s\n\n", VERSIONSTRING);
printf ("Copyright (C) GPL 2015,2017 Robin Gareus <robin@gareus.org>\n"); printf ("Copyright (C) GPL 2015,2017 Robin Gareus <robin@gareus.org>\n");
exit (0); exit (EXIT_SUCCESS);
break; break;
case 'h': case 'h':
usage (0); usage (EXIT_SUCCESS);
break; break;
default: default:

View file

@ -416,18 +416,18 @@ int main (int argc, char* argv[])
case 'o': case 'o':
outfile = optarg; outfile = optarg;
if (outfile.empty()) { if (outfile.empty()) {
usage (0); usage (EXIT_SUCCESS);
} }
break; break;
case 'V': case 'V':
printf ("ardour-utils version %s\n\n", VERSIONSTRING); printf ("ardour-utils version %s\n\n", VERSIONSTRING);
printf ("Copyright (C) GPL 2015 Robin Gareus <robin@gareus.org>\n"); printf ("Copyright (C) GPL 2015 Robin Gareus <robin@gareus.org>\n");
exit (0); exit (EXIT_SUCCESS);
break; break;
case 'h': case 'h':
usage (0); usage (EXIT_SUCCESS);
break; break;
default: default:

View file

@ -70,11 +70,11 @@ int main (int argc, char* argv[])
case 'V': case 'V':
printf ("ardour-utils version %s\n\n", VERSIONSTRING); printf ("ardour-utils version %s\n\n", VERSIONSTRING);
printf ("Copyright (C) GPL 2017 Robin Gareus <robin@gareus.org>\n"); printf ("Copyright (C) GPL 2017 Robin Gareus <robin@gareus.org>\n");
exit (0); exit (EXIT_SUCCESS);
break; break;
case 'h': case 'h':
usage (0); usage (EXIT_SUCCESS);
break; break;
default: default:

View file

@ -52,7 +52,7 @@ foreach (json_decode ($json, true) as $b) {
if (count ($doc) == 0) { if (count ($doc) == 0) {
fwrite (STDERR, "Failed to read luadoc.json\n"); fwrite (STDERR, "Failed to read luadoc.json\n");
exit (1); exit (EXIT_FAILURE);
} }
################################################################################ ################################################################################