swab turns off special semantics of bs
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Tue, 30 Jul 1991 05:11:33 +0000 (21:11 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Tue, 30 Jul 1991 05:11:33 +0000 (21:11 -0800)
SCCS-vsn: bin/dd/dd.c 5.9
SCCS-vsn: bin/dd/args.c 5.5

usr/src/bin/dd/args.c
usr/src/bin/dd/dd.c

index fe49991..c29ded8 100644 (file)
@@ -10,7 +10,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)args.c     5.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)args.c     5.5 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/types.h>
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -96,7 +96,7 @@ jcl(argv)
                 * just wanted to set both the input and output block sizes
                 * and didn't want the bs semantics, so we don't warn.
                 */
                 * just wanted to set both the input and output block sizes
                 * and didn't want the bs semantics, so we don't warn.
                 */
-               if (ddflags & (C_BLOCK|C_LCASE|C_UCASE|C_UNBLOCK))
+               if (ddflags & (C_BLOCK|C_LCASE|C_SWAB|C_UCASE|C_UNBLOCK))
                        ddflags &= ~C_BS;
 
                /* Bs supersedes ibs and obs. */
                        ddflags &= ~C_BS;
 
                /* Bs supersedes ibs and obs. */
index 46fd43e..816ea71 100644 (file)
@@ -16,7 +16,7 @@ char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)dd.c       5.8 (Berkeley) %G%";
+static char sccsid[] = "@(#)dd.c       5.9 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -252,18 +252,10 @@ dd_in()
                        ++st.in_part;
                }
 
                        ++st.in_part;
                }
 
-               if (ddflags & C_SWAB) {
-                       if ((n = in.dbcnt) & 1) {
-                               ++st.swab;
-                               --n;
-                       }
-                       swab(in.dbp, in.dbp, n);
-               }
-
                /*
                 * POSIX states that if bs is set and no other conversions
                /*
                 * POSIX states that if bs is set and no other conversions
-                * are specified, the block is output without buffering as
-                * it is read.
+                * than noerror, notrunc or sync are specified, the block
+                * is output without buffering as it is read.
                 */
                if (ddflags & C_BS) {
                        out.dbcnt = in.dbcnt;
                 */
                if (ddflags & C_BS) {
                        out.dbcnt = in.dbcnt;
@@ -272,6 +264,14 @@ dd_in()
                        continue;
                }
 
                        continue;
                }
 
+               if (ddflags & C_SWAB) {
+                       if ((n = in.dbcnt) & 1) {
+                               ++st.swab;
+                               --n;
+                       }
+                       swab(in.dbp, in.dbp, n);
+               }
+
                in.dbp += in.dbrcnt;
                (*cfunc)();
        }
                in.dbp += in.dbrcnt;
                (*cfunc)();
        }