00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "omniEvents.h"
00025
00026 #define NEED_PACKAGE_INFO
00027 #ifdef HAVE_CONFIG_H
00028 # include "config.h"
00029 #endif
00030
00031 #ifdef HAVE_IOSTREAM
00032 # include <iostream>
00033 #else
00034 # include <iostream.h>
00035 #endif
00036
00037 #ifdef HAVE_STDLIB_H
00038 # include <stdlib.h>
00039 #endif
00040
00041 #ifdef HAVE_STD_IOSTREAM
00042 using namespace std;
00043 #endif
00044
00045 #include "defaults.h"
00046
00047 namespace OmniEvents {
00048
00049 void usage(int argc, char **argv)
00050 {
00051 const char* command =(argc?argv[0]:PACKAGE_NAME);
00052 cout<<
00053 "\n"
00054 #ifdef __WIN32__
00055 "just run it: "<<command<<" [OPTIONS]\n"
00056 "install service: "<<command<<" install [OPTIONS]\n"
00057 "uninstall service: "<<command<<" uninstall\n"
00058 "set service options: "<<command<<" setoptions [OPTIONS]\n"
00059 "get service options: "<<command<<" getoptions\n"
00060 #else
00061 "Run the " PACKAGE_NAME " daemon.\n"
00062 "\n"
00063 "cold start syntax: "<<command<<" [-pPORT] "
00064 # ifdef HAVE_OMNIORB4
00065 "[-aENDPOINT] "
00066 # endif
00067 "[OPTIONS]\n"
00068 "warm start syntax: "<<command<<" [OPTIONS]\n"
00069 #endif
00070 "\n"
00071 "COLD START OPTIONS:\n"
00072 " -p PORT configure server port [11169]\n"
00073 #ifdef HAVE_OMNIORB4
00074 " -a ENDPOINT set alternate endPoint for failover\n"
00075 #endif
00076 "\n"
00077 "OPTIONS:\n"
00078 " -l PATH full path to data directory* [" OMNIEVENTS_LOG_DEFAULT_LOCATION "]\n"
00079 #ifndef __WIN32__
00080 " -P PIDFILE keep track of running instance in PIDFILE.\n"
00081 #endif
00082 " -N ID factory naming service id [\"EventChannelFactory\"]\n"
00083 #ifndef __WIN32__
00084 " -f Stay in the foreground.\n"
00085 #endif
00086 " -t FILE Send trace messages to FILE instead of syslog.\n"
00087 " -v print the IOR of the new EventChannelFactory.\n"
00088 " -V display version\n"
00089 " -h display this help text\n"
00090 "\n"
00091 "*You can also set the environment variable "<<OMNIEVENTS_LOGDIR_ENV_VAR<<"\n"
00092 "to specify the directory where the data files are kept.\n" << endl;
00093 exit(0);
00094 }
00095
00096
00097 void insertArgs(int& argc, char**& argv, int idx, int nargs)
00098 {
00099 char** newArgv = new char*[argc+nargs];
00100 int i;
00101 for (i = 0; i < idx; i++) {
00102 newArgv[i] = argv[i];
00103 }
00104 for (i = idx; i < argc; i++) {
00105 newArgv[i+nargs] = argv[i];
00106 }
00107 argv = newArgv;
00108 argc += nargs;
00109 }
00110
00111 }
00112