add 'm' for megabytes; allow bs= and C_SWAB to have special bs semantics
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sun, 28 Jul 1991 04:27:02 +0000 (20:27 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sun, 28 Jul 1991 04:27:02 +0000 (20:27 -0800)
SCCS-vsn: bin/dd/args.c 5.3

usr/src/bin/dd/args.c

index 40d7ae9..70866db 100644 (file)
@@ -10,7 +10,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)args.c     5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)args.c     5.3 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/types.h>
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -97,7 +97,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_SWAB|C_UCASE|C_UNBLOCK))
+               if (ddflags & (C_BLOCK|C_LCASE|C_UCASE|C_UNBLOCK))
                        ddflags &= ~C_BS;
 
                /* Bs supersedes ibs and obs. */
                        ddflags &= ~C_BS;
 
                /* Bs supersedes ibs and obs. */
@@ -363,6 +363,13 @@ get_bsz(val)
                        goto erange;
                ++expr;
                break;
                        goto erange;
                ++expr;
                break;
+       case 'm':
+               t = num;
+               num *= 1048576;
+               if (t > num)
+                       goto erange;
+               ++expr;
+               break;
        case 'w':                               /* POSIX extension. */
                t = num;
                num *= sizeof(int);
        case 'w':                               /* POSIX extension. */
                t = num;
                num *= sizeof(int);
@@ -375,8 +382,8 @@ get_bsz(val)
        switch(*expr) {
                case '\0':
                        break;
        switch(*expr) {
                case '\0':
                        break;
+               case '*':                       /* Backward compatible. */
                case 'x':
                case 'x':
-               case '*':
                        t = num;
                        num *= get_bsz(expr + 1);
                        if (t > num)
                        t = num;
                        num *= get_bsz(expr + 1);
                        if (t > num)