summaryrefslogtreecommitdiffstats
path: root/src/ingen
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-04-04 09:27:49 +0000
committerDavid Robillard <d@drobilla.net>2015-04-04 09:27:49 +0000
commit9c5ad6b64f33ea07654435e93a8b6f726894581f (patch)
treecd83370c2a06707dff0b731c084741a737d5b972 /src/ingen
parent52bce39f06f607dd363ca8f3b774fda658036cf4 (diff)
downloadingen-9c5ad6b64f33ea07654435e93a8b6f726894581f.tar.gz
ingen-9c5ad6b64f33ea07654435e93a8b6f726894581f.tar.bz2
ingen-9c5ad6b64f33ea07654435e93a8b6f726894581f.zip
Support GNU style long options.
Update usage output and man page to distinguish flags from options that take a value. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5660 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/ingen')
-rw-r--r--src/ingen/ingen.cpp30
1 files changed, 12 insertions, 18 deletions
diff --git a/src/ingen/ingen.cpp b/src/ingen/ingen.cpp
index 4ee45441..12a17e99 100644
--- a/src/ingen/ingen.cpp
+++ b/src/ingen/ingen.cpp
@@ -64,7 +64,7 @@ static void
ingen_try(bool cond, const char* msg)
{
if (!cond) {
- cerr << "ingen: Error: " << msg << endl;
+ cerr << "ingen: error: " << msg << endl;
delete world;
exit(EXIT_FAILURE);
}
@@ -101,7 +101,7 @@ main(int argc, char** argv)
return print_version();
}
} catch (std::exception& e) {
- cout << "ingen: " << e.what() << endl;
+ cout << "ingen: error: " << e.what() << endl;
return EXIT_FAILURE;
}
@@ -113,8 +113,7 @@ main(int argc, char** argv)
// Run engine
SPtr<Interface> engine_interface;
if (conf.option("engine").get<int32_t>()) {
- ingen_try(world->load_module("server"),
- "Unable to load server module");
+ ingen_try(world->load_module("server"), "Failed to load server module");
ingen_try(bool(world->engine()), "Unable to create engine");
world->engine()->listen();
@@ -124,8 +123,7 @@ main(int argc, char** argv)
// If we don't have a local engine interface (for GUI), use network
if (!engine_interface) {
- ingen_try(world->load_module("client"),
- "Unable to load client module");
+ ingen_try(world->load_module("client"), "Failed to load client module");
#ifdef HAVE_SOCKET
Client::SocketClient::register_factories(world);
#endif
@@ -136,9 +134,9 @@ main(int argc, char** argv)
engine_interface = world->new_interface(Raul::URI(uri), client);
if (!engine_interface && !conf.option("gui").get<int32_t>()) {
- cerr << fmt("ingen: Error: Unable to create interface to `%1%'\n");
+ cerr << (fmt("ingen: error: Failed to connect to `%1%'\n") % uri);
delete world;
- exit(EXIT_FAILURE);
+ return EXIT_FAILURE;
}
}
@@ -146,19 +144,17 @@ main(int argc, char** argv)
// Load GUI if requested
if (conf.option("gui").get<int32_t>()) {
- ingen_try(world->load_module("gui"),
- "Unable to load GUI module");
+ ingen_try(world->load_module("gui"), "Failed to load GUI module");
}
// Activate the engine, if we have one
if (world->engine()) {
- ingen_try(world->load_module("jack"),
- "Unable to load jack module");
+ ingen_try(world->load_module("jack"), "Failed to load jack module");
world->engine()->activate();
}
// Load a graph
- if (conf.option("load").is_valid() || !conf.files().empty()) {
+ if (conf.option("load").is_valid()) {
boost::optional<Raul::Path> parent;
boost::optional<Raul::Symbol> symbol;
@@ -175,16 +171,14 @@ main(int argc, char** argv)
}
}
- ingen_try(bool(world->parser()), "Unable to create parser");
+ ingen_try(bool(world->parser()), "Failed to create parser");
- const string path = (conf.option("load").is_valid()
- ? conf.option("load").ptr<char>()
- : conf.files().front());
+ const string graph = conf.option("load").ptr<char>();
engine_interface->get(Raul::URI("ingen:/plugins"));
engine_interface->get(Node::root_uri());
world->parser()->parse_file(
- world, engine_interface.get(), path, parent, symbol);
+ world, engine_interface.get(), graph, parent, symbol);
}
// Set up signal handlers that will set quit_flag on interrupt