#define NOERROR 0x0008
#define SYNC 0x0010
#define SILENT 0x0020
+#define NOTRUNC 0x0040
#define BLANK ' '
#define DEFAULT 512
void (*convert) ();
#endif
char *iptr;
- int i, j;
+ int i, j, oflags;
convert = null;
argc--;
convflag |= NOERROR;
continue;
}
+ if (is("notrunc")) {
+ convflag |= NOTRUNC;
+ continue;
+ }
if (is("sync")) {
convflag |= SYNC;
continue;
(ifilename) ? ifilename : "stdin", strerror(errno));
exit(1);
}
- if ((ofd = ((ofilename) ? open(ofilename, seekseen ? O_WRONLY | O_CREAT
- : O_WRONLY | O_CREAT | O_TRUNC, 0666)
+ oflags = O_WRONLY | O_CREAT;
+ if (!seekseen && (convflag & NOTRUNC) != NOTRUNC)
+ oflags |= O_TRUNC;
+ if ((ofd = ((ofilename) ? open(ofilename, oflags, 0666)
: dup(1))) < 0) {
fprintf(stderr, "dd: Can't open %s: %s\n",
(ofilename) ? ofilename : "stdout", strerror(errno));
\fBconv = swab\fR \- Swap every pair of bytes
.br
\fBconv = noerror\fR \- Ignore errors and just keep going
+.br
+ \fBconv = notrunc\fR \- Do not truncate unmodified blocks
.br
\fBconv = silent\fR \- Suppress statistics (MINIX 3 specific flag)
.PP