Index: src/bin/dd/args.c =================================================================== RCS file: /home/ncvs/src/bin/dd/args.c,v retrieving revision 1.27 diff -u -r1.27 args.c --- src/bin/dd/args.c 2000/10/22 23:00:32 1.27 +++ src/bin/dd/args.c 2001/06/21 08:58:45 @@ -298,7 +298,9 @@ { "ibm", C_EBCDIC, C_ASCII, a2ibm_POSIX }, { "lcase", C_LCASE, C_UCASE, NULL }, { "noerror", C_NOERROR, 0, NULL }, + { "noread", C_NOREAD, 0, NULL }, { "notrunc", C_NOTRUNC, 0, NULL }, + { "nowrite", C_NOWRITE, 0, NULL }, { "oldascii", C_ASCII, C_EBCDIC, e2a_32V }, { "oldebcdic", C_EBCDIC, C_ASCII, a2e_32V }, { "oldibm", C_EBCDIC, C_ASCII, a2ibm_32V }, Index: src/bin/dd/dd.c =================================================================== RCS file: /home/ncvs/src/bin/dd/dd.c,v retrieving revision 1.31 diff -u -r1.31 dd.c --- src/bin/dd/dd.c 2000/10/10 01:48:22 1.31 +++ src/bin/dd/dd.c 2001/06/21 08:58:45 @@ -273,10 +273,14 @@ memset(in.dbp, 0, in.dbsz); } - n = read(in.fd, in.dbp, in.dbsz); - if (n == 0) { - in.dbrcnt = 0; - return; + if (!(ddflags & C_NOREAD)) { + n = read(in.fd, in.dbp, in.dbsz); + if (n == 0) { + in.dbrcnt = 0; + return; + } + } else { + n = in.dbsz; } /* Read error. */ @@ -422,13 +426,18 @@ err(2, "%s: seek error creating sparse file", out.name); if (force) - write(out.fd, outp, 1); + if (!(ddflags & C_NOWRITE)) + write(out.fd, outp, 1); pending = 0; } - if (cnt) - nw = write(out.fd, outp, cnt); - else + if (cnt) { + if (!(ddflags & C_NOWRITE)) + nw = write(out.fd, outp, cnt); + else + nw = cnt; + } else { return; + } } if (nw <= 0) { Index: src/bin/dd/dd.h =================================================================== RCS file: /home/ncvs/src/bin/dd/dd.h,v retrieving revision 1.16 diff -u -r1.16 dd.h --- src/bin/dd/dd.h 2000/07/01 05:36:25 1.16 +++ src/bin/dd/dd.h 2001/06/21 08:58:45 @@ -99,3 +99,5 @@ #define C_UNBLOCK 0x80000 #define C_OSYNC 0x100000 #define C_SPARSE 0x200000 +#define C_NOREAD 0x400000 +#define C_NOWRITE 0x800000