summaryrefslogtreecommitdiff
path: root/cpp/src/slice2html/Main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/slice2html/Main.cpp')
-rw-r--r--cpp/src/slice2html/Main.cpp35
1 files changed, 15 insertions, 20 deletions
diff --git a/cpp/src/slice2html/Main.cpp b/cpp/src/slice2html/Main.cpp
index 0b9a0b24590..818882ceb61 100644
--- a/cpp/src/slice2html/Main.cpp
+++ b/cpp/src/slice2html/Main.cpp
@@ -56,7 +56,7 @@ interruptedCallback(int /*signal*/)
}
void
-usage(const char* n)
+usage(const string& n)
{
getErrorStream() << "Usage: " << n << " [options] slice-files...\n";
getErrorStream() <<
@@ -86,7 +86,7 @@ usage(const char* n)
}
int
-compile(int argc, char* argv[])
+compile(const vector<string>& argv)
{
IceUtilInternal::Options opts;
opts.addOpt("h", "help");
@@ -110,20 +110,11 @@ compile(int argc, char* argv[])
opts.addOpt("", "ice");
opts.addOpt("", "underscore");
- bool validate = false;
- for(int i = 0; i < argc; ++i)
- {
- if(string(argv[i]) == "--validate")
- {
- validate = true;
- break;
- }
- }
-
+ bool validate = find(argv.begin(), argv.end(), "--validate") != argv.end();
vector<string> args;
try
{
- args = opts.parse(argc, const_cast<const char**>(argv));
+ args = opts.parse(argv);
}
catch(const IceUtilInternal::BadOptException& e)
{
@@ -336,31 +327,35 @@ compile(int argc, char* argv[])
return status;
}
-int
-main(int argc, char* argv[])
+#ifdef _WIN32
+int wmain(int argc, wchar_t* argv[])
+#else
+int main(int argc, char* argv[])
+#endif
{
+ vector<string> args = argvToArgs(argc, argv);
try
{
- return compile(argc, argv);
+ return compile(args);
}
catch(const std::exception& ex)
{
- getErrorStream() << argv[0] << ": error:" << ex.what() << endl;
+ getErrorStream() << args[0] << ": error:" << ex.what() << endl;
return EXIT_FAILURE;
}
catch(const std::string& msg)
{
- getErrorStream() << argv[0] << ": error:" << msg << endl;
+ getErrorStream() << args[0] << ": error:" << msg << endl;
return EXIT_FAILURE;
}
catch(const char* msg)
{
- getErrorStream() << argv[0] << ": error:" << msg << endl;
+ getErrorStream() << args[0] << ": error:" << msg << endl;
return EXIT_FAILURE;
}
catch(...)
{
- getErrorStream() << argv[0] << ": error:" << "unknown exception" << endl;
+ getErrorStream() << args[0] << ": error:" << "unknown exception" << endl;
return EXIT_FAILURE;
}
}