OmniEvents
omniEvents.cc
Go to the documentation of this file.
1 // Package : omniEvents
2 // omniEvents.cc Created : 1/4/98
3 // Author : Paul Nader (pwn)
4 //
5 // Copyright (C) 1998 Paul Nader, 2003-2005 Alex Tingle
6 //
7 // This file is part of the omniEvents application.
8 //
9 // omniEvents is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU Lesser General Public
11 // License as published by the Free Software Foundation; either
12 // version 2.1 of the License, or (at your option) any later version.
13 //
14 // omniEvents is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 // Lesser General Public License for more details.
18 //
19 // You should have received a copy of the GNU Lesser General Public
20 // License along with this library; if not, write to the Free Software
21 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 //
23 
24 #include "omniEvents.h"
25 
26 #define NEED_PACKAGE_INFO
27 #ifdef HAVE_CONFIG_H
28 # include "config.h"
29 #endif
30 
31 #ifdef HAVE_IOSTREAM
32 # include <iostream>
33 #else
34 # include <iostream.h>
35 #endif
36 
37 #ifdef HAVE_STDLIB_H
38 # include <stdlib.h> // exit()
39 #endif
40 
41 #ifdef HAVE_STD_IOSTREAM
42 using namespace std;
43 #endif
44 
45 #include "defaults.h"
46 
47 namespace OmniEvents {
48 
49 void usage(int argc, char **argv)
50 {
51  const char* command =(argc?argv[0]:PACKAGE_NAME);
52  cout<<
53  "\n"
54 #ifdef __WIN32__
55  "just run it: "<<command<<" [OPTIONS]\n"
56  "install service: "<<command<<" install [OPTIONS]\n"
57  "uninstall service: "<<command<<" uninstall\n"
58  "set service options: "<<command<<" setoptions [OPTIONS]\n"
59  "get service options: "<<command<<" getoptions\n"
60 #else
61  "Run the " PACKAGE_NAME " daemon.\n"
62  "\n"
63  "cold start syntax: "<<command<<" [-pPORT] "
64 # ifdef HAVE_OMNIORB4
65  "[-aENDPOINT] "
66 # endif
67  "[OPTIONS]\n"
68  "warm start syntax: "<<command<<" [OPTIONS]\n"
69 #endif
70  "\n"
71  "COLD START OPTIONS:\n"
72  " -p PORT configure server port [11169]\n"
73 #ifdef HAVE_OMNIORB4
74  " -a ENDPOINT set alternate endPoint for failover\n"
75 #endif
76  "\n"
77  "OPTIONS:\n"
78  " -l PATH full path to data directory* [" OMNIEVENTS_LOG_DEFAULT_LOCATION "]\n"
79 #ifndef __WIN32__
80  " -P PIDFILE keep track of running instance in PIDFILE.\n"
81 #endif
82  " -N ID factory naming service id [\"EventChannelFactory\"]\n"
83 #ifndef __WIN32__
84  " -f Stay in the foreground.\n"
85 #endif
86  " -t FILE Send trace messages to FILE instead of syslog.\n"
87  " -v print the IOR of the new EventChannelFactory.\n"
88  " -V display version\n"
89  " -h display this help text\n"
90  "\n"
91  "*You can also set the environment variable "<<OMNIEVENTS_LOGDIR_ENV_VAR<<"\n"
92  "to specify the directory where the data files are kept.\n" << endl;
93  exit(0);
94 }
95 
96 
97 void insertArgs(int& argc, char**& argv, int idx, int nargs)
98 {
99  char** newArgv = new char*[argc+nargs];
100  int i;
101  for (i = 0; i < idx; i++) {
102  newArgv[i] = argv[i];
103  }
104  for (i = idx; i < argc; i++) {
105  newArgv[i+nargs] = argv[i];
106  }
107  argv = newArgv;
108  argc += nargs;
109 }
110 
111 } // end namespace OmniEvents
112 
#define PACKAGE_NAME
Definition: config.h:158
#define OMNIEVENTS_LOG_DEFAULT_LOCATION
Define OMNIEVENTS_LOG_DEFAULT_LOCATION to specify the default location where the omniEvents server ex...
Definition: defaults.h:93
#define OMNIEVENTS_LOGDIR_ENV_VAR
Define OMNIEVENTS_LOGDIR_ENV_VAR to specify the environment variable that users may set to override t...
Definition: defaults.h:100
void insertArgs(int &argc, char **&argv, int idx, int nargs)
Utility function, used to manipulate argv when using omniORB3.
Definition: omniEvents.cc:97
void usage(int argc, char **argv)
Definition: omniEvents.cc:49