| 679 | Return true if successful. */ |
| 680 | |
| 681 | static bool |
| 682 | cwrite (bool new_file_flag, char const *bp, idx_t bytes) |
| 683 | { |
| 684 | if (new_file_flag) |
| 685 | { |
| 686 | if (!bp && bytes == 0 && elide_empty_files) |
| 687 | return true; |
| 688 | closeout (NULL, output_desc, filter_pid, outfile); |
| 689 | next_file_name (); |
| 690 | output_desc = create (outfile); |
| 691 | if (output_desc < 0) |
| 692 | error (EXIT_FAILURE, errno, "%s", quotef (outfile)); |
| 693 | } |
| 694 | |
| 695 | if (full_write (output_desc, bp, bytes) == bytes) |
| 696 | return true; |
| 697 | else |
| 698 | { |
| 699 | if (! ignorable (errno)) |
| 700 | error (EXIT_FAILURE, errno, "%s", quotef (outfile)); |
| 701 | return false; |
| 702 | } |
| 703 | } |
| 704 | |
| 705 | /* Split into pieces of exactly N_BYTES bytes. |
| 706 | However, the first REM_BYTES pieces should be 1 byte longer. |
no test coverage detected