| 149 | } |
| 150 | |
| 151 | static void InitConfig(struct pax::tools::DumpConfig *config, int argc, |
| 152 | char **argv) { |
| 153 | int c = 0; |
| 154 | if (argc > 1) { |
| 155 | if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") == 0 || |
| 156 | strcmp(argv[1], "-h") == 0) { |
| 157 | Usage(); |
| 158 | exit(0); |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | optind = 1; |
| 163 | while (optind < argc) { |
| 164 | while ((c = getopt_long(argc, argv, "vf:g:c:r:t:ampesbod", long_options, |
| 165 | NULL)) != -1) { |
| 166 | switch (c) { |
| 167 | case 'f': { |
| 168 | if (!optarg) { |
| 169 | goto invalid_args; |
| 170 | } |
| 171 | config->file_name = strdup(optarg); |
| 172 | break; |
| 173 | } |
| 174 | case 'g': { |
| 175 | if (!optarg) { |
| 176 | goto invalid_args; |
| 177 | } |
| 178 | std::tie(config->group_id_start, config->group_id_len) = |
| 179 | ParseRangeConfig(optarg); |
| 180 | break; |
| 181 | } |
| 182 | case 'c': { |
| 183 | if (!optarg) { |
| 184 | goto invalid_args; |
| 185 | } |
| 186 | std::tie(config->column_id_start, config->column_id_len) = |
| 187 | ParseRangeConfig(optarg); |
| 188 | break; |
| 189 | } |
| 190 | case 'r': { |
| 191 | if (!optarg) { |
| 192 | goto invalid_args; |
| 193 | } |
| 194 | std::tie(config->row_id_start, config->row_id_len) = |
| 195 | ParseRangeConfig(optarg); |
| 196 | break; |
| 197 | } |
| 198 | case 't': { |
| 199 | if (!optarg) { |
| 200 | goto invalid_args; |
| 201 | } |
| 202 | config->toast_file_name = strdup(optarg); |
| 203 | break; |
| 204 | } |
| 205 | case 'a': { |
| 206 | config->print_all = true; |
| 207 | break; |
| 208 | } |
no test coverage detected