From 4cddff705796665a286795b03eb7e32953497102 Mon Sep 17 00:00:00 2001 From: Josef 'Jeff' Sipek Date: Thu, 19 Apr 2012 20:18:45 -0400 Subject: [PATCH] 2556 dd should accept M,G,T,... for sizes Reviewed by: Dan Kruchinin Reviewed by: Richard Lowe Approved by: Gordon Ross --- usr/src/cmd/dd/dd.c | 30 +++++++++++++++++++++++++++--- usr/src/man/man1m/dd.1m | 38 +++++++++++++++++++++++++++++++++++++- 2 files changed, 64 insertions(+), 4 deletions(-) diff --git a/usr/src/cmd/dd/dd.c b/usr/src/cmd/dd/dd.c index ad357a5fd0..75caccbeac 100644 --- a/usr/src/cmd/dd/dd.c +++ b/usr/src/cmd/dd/dd.c @@ -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 @@ true: /* 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 @@ long long big; 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 --git a/usr/src/man/man1m/dd.1m b/usr/src/man/man1m/dd.1m index ec3b8c4dd6..ffdedba12f 100644 --- a/usr/src/man/man1m/dd.1m +++ b/usr/src/man/man1m/dd.1m @@ -403,12 +403,48 @@ a positive decimal number followed by \fBk\fR, specifying multiplication by .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 -- 2.11.4.GIT