-static void write_all(int fd, const void *buf, size_t count) {
- const char* cbuf = buf;
- size_t written = 0;
- while (written < count) {
- int ret = write(fd, &cbuf[written], count - written);
- if (ret == -1) err(EX_IOERR, "Could not write");
- written += ret;
- }
-}
-
-void reverse_file(const char* input_filename, int output_fd) {