logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git

splice.c (516B)


  1. // utils-std: Collection of commonly available Unix tools
  2. // SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  3. // SPDX-License-Identifier: MPL-2.0
  4. // Because that's what our utilities will use :)
  5. #define _POSIX_C_SOURCE 200809L
  6. #define _GNU_SOURCE // for splice
  7. #include <fcntl.h> // splice
  8. #include <stdint.h> // SIZE_MAX
  9. #include <unistd.h> // ssize_t
  10. ssize_t
  11. test(int in, int out)
  12. {
  13. off_t in_pos = 0, out_pos = 0;
  14. return splice(in, &in_pos, out, &out_pos, SIZE_MAX, 0);
  15. }