diff options
Diffstat (limited to 'cpp/src/slice2html/Main.cpp')
-rw-r--r-- | cpp/src/slice2html/Main.cpp | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/cpp/src/slice2html/Main.cpp b/cpp/src/slice2html/Main.cpp index 3b03ff9493c..905bb773a0c 100644 --- a/cpp/src/slice2html/Main.cpp +++ b/cpp/src/slice2html/Main.cpp @@ -63,6 +63,7 @@ usage(const char* n) "Options:\n" "-h, --help Show this message.\n" "-v, --version Display the Ice version.\n" + "--validate Validate command line options.\n" "-DNAME Define NAME as 1.\n" "-DNAME=DEF Define NAME as DEF.\n" "-UNAME Remove any definition for NAME.\n" @@ -90,6 +91,7 @@ compile(int argc, char* argv[]) IceUtilInternal::Options opts; opts.addOpt("h", "help"); opts.addOpt("v", "version"); + opts.addOpt("", "validate"); opts.addOpt("D", "", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); opts.addOpt("U", "", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); opts.addOpt("I", "", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); @@ -108,6 +110,16 @@ 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; + } + } + vector<string> args; try { @@ -116,7 +128,10 @@ compile(int argc, char* argv[]) catch(const IceUtilInternal::BadOptException& e) { getErrorStream() << argv[0] << ": error: " << e.reason << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } @@ -173,7 +188,10 @@ compile(int argc, char* argv[]) { getErrorStream() << argv[0] << ": error: the --index operation requires a positive integer argument" << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } } @@ -194,7 +212,10 @@ compile(int argc, char* argv[]) { getErrorStream() << argv[0] << ": error: the --summary operation requires a positive integer argument" << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } } @@ -208,10 +229,18 @@ compile(int argc, char* argv[]) if(args.empty()) { getErrorStream() << argv[0] << ": error: no input file" << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } + if(validate) + { + return EXIT_SUCCESS; + } + UnitPtr p = Unit::createUnit(true, false, ice, underscore); int status = EXIT_SUCCESS; |