From 618cc0fdd1e16df81e57006a03ed673a5de85124 Mon Sep 17 00:00:00 2001 From: David Dight Date: Sun, 9 Jun 2024 08:33:39 +1000 Subject: [PATCH] msvc type fix 3 --- examples/srcloctest.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/examples/srcloctest.cpp b/examples/srcloctest.cpp index d32641d4..ec763941 100644 --- a/examples/srcloctest.cpp +++ b/examples/srcloctest.cpp @@ -35,7 +35,6 @@ #include #include #include -#include //----------------------------------------------------------------------------------------- enum class Namespace_Enum_Type : int { Value }; @@ -138,27 +137,24 @@ int main(int argc, char **argv) conjure_type::tpeek(), }; - static constexpr const char *optstr{"emch"}; bool md{}, ext{}, comp{true}; - for (int opt; (opt = getopt(argc, argv, optstr)) != -1;) + for (int ii{1}; ii < argc; ++ii) { - switch (opt) + if (std::string_view(argv[ii]).find("-m") != std::string_view::npos) + md = true; + if (std::string_view(argv[ii]).find("-c") != std::string_view::npos) + comp = false; + if (std::string_view(argv[ii]).find("-e") != std::string_view::npos) + ext = true; + if (std::string_view(argv[ii]).find("-h") != std::string_view::npos) { - case 'm': md = true; break; - case 'c': comp = false; break; - case 'e': ext = true; break; - case ':': case '?': std::cout << '\n'; - [[fallthrough]]; - case 'h': - std::cout << "Usage: " << argv[0] << " [-" << optstr << "]" << R"( + std::cout << "Usage: " << argv[0] << " [-ecmh]" << R"( -e run extended enum test -c show compiler (default true) -m output using markdown -h help )"; exit(1); - default: - break; } }