# HG changeset patch # User Josef 'Jeff' Sipek # Date 1334881125 14400 # Node ID 25dba56d858df780b7e53e54f077a9b1227b2078 # Parent 779ed9ad03ea602c1e99f9ea0dfd2b6d1e4e164a 2556 dd should accept M,G,T,... for sizes Reviewed by: Dan Kruchinin Reviewed by: Richard Lowe Approved by: Gordon Ross diff -r 779ed9ad03ea -r 25dba56d858d usr/src/cmd/dd/dd.c --- a/usr/src/cmd/dd/dd.c Mon Apr 16 21:31:22 2012 +0100 +++ b/usr/src/cmd/dd/dd.c Thu Apr 19 20:18:45 2012 -0400 @@ -23,13 +23,12 @@ /* * Copyright 2005 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2012, Josef 'Jeff' Sipek . All rights reserved. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * convert and copy */ @@ -1642,7 +1641,8 @@ /* Arg: big - maximum valid input number */ /* Global arg: string - pointer to command arg */ /* */ -/* Valid forms: 123 | 123k | 123w | 123b | 123*123 | 123x123 */ +/* Valid forms: 123 | 123k | 123M | 123G | 123T | 123P | 123E | 123Z | */ +/* 123w | 123b | 123*123 | 123x123 */ /* plus combinations such as 2b*3kw*4w */ /* */ /* Return: converted number */ @@ -1668,6 +1668,30 @@ switch (*cs++) { + case 'Z': + n *= 1024; + /* FALLTHROUGH */ + + case 'E': + n *= 1024; + /* FALLTHROUGH */ + + case 'P': + n *= 1024; + /* FALLTHROUGH */ + + case 'T': + n *= 1024; + /* FALLTHROUGH */ + + case 'G': + n *= 1024; + /* FALLTHROUGH */ + + case 'M': + n *= 1024; + /* FALLTHROUGH */ + case 'k': n *= 1024; continue; diff -r 779ed9ad03ea -r 25dba56d858d usr/src/man/man1m/dd.1m --- a/usr/src/man/man1m/dd.1m Mon Apr 16 21:31:22 2012 +0100 +++ b/usr/src/man/man1m/dd.1m Thu Apr 19 20:18:45 2012 -0400 @@ -403,12 +403,48 @@ .RS +4 .TP 3. +a positive decimal number followed by \fBM\fR, specifying multiplication by +1024*1024 +.RE +.RS +4 +.TP +4. +a positive decimal number followed by \fBG\fR, specifying multiplication by +1024*1024*1024 +.RE +.RS +4 +.TP +5. +a positive decimal number followed by \fBT\fR, specifying multiplication by +1024*1024*1024*1024 +.RE +.RS +4 +.TP +6. +a positive decimal number followed by \fBP\fR, specifying multiplication by +1024*1024*1024*1024*1024 +.RE +.RS +4 +.TP +7. +a positive decimal number followed by \fBE\fR, specifying multiplication by +1024*1024*1024*1024*1024*1024 +.RE +.RS +4 +.TP +8. +a positive decimal number followed by \fBZ\fR, specifying multiplication by +1024*1024*1024*1024*1024*1024*1024 +.RE +.RS +4 +.TP +9. a positive decimal number followed by \fBb\fR, specifying multiplication by 512 .RE .RS +4 .TP -4. +10. two or more positive decimal numbers (with or without \fBk\fR or \fBb\fR) separated by \fBx\fR, specifying the product of the indicated values. .RE