correctly (this is not POSIX.2, but POSIX.2 is wrong)
SCCS-vsn: bin/dd/args.c 8.2
SCCS-vsn: bin/dd/dd.1 8.2
SCCS-vsn: bin/dd/dd.c 8.2
SCCS-vsn: bin/dd/dd.h 8.2
-static char sccsid[] = "@(#)args.c 8.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)args.c 8.2 (Berkeley) %G%";
#endif /* not lint */
#include <sys/types.h>
#endif /* not lint */
#include <sys/types.h>
void (*f) __P((char *));
u_int set, noset;
} args[] = {
void (*f) __P((char *));
u_int set, noset;
} args[] = {
- "bs", f_bs, C_BS, C_BS|C_IBS|C_OBS,
+ "bs", f_bs, C_BS, C_BS|C_IBS|C_OBS|C_OSYNC,
"cbs", f_cbs, C_CBS, C_CBS,
"conv", f_conv, 0, 0,
"count", f_count, C_COUNT, C_COUNT,
"cbs", f_cbs, C_CBS, C_CBS,
"conv", f_conv, 0, 0,
"count", f_count, C_COUNT, C_COUNT,
"oldascii", C_ASCII, C_EBCDIC, e2a_32V,
"oldebcdic", C_EBCDIC, C_ASCII, a2e_32V,
"oldibm", C_EBCDIC, C_ASCII, a2ibm_32V,
"oldascii", C_ASCII, C_EBCDIC, e2a_32V,
"oldebcdic", C_EBCDIC, C_ASCII, a2e_32V,
"oldibm", C_EBCDIC, C_ASCII, a2ibm_32V,
+ "osync", C_OSYNC, C_BS, NULL,
"swab", C_SWAB, 0, NULL,
"sync", C_SYNC, 0, NULL,
"ucase", C_UCASE, C_LCASE, NULL,
"swab", C_SWAB, 0, NULL,
"sync", C_SYNC, 0, NULL,
"ucase", C_UCASE, C_LCASE, NULL,
.\"
.\" %sccs.include.redist.roff%
.\"
.\"
.\" %sccs.include.redist.roff%
.\"
-.\" @(#)dd.1 8.1 (Berkeley) %G%
+.\" @(#)dd.1 8.2 (Berkeley) %G%
The
.Cm notrunc
value is not supported for tapes.
The
.Cm notrunc
value is not supported for tapes.
+.It Cm osync
+Pad the final output block to the full output block size.
+If the input file is not a multiple of the output block size
+after conversion, this conversion forces the final output block
+to be the same size as preceding blocks for use on devices that require
+regularly sized blocks to be written.
+This option is incompatible with use of the
+.Cm bs= Ns Ar n
+block size specification.
.It Cm swab
Swap every pair of input bytes.
If an input buffer has an odd number of bytes, the last byte will be
.It Cm swab
Swap every pair of input bytes.
If an input buffer has an odd number of bytes, the last byte will be
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)dd.c 8.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)dd.c 8.2 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
* lose the minimum amount of data. If doing block operations
* use spaces.
*/
* lose the minimum amount of data. If doing block operations
* use spaces.
*/
- if (flags & (C_NOERROR|C_SYNC))
+ if ((flags & (C_NOERROR|C_SYNC)) == (C_NOERROR|C_SYNC))
if (flags & (C_BLOCK|C_UNBLOCK))
memset(in.dbp, ' ', in.dbsz);
else
if (flags & (C_BLOCK|C_UNBLOCK))
memset(in.dbp, ' ', in.dbsz);
else
block_close();
else if (cfunc == unblock)
unblock_close();
block_close();
else if (cfunc == unblock)
unblock_close();
+ if (ddflags & C_OSYNC && out.dbcnt < out.dbsz) {
+ bzero(out.dbp, out.dbsz - out.dbcnt);
+ out.dbcnt = out.dbsz;
+ }
if (out.dbcnt)
dd_out(1);
}
if (out.dbcnt)
dd_out(1);
}
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)dd.h 8.1 (Berkeley) %G%
+ * @(#)dd.h 8.2 (Berkeley) %G%
*/
/* Input/output stream state. */
*/
/* Input/output stream state. */
#define C_SYNC 0x20000
#define C_UCASE 0x40000
#define C_UNBLOCK 0x80000
#define C_SYNC 0x20000
#define C_UCASE 0x40000
#define C_UNBLOCK 0x80000
+#define C_OSYNC 0x100000