Commit Graph

26 Commits

Author SHA1 Message Date
Eric Pruitt
55795531f0 dd: Use sigaction(2) to obviate select(2)
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.
2017-10-10 16:28:15 +01:00
Eivind Uggedal
e0dc3f9546 dd: implement conv=notrunc support 2016-03-16 10:17:51 +00:00
Eivind Uggedal
596663c1b1 dd: truncate file when using seek= 2016-03-16 10:17:51 +00:00
Eivind Uggedal
e358d74a80 dd: don't let failure to change pipe size affect exit code 2016-03-16 10:17:51 +00:00
Eivind Uggedal
c64b5b04c7 dd: allow count=0 2016-03-16 10:17:51 +00:00
Eivind Uggedal
e5d88b0f30 dd: remove if= noatime optimization 2016-03-16 10:17:51 +00:00
Eivind Uggedal
05a69d9d0d dd: always create of= even if seek= is used 2016-03-16 10:17:51 +00:00
izabera
3af0bbd564 fix several problems in dd 2016-01-04 18:07:44 +00:00
Hiltjo Posthuma
c7f472f468 dd: code-style, linewrap 2015-02-06 15:16:23 +00:00
sin
8fe02392ed dd: Only sync once 2015-02-02 22:32:56 +00:00
sin
86060b535c Fix includes across all tools 2014-06-30 19:04:47 +01:00
sin
d3e332c72d Ensure a select() failure is properly signalled to the caller 2014-06-11 13:08:16 +01:00
sin
d2c215f9ab Re-order some code in dd(1) 2014-06-11 13:05:12 +01:00
sin
0ca8e52bc1 Use select() in dd(1)
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.
2014-06-11 13:02:58 +01:00
sin
c94dfdc99d Update dd usage 2014-06-11 12:00:23 +01:00
sin
3754c402ca Fix dd(1) usage line 2014-06-11 11:54:32 +01:00
sin
8ab8a4cad0 Staticise copy_splice() 2014-06-04 20:50:43 +01:00
sin
ba3366646a Use %1023s as opposed to %1023c
Using %1023c doesn't work with musl.
2014-06-04 15:36:18 +01:00
sin
e2c6ab9a76 Simplify print_stat() 2014-06-04 13:53:10 +01:00
sin
9c7d08773f Fallback to pagesize transfers in dd(1) 2014-06-04 13:39:08 +01:00
sin
a4e8cf6664 Use the macros from inttypes.h to properly print uint64_t 2014-06-04 13:22:54 +01:00
sin
6ea2b1aa53 Use estrtoul() in dd(1)
Allow specifications in hex and octal as well.
2014-06-04 13:13:00 +01:00
sin
144a893268 Ensure a proper exit code
If copy() fails at least print stats.
2014-06-04 13:06:46 +01:00
sin
7fa098ace6 Use eprintf() wherever possible, add -h to options 2014-06-04 13:04:45 +01:00
sin
5c66e30060 Nuke a harmless warning 2014-06-04 12:19:46 +01:00
sin
207ba019fd Add initial version of dd(1).
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!
2014-06-04 11:47:38 +01:00