aboutsummaryrefslogtreecommitdiff
path: root/coreutils/dd.c
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils/dd.c')
-rw-r--r--coreutils/dd.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/coreutils/dd.c b/coreutils/dd.c
index e0af8f4a3..2d91f77ef 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -59,7 +59,7 @@
59//usage: "[if=FILE] [of=FILE] [" IF_FEATURE_DD_IBS_OBS("ibs=N obs=N/") "bs=N] [count=N] [skip=N] [seek=N]\n" 59//usage: "[if=FILE] [of=FILE] [" IF_FEATURE_DD_IBS_OBS("ibs=N obs=N/") "bs=N] [count=N] [skip=N] [seek=N]\n"
60//usage: IF_FEATURE_DD_IBS_OBS( 60//usage: IF_FEATURE_DD_IBS_OBS(
61//usage: " [conv=notrunc|noerror|sync|fsync]\n" 61//usage: " [conv=notrunc|noerror|sync|fsync]\n"
62//usage: " [iflag=skip_bytes|fullblock] [oflag=seek_bytes]" 62//usage: " [iflag=skip_bytes|fullblock] [oflag=seek_bytes|append]"
63//usage: ) 63//usage: )
64//usage:#define dd_full_usage "\n\n" 64//usage:#define dd_full_usage "\n\n"
65//usage: "Copy a file with converting and formatting\n" 65//usage: "Copy a file with converting and formatting\n"
@@ -84,6 +84,7 @@
84//usage: "\n iflag=skip_bytes skip=N is in bytes" 84//usage: "\n iflag=skip_bytes skip=N is in bytes"
85//usage: "\n iflag=fullblock Read full blocks" 85//usage: "\n iflag=fullblock Read full blocks"
86//usage: "\n oflag=seek_bytes seek=N is in bytes" 86//usage: "\n oflag=seek_bytes seek=N is in bytes"
87//usage: "\n oflag=append Open output file in append mode"
87//usage: ) 88//usage: )
88//usage: IF_FEATURE_DD_STATUS( 89//usage: IF_FEATURE_DD_STATUS(
89//usage: "\n status=noxfer Suppress rate output" 90//usage: "\n status=noxfer Suppress rate output"
@@ -143,11 +144,12 @@ enum {
143 /* start of output flags */ 144 /* start of output flags */
144 FLAG_OFLAG_SHIFT = 7, 145 FLAG_OFLAG_SHIFT = 7,
145 FLAG_SEEK_BYTES = (1 << 7) * ENABLE_FEATURE_DD_IBS_OBS, 146 FLAG_SEEK_BYTES = (1 << 7) * ENABLE_FEATURE_DD_IBS_OBS,
147 FLAG_APPEND = (1 << 8) * ENABLE_FEATURE_DD_IBS_OBS,
146 /* end of output flags */ 148 /* end of output flags */
147 FLAG_TWOBUFS = (1 << 8) * ENABLE_FEATURE_DD_IBS_OBS, 149 FLAG_TWOBUFS = (1 << 9) * ENABLE_FEATURE_DD_IBS_OBS,
148 FLAG_COUNT = 1 << 9, 150 FLAG_COUNT = 1 << 10,
149 FLAG_STATUS_NONE = 1 << 10, 151 FLAG_STATUS_NONE = 1 << 11,
150 FLAG_STATUS_NOXFER = 1 << 11, 152 FLAG_STATUS_NOXFER = 1 << 12,
151}; 153};
152 154
153static void dd_output_status(int UNUSED_PARAM cur_signal) 155static void dd_output_status(int UNUSED_PARAM cur_signal)
@@ -270,7 +272,7 @@ int dd_main(int argc UNUSED_PARAM, char **argv)
270 static const char iflag_words[] ALIGN1 = 272 static const char iflag_words[] ALIGN1 =
271 "skip_bytes\0""fullblock\0"; 273 "skip_bytes\0""fullblock\0";
272 static const char oflag_words[] ALIGN1 = 274 static const char oflag_words[] ALIGN1 =
273 "seek_bytes\0"; 275 "seek_bytes\0append\0";
274#endif 276#endif
275#if ENABLE_FEATURE_DD_STATUS 277#if ENABLE_FEATURE_DD_STATUS
276 static const char status_words[] ALIGN1 = 278 static const char status_words[] ALIGN1 =
@@ -459,6 +461,8 @@ int dd_main(int argc UNUSED_PARAM, char **argv)
459 461
460 if (!seek && !(G.flags & FLAG_NOTRUNC)) 462 if (!seek && !(G.flags & FLAG_NOTRUNC))
461 oflag |= O_TRUNC; 463 oflag |= O_TRUNC;
464 if (G.flags & FLAG_APPEND)
465 oflag |= O_APPEND;
462 466
463 xmove_fd(xopen(outfile, oflag), ofd); 467 xmove_fd(xopen(outfile, oflag), ofd);
464 468