OmniEvents
|
00001 // Package : omniEvents 00002 // omniEvents.cc Created : 1/4/98 00003 // Author : Paul Nader (pwn) 00004 // 00005 // Copyright (C) 1998 Paul Nader, 2003-2005 Alex Tingle 00006 // 00007 // This file is part of the omniEvents application. 00008 // 00009 // omniEvents is free software; you can redistribute it and/or 00010 // modify it under the terms of the GNU Lesser General Public 00011 // License as published by the Free Software Foundation; either 00012 // version 2.1 of the License, or (at your option) any later version. 00013 // 00014 // omniEvents is distributed in the hope that it will be useful, 00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 // Lesser General Public License for more details. 00018 // 00019 // You should have received a copy of the GNU Lesser General Public 00020 // License along with this library; if not, write to the Free Software 00021 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 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> // exit() 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 } // end namespace OmniEvents 00112