| 191 | */ |
| 192 | |
| 193 | int main( int argc, char* argv[]) |
| 194 | { |
| 195 | #ifdef HAVE_LOCALE_H |
| 196 | // Pick up the system locale to allow SYSTEM<->UTF8 conversions |
| 197 | setlocale(LC_CTYPE, ""); |
| 198 | #endif |
| 199 | |
| 200 | const SCHAR* const prog_name = argv[0]; |
| 201 | |
| 202 | if (argc < 2) |
| 203 | { |
| 204 | fprintf(stderr, "%s: No Command Line Option Specified\n", argv[0]); |
| 205 | print_clo(prog_name); |
| 206 | return FB_FAILURE; |
| 207 | } |
| 208 | |
| 209 | // Fields initialization |
| 210 | |
| 211 | b_fil* file_ptr = NULL; |
| 212 | b_fil* file_list = NULL; |
| 213 | b_fil* prev_file = NULL; |
| 214 | SINT64 file_size = -1; |
| 215 | gsplit_option sw_replace = IN_SW_SPIT_0; |
| 216 | |
| 217 | |
| 218 | // Initialize in_sw_table table. |
| 219 | |
| 220 | const Switches switches(spit_in_sw_table, FB_NELEM(spit_in_sw_table), false, false); |
| 221 | |
| 222 | // validating command line options |
| 223 | |
| 224 | SLONG ret_cd, file_num = 0; |
| 225 | bool file_nm_sw = false; |
| 226 | const SCHAR* string = NULL; |
| 227 | |
| 228 | const SCHAR* const* const end = argv + argc; |
| 229 | ++argv; |
| 230 | while (argv < end) |
| 231 | { |
| 232 | string = *argv; |
| 233 | if (*string == '-') |
| 234 | { |
| 235 | argv++; |
| 236 | ret_cd = get_function_option(prog_name, &sw_replace, string, switches); |
| 237 | if (ret_cd == FB_FAILURE) |
| 238 | { |
| 239 | free_file_list(file_list); |
| 240 | return FB_FAILURE; |
| 241 | } |
| 242 | } // end of processing (*string == '-') |
| 243 | else |
| 244 | { |
| 245 | // processing function specific command line options |
| 246 | |
| 247 | switch (sw_replace) |
| 248 | { |
| 249 | case IN_SW_SPIT_SP: |
| 250 | if (!file_nm_sw) |
nothing calls this directly
no test coverage detected