By setting the SIGINT handler with sigaction(2), automatic retries of
the splice(2) syscall can be disabled by not setting SA_RESTART. This
makes it possible to use Ctrl+C even if the "if" operand refers to the
controlling terminal. The SIGINT message has also been moved outside
the signal handler since fprintf(3) is not an async-signal-safe
function.
Avoid blocking in a call to splice() when no input is available.
We can now break out of dd using ^C even if the input is coming from
/dev/stdin.
Use tabs instead of spaces.
This code was written by Sebastian Krahmer and you can find
the original version at https://github.com/stealth/odd.git.
Permission has been granted to release this code under MIT/X
for ubase. It has been simplified by sin@2f30.org.
Thanks Sebastian!