summaryrefslogtreecommitdiff
path: root/cpp/src/IceGrid/Client.cpp
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2007-08-24 14:41:39 +0800
committerMatthew Newhook <matthew@zeroc.com>2007-08-24 14:41:39 +0800
commit9ff48829c8669fbef8c7ca6a9b8bab99c77db2f9 (patch)
tree7fa0a0406be0386a8314b2e8c742f29bf127b70d /cpp/src/IceGrid/Client.cpp
parentMerge branch 'bug1319' (diff)
downloadice-9ff48829c8669fbef8c7ca6a9b8bab99c77db2f9.tar.bz2
ice-9ff48829c8669fbef8c7ca6a9b8bab99c77db2f9.tar.xz
ice-9ff48829c8669fbef8c7ca6a9b8bab99c77db2f9.zip
Squashed commit of the following:
commit d74cec9e6c77e70b33883f517b1bb6f97b2ffa5e Author: Matthew Newhook <matthew@zeroc.com> Date: Fri Aug 24 14:33:06 2007 +0800 updates. commit 643b31f979a00ea5397206ca59f20bb58c62660e Author: Matthew Newhook <matthew@zeroc.com> Date: Fri Aug 24 14:32:35 2007 +0800 added some .gitignore rules. commit 1510d38798976753b435f32308e79acd9fcd2722 Author: Matthew Newhook <matthew@zeroc.com> Date: Fri Aug 24 14:05:10 2007 +0800 removed bogus use of 127.0.0.1 commit 3c91e89b01af20a0dacfdbc1fbeca1c67c796656 Author: Matthew Newhook <matthew@zeroc.com> Date: Fri Aug 24 14:01:43 2007 +0800 Verify that cygwin python is used under Windows. commit ff160725c051eedb28a42d9dd69f0d8aa297e522 Author: Matthew Newhook <matthew@zeroc.com> Date: Fri Aug 24 13:55:03 2007 +0800 bump timeout for the node to terminate. killing the node leaves the servers running under cygwin commit ec3bddb58e861f906bf39aee1fa818c3e9a50000 Author: Matthew Newhook <matthew@zeroc.com> Date: Fri Aug 24 13:48:55 2007 +0800 added back accidently removed files. commit f9ea2f552d7f576ebfa878669925f4184a89257b Author: Matthew Newhook <matthew@zeroc.com> Date: Fri Aug 24 13:47:47 2007 +0800 http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=2427, http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=2422 commit 8a309ca0036dba7ecbd577edb2d737fa41174a5a Author: Matthew Newhook <matthew@zeroc.com> Date: Fri Aug 24 10:06:53 2007 +0800 added ruby support to the expect scripts. commit 34597c1ee6d80d6754c9e925bd376125dd104a5f Author: Matthew Newhook <matthew@zeroc.com> Date: Fri Aug 24 09:26:10 2007 +0800 added pexpect to git repository. commit 4bd2e1f2b52bcb9906b03ac216db686b8229b545 Author: Matthew Newhook <matthew@zeroc.com> Date: Thu Aug 23 18:49:51 2007 +0800 numerous UNIX expect script fixes. commit 25ab4a812f45a6e908d5d2d7ab03e557d79afa9f Author: Matthew Newhook <matthew@zeroc.com> Date: Thu Aug 23 16:47:08 2007 +0800 generate configuration files for IceGrid icebox/iceboxd commit 6bb57bf7ed21d7256963c228aaf0b20657367a47 Author: Matthew Newhook <matthew@zeroc.com> Date: Thu Aug 23 15:16:55 2007 +0800 added python & C# support to the expect scripts. commit 08f1a59971ad3a52a4357069554dcc309b2d062b Author: Matthew Newhook <matthew@zeroc.com> Date: Wed Aug 22 14:23:53 2007 +0800 java expect scripts complete. commit 3918f4ff3beea3005001bc55c5502c0825d8b7ea Author: Matthew Newhook <matthew@zeroc.com> Date: Wed Aug 22 13:30:31 2007 +0800 first set of expect changes.
Diffstat (limited to 'cpp/src/IceGrid/Client.cpp')
-rw-r--r--cpp/src/IceGrid/Client.cpp87
1 files changed, 7 insertions, 80 deletions
diff --git a/cpp/src/IceGrid/Client.cpp b/cpp/src/IceGrid/Client.cpp
index f421c781af2..55adf95850d 100644
--- a/cpp/src/IceGrid/Client.cpp
+++ b/cpp/src/IceGrid/Client.cpp
@@ -129,15 +129,11 @@ main(int argc, char* argv[])
void
Client::usage()
{
- cerr << "Usage: " << appName() << " [options] [file...]\n";
+ cerr << "Usage: " << appName() << " [options]\n";
cerr <<
"Options:\n"
"-h, --help Show this message.\n"
"-v, --version Display the Ice version.\n"
- "-DNAME Define NAME as 1.\n"
- "-DNAME=DEF Define NAME as DEF.\n"
- "-UNAME Remove any definition for NAME.\n"
- "-IDIR Put DIR in the include file search path.\n"
"-e COMMANDS Execute COMMANDS.\n"
"-d, --debug Print debug messages.\n"
"-s, --server Start icegridadmin as a server (to parse XML files).\n"
@@ -252,16 +248,12 @@ Client::interrupted()
int
Client::run(int argc, char* argv[])
{
- string cpp("cpp");
string commands;
bool debug;
IceUtil::Options opts;
opts.addOpt("h", "help");
opts.addOpt("v", "version");
- opts.addOpt("D", "", IceUtil::Options::NeedArg, "", IceUtil::Options::Repeat);
- opts.addOpt("U", "", IceUtil::Options::NeedArg, "", IceUtil::Options::Repeat);
- opts.addOpt("I", "", IceUtil::Options::NeedArg, "", IceUtil::Options::Repeat);
opts.addOpt("e", "", IceUtil::Options::NeedArg, "", IceUtil::Options::Repeat);
opts.addOpt("u", "username", IceUtil::Options::NeedArg, "", IceUtil::Options::NoRepeat);
opts.addOpt("p", "password", IceUtil::Options::NeedArg, "", IceUtil::Options::NoRepeat);
@@ -281,6 +273,11 @@ Client::run(int argc, char* argv[])
usage();
return EXIT_FAILURE;
}
+ if(!args.empty())
+ {
+ usage();
+ return EXIT_FAILURE;
+ }
if(opts.isSet("help"))
{
@@ -305,30 +302,6 @@ Client::run(int argc, char* argv[])
return EXIT_SUCCESS;
}
- if(opts.isSet("D"))
- {
- vector<string> optargs = opts.argVec("D");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cpp += " -D" + *i;
- }
- }
- if(opts.isSet("U"))
- {
- vector<string> optargs = opts.argVec("U");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cpp += " -U" + *i;
- }
- }
- if(opts.isSet("I"))
- {
- vector<string> optargs = opts.argVec("I");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cpp += " -I" + *i;
- }
- }
if(opts.isSet("e"))
{
vector<string> optargs = opts.argVec("e");
@@ -339,13 +312,6 @@ Client::run(int argc, char* argv[])
}
debug = opts.isSet("debug");
- if(!args.empty() && !commands.empty())
- {
- cerr << appName() << ": `-e' option cannot be used if input files are given" << endl;
- usage();
- return EXIT_FAILURE;
- }
-
bool ssl = communicator()->getProperties()->getPropertyAsInt("IceGridAdmin.AuthenticateUsingSSL");
if(opts.isSet("ssl"))
{
@@ -586,46 +552,7 @@ Client::run(int argc, char* argv[])
_parser = Parser::createParser(communicator(), session, admin, args.empty() && commands.empty());
}
- if(!args.empty()) // Files given
- {
- // Process files given on the command line
- for(vector<string>::const_iterator i = args.begin(); i != args.end(); ++i)
- {
- ifstream test(i->c_str());
- if(!test)
- {
- cerr << appName() << ": can't open `" << *i << "' for reading: " << strerror(errno) << endl;
- return EXIT_FAILURE;
- }
- test.close();
-
- string cmd = cpp + " " + *i;
-#ifdef _WIN32
- FILE* cppHandle = _popen(cmd.c_str(), "r");
-#else
- FILE* cppHandle = popen(cmd.c_str(), "r");
-#endif
- if(cppHandle == NULL)
- {
- cerr << appName() << ": can't run C++ preprocessor: " << strerror(errno) << endl;
- return EXIT_FAILURE;
- }
-
- int parseStatus = _parser->parse(cppHandle, debug);
-
-#ifdef _WIN32
- _pclose(cppHandle);
-#else
- pclose(cppHandle);
-#endif
-
- if(parseStatus == EXIT_FAILURE)
- {
- status = EXIT_FAILURE;
- }
- }
- }
- else if(!commands.empty()) // Commands were given
+ if(!commands.empty()) // Commands were given
{
int parseStatus = _parser->parse(commands, debug);
if(parseStatus == EXIT_FAILURE)