| 88 | bool show_version_info = false; |
| 89 | |
| 90 | int covscript_args(int args_size, char *args[]) |
| 91 | { |
| 92 | int expect_csym = 0; |
| 93 | int expect_log_path = 0; |
| 94 | int expect_import_path = 0; |
| 95 | int expect_stack_resize = 0; |
| 96 | int index = 1; |
| 97 | for (; index < args_size; ++index) { |
| 98 | if (expect_csym == 1) { |
| 99 | csym_path = cs::process_path(args[index]); |
| 100 | expect_csym = 2; |
| 101 | } |
| 102 | else if (expect_log_path == 1) { |
| 103 | log_path = cs::process_path(args[index]); |
| 104 | expect_log_path = 2; |
| 105 | } |
| 106 | else if (expect_import_path == 1) { |
| 107 | cs::current_process->import_path += cs::path_delimiter + cs::process_path(args[index]); |
| 108 | expect_import_path = 2; |
| 109 | } |
| 110 | else if (expect_stack_resize == 1) { |
| 111 | cs::current_process->resize_stack(std::stoul(args[index])); |
| 112 | expect_stack_resize = 2; |
| 113 | } |
| 114 | else if (args[index][0] == '-') { |
| 115 | if ((std::strcmp(args[index], "--help") == 0 || std::strcmp(args[index], "-h") == 0) && |
| 116 | !show_help_info) |
| 117 | show_help_info = true; |
| 118 | else if ((std::strcmp(args[index], "--silent") == 0 || std::strcmp(args[index], "-s") == 0) && !silent) |
| 119 | silent = true; |
| 120 | else if ((std::strcmp(args[index], "--version") == 0 || std::strcmp(args[index], "-v") == 0) && |
| 121 | !show_version_info) |
| 122 | show_version_info = true; |
| 123 | else if ((std::strcmp(args[index], "--wait-before-exit") == 0 || std::strcmp(args[index], "-w") == 0) && |
| 124 | !wait_before_exit) |
| 125 | wait_before_exit = true; |
| 126 | else if ((std::strcmp(args[index], "--csym") == 0 || std::strcmp(args[index], "-g") == 0) && |
| 127 | expect_csym == 0) |
| 128 | expect_csym = 1; |
| 129 | else if ((std::strcmp(args[index], "--log-path") == 0 || std::strcmp(args[index], "-l") == 0) && |
| 130 | expect_log_path == 0) |
| 131 | expect_log_path = 1; |
| 132 | else if ((std::strcmp(args[index], "--import-path") == 0 || std::strcmp(args[index], "-i") == 0) && |
| 133 | expect_import_path == 0) |
| 134 | expect_import_path = 1; |
| 135 | else if ((std::strcmp(args[index], "--stack-resize") == 0 || std::strcmp(args[index], "-S") == 0) && |
| 136 | expect_stack_resize == 0) |
| 137 | expect_stack_resize = 1; |
| 138 | else |
| 139 | throw cs::fatal_error("argument syntax error."); |
| 140 | } |
| 141 | else |
| 142 | break; |
| 143 | } |
| 144 | if (expect_csym == 1 || expect_log_path == 1 || expect_import_path == 1 || expect_import_path == 1) |
| 145 | throw cs::fatal_error("argument syntax error."); |
| 146 | return index; |
| 147 | } |
no test coverage detected