Bug 27604

Summary: change truncate to support low case size suffix
Product: Base System Reporter: davidx <davidx>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description davidx 2001-05-24 04:00:02 UTC
I found a style issue between dd and truncate, 
dd accepts size suffix 'b', 'k', 'm', 'g', all are low case,
but truncate only supports upper case, 'B', 'K', 'M', etc.
it seems truncate is new and should be compatible with dd.

Fix: 

switch (*ls) {
        case 'G':
+       case 'g':
                oflow = length * 1024;
                ASSIGN_CHK_OFLOW(oflow, length);
        case 'M':
+       case 'm':
                oflow = length * 1024;
                ASSIGN_CHK_OFLOW(oflow, length);
        case 'K':
+       case 'k':
                if (ls[1] != '\0')
                        return -1;
                oflow = length * 1024;--SLZ1R2MxcsLmUa7o1TAHOs5j4ayyoRUefum2e7WILAs0Z7zN
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

--- truncate.c.orig     Thu May 24 10:36:34 2001
+++ truncate.c  Thu May 24 10:37:56 2001
@@ -177,12 +177,15 @@
How-To-Repeat: $truncate -s1m temp
invalid size argument 1m
Comment 1 le freebsd_committer freebsd_triage 2004-07-22 14:39:58 UTC
State Changed
From-To: open->closed

Thanks, patch committed.