| 2402 | } |
| 2403 | |
| 2404 | int |
| 2405 | main (int argc, char **argv) |
| 2406 | { |
| 2407 | off_t offset; |
| 2408 | |
| 2409 | install_signal_handlers (); |
| 2410 | |
| 2411 | initialize_main (&argc, &argv); |
| 2412 | set_program_name (argv[0]); |
| 2413 | setlocale (LC_ALL, ""); |
| 2414 | bindtextdomain (PACKAGE, LOCALEDIR); |
| 2415 | textdomain (PACKAGE); |
| 2416 | |
| 2417 | /* Arrange to close stdout if parse_long_options exits. */ |
| 2418 | atexit (maybe_close_stdout); |
| 2419 | |
| 2420 | page_size = getpagesize (); |
| 2421 | |
| 2422 | parse_gnu_standard_options_only (argc, argv, PROGRAM_NAME, PACKAGE, Version, |
| 2423 | true, usage, AUTHORS, |
| 2424 | (char const *) NULL); |
| 2425 | close_stdout_required = false; |
| 2426 | |
| 2427 | /* Initialize translation table to identity translation. */ |
| 2428 | for (int i = 0; i < 256; i++) |
| 2429 | trans_table[i] = i; |
| 2430 | |
| 2431 | /* Decode arguments. */ |
| 2432 | scanargs (argc, argv); |
| 2433 | |
| 2434 | apply_translations (); |
| 2435 | |
| 2436 | if (input_file == NULL) |
| 2437 | { |
| 2438 | input_file = _("standard input"); |
| 2439 | set_fd_flags (STDIN_FILENO, input_flags, input_file); |
| 2440 | } |
| 2441 | else |
| 2442 | { |
| 2443 | if (ifd_reopen (STDIN_FILENO, input_file, O_RDONLY | input_flags, 0) < 0) |
| 2444 | error (EXIT_FAILURE, errno, _("failed to open %s"), |
| 2445 | quoteaf (input_file)); |
| 2446 | } |
| 2447 | |
| 2448 | offset = lseek (STDIN_FILENO, 0, SEEK_CUR); |
| 2449 | input_seekable = (0 <= offset); |
| 2450 | input_offset = MAX (0, offset); |
| 2451 | input_seek_errno = errno; |
| 2452 | |
| 2453 | if (output_file == NULL) |
| 2454 | { |
| 2455 | output_file = _("standard output"); |
| 2456 | set_fd_flags (STDOUT_FILENO, output_flags, output_file); |
| 2457 | } |
| 2458 | else |
| 2459 | { |
| 2460 | mode_t perms = MODE_RW_UGO; |
| 2461 | int opts |
nothing calls this directly
no test coverage detected