On Mon, 6 Nov 2006, Karel Kulhavy wrote:
> The behaviour of dd on OpenBSD 3.9 is noncompliant to it's own OpenBSD
> manpage:
>
> OpenBSD:
> [EMAIL PROTECTED]:~$ dd bs=1 skip=2
> 1234
> 1234
> 5+0 records in
> 5+0 records out
> 5 bytes transferred in 1.764 secs (3 bytes/sec)
>
> Linux:
> [EMAIL PROTECTED] ~ $ dd bs=1 skip=2
> 1234
> 34
> 3+0 records in
> 3+0 records out
> 3 bytes (3 B) copied, 1.71841 seconds, 0.0 kB/s
Seeking a tty does not fail, but does not position the stream as well.
This fixes it. Note that echo "1234" | dd bs=1 skip=2 already works fine.
-Otto
Index: position.c
===================================================================
RCS file: /cvs/src/bin/dd/position.c,v
retrieving revision 1.7
diff -u -p -r1.7 position.c
--- position.c 11 Jun 2003 23:42:12 -0000 1.7
+++ position.c 6 Nov 2006 12:07:54 -0000
@@ -71,7 +71,7 @@ pos_in(void)
int warned;
/* If not a pipe or tape device, try to seek on it. */
- if (!(in.flags & (ISPIPE|ISTAPE))) {
+ if (!(in.flags & (ISPIPE|ISTAPE|ISCHR))) {
if (lseek(in.fd, in.offset * in.dbsz, SEEK_CUR) == -1)
err(1, "%s", in.name);
return;