]> git.evergreen-ils.org Git - OpenSRF.git/blob - src/libstack/opensrf.c
92919301ce2bfaa58beed5e3907cc5e15bb7cd1f
[OpenSRF.git] / src / libstack / opensrf.c
1 #include "osrf_system.h"
2 #include "osrf_hash.h"
3 #include "osrf_list.h"
4
5 int main( int argc, char* argv[] ) {
6
7         if( argc < 4 ) {
8                 fprintf(stderr, "Usage: %s <host> <bootstrap_config> <config_context>\n", argv[0]);
9                 return 1;
10         }
11
12         fprintf(stderr, "Loading OpenSRF host %s with bootstrap config %s "
13                         "and config context %s\n", argv[1], argv[2], argv[3] );
14
15         /* these must be strdup'ed because init_proc_title / set_proc_title 
16                 are evil and overwrite the argv memory */
17         char* host              = strdup( argv[1] );
18         char* config    = strdup( argv[2] );
19         char* context   = strdup( argv[3] );
20
21         init_proc_title( argc, argv );
22         set_proc_title( "OpenSRF System-C" );
23
24         int ret = osrfSystemBootstrap( host, config, context );
25
26         if (ret != 0) {
27                 osrfLogError(
28                         OSRF_LOG_MARK,
29                         "Server Loop returned an error condition, exiting with %d",
30                         ret
31                 );
32         }
33
34
35         free(host);
36         free(config);
37         free(context);
38
39         return ret;
40 }
41
42