summaryrefslogtreecommitdiff
path: root/cpp/src/IcePatch2/Calc.cpp
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2009-08-07 11:10:57 +0800
committerMatthew Newhook <matthew@zeroc.com>2009-08-07 11:10:57 +0800
commite47e08887c823824bfc36f102c065075737394b1 (patch)
treedcbb175cb6ba3204ac55a06d61d28c488227ab4f /cpp/src/IcePatch2/Calc.cpp
parentRevert "4171 - Global namespace pollution" (diff)
downloadice-e47e08887c823824bfc36f102c065075737394b1.tar.bz2
ice-e47e08887c823824bfc36f102c065075737394b1.tar.xz
ice-e47e08887c823824bfc36f102c065075737394b1.zip
Revert "Changes for bug 3962 and 4714"
This reverts commit d38ad95e45c0083d602a43e6d77e6c1599f324fe.
Diffstat (limited to 'cpp/src/IcePatch2/Calc.cpp')
-rw-r--r--cpp/src/IcePatch2/Calc.cpp48
1 files changed, 15 insertions, 33 deletions
diff --git a/cpp/src/IcePatch2/Calc.cpp b/cpp/src/IcePatch2/Calc.cpp
index 525657e6f7a..5c67f7445ee 100644
--- a/cpp/src/IcePatch2/Calc.cpp
+++ b/cpp/src/IcePatch2/Calc.cpp
@@ -101,7 +101,7 @@ public:
};
void
-usage(const string& appName)
+usage(const char* appName)
{
cerr << "Usage: " << appName << " [options] DIR [FILES...]\n";
cerr <<
@@ -116,10 +116,8 @@ usage(const string& appName)
}
int
-mainInternal(const Ice::StringSeq& args)
+main(int argc, char* argv[])
{
- assert(args.size() > 0);
- const string appName = args[0];
string dataDir;
StringSeq fileSeq;
int compress = 1;
@@ -134,24 +132,24 @@ mainInternal(const Ice::StringSeq& args)
opts.addOpt("V", "verbose");
opts.addOpt("i", "case-insensitive");
- vector<string> noArgs;
+ vector<string> args;
try
{
#if defined(__BCPLUSPLUS__) && (__BCPLUSPLUS__ >= 0x0600)
IceUtil::DummyBCC dummy;
#endif
- noArgs = opts.parse(args);
+ args = opts.parse(argc, (const char**)argv);
}
catch(const IceUtilInternal::BadOptException& e)
{
cerr << e.reason << endl;
- usage(appName);
+ usage(argv[0]);
return EXIT_FAILURE;
}
if(opts.isSet("help"))
{
- usage(appName);
+ usage(argv[0]);
return EXIT_SUCCESS;
}
if(opts.isSet("version"))
@@ -163,8 +161,8 @@ mainInternal(const Ice::StringSeq& args)
bool dontCompress = opts.isSet("no-compress");
if(doCompress && dontCompress)
{
- cerr << appName << ": only one of -z and -Z are mutually exclusive" << endl;
- usage(appName);
+ cerr << argv[0] << ": only one of -z and -Z are mutually exclusive" << endl;
+ usage(argv[0]);
return EXIT_FAILURE;
}
if(doCompress)
@@ -180,15 +178,15 @@ mainInternal(const Ice::StringSeq& args)
if(args.empty())
{
- cerr << appName << ": no data directory specified" << endl;
- usage(appName);
+ cerr << argv[0] << ": no data directory specified" << endl;
+ usage(argv[0]);
return EXIT_FAILURE;
}
- dataDir = simplify(noArgs[0]);
+ dataDir = simplify(args[0]);
- for(vector<string>::size_type i = 1; i < noArgs.size(); ++i)
+ for(vector<string>::size_type i = 1; i < args.size(); ++i)
{
- fileSeq.push_back(simplify(noArgs[i]));
+ fileSeq.push_back(simplify(args[i]));
}
try
@@ -310,30 +308,14 @@ mainInternal(const Ice::StringSeq& args)
}
catch(const string& ex)
{
- cerr << appName << ": " << ex << endl;
+ cerr << argv[0] << ": " << ex << endl;
return EXIT_FAILURE;
}
catch(const char* ex)
{
- cerr << appName << ": " << ex << endl;
+ cerr << argv[0] << ": " << ex << endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
-
-#ifdef _WIN32
-
-int
-wmain(int argc, wchar_t* argv[])
-
-#else
-
-int
-main(int argc, char* argv[])
-
-#endif
-{
- int rc = mainInternal(Ice::argsToStringSeq(argc, argv));
- return rc;
-}