*
* Built to function with websocketd:
* https://github.com/joewalnes/websocketd
+ *
+ * Synopsis:
+ *
+ * websocketd --port 7684 --max-forks 250 ./osrf-websocket-stdio /path/to/opensrf_core.xml &
+ *
*/
#include <stdio.h>
#define RESET_MESSAGE_SIZE 102400
// default values, replaced during setup (below) as needed.
-static char* config_file = "/openils/conf/opensrf_core.xml"; // TODO
+static char* config_file = "/openils/conf/opensrf_core.xml";
static char* config_ctxt = "gateway";
static char* osrf_router = NULL;
static char* osrf_domain = NULL;
static char* client_ip = NULL;
static void rebuild_stdin_buffer();
-static void child_init();
+static void child_init(int argc, char* argv[]);
static void read_from_stdin();
static void relay_stdin_message(const char*);
static char* extract_inbound_messages();
shut_it_down(0);
}
-int main() {
+int main(int argc, char* argv[]) {
// Handle shutdown signal
signal(SIGINT, sigint_handler);
// Connect to OpenSRF
// exits on error.
- child_init();
+ child_init(argc, argv);
// Disable output buffering.
setbuf(stdout, NULL);
// Connect to opensrf
-static void child_init() {
+static void child_init(int argc, char* argv[]) {
+
+ if (argc > 1) {
+ config_file = argv[1];
+ }
if (!osrf_system_bootstrap_client(config_file, config_ctxt) ) {
fprintf(stderr, "Cannot boostrap OSRF\n");