Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 May 2001 19:50:04 -0700 (PDT)
From:      davidx@viasoft.com.cn
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/27604: change truncate to support low case size suffix
Message-ID:  <200105240250.f4O2o4088056@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         27604
>Category:       bin
>Synopsis:       change truncate to support low case size suffix
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed May 23 20:00:02 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     David Xu
>Release:        FreeBSD 4.3-stable
>Organization:
Viasoft
>Environment:
FreeBSD davidbsd.viasoft.com.cn 4.3-STABLE FreeBSD 4.3-STABLE #31: Mon May 21 09:0
7:09 CST 2001     root@davidbsd.viasoft.com.cn:/usr/src/sys/compile/xu  i386
>Description:
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.

>How-To-Repeat:
$truncate -s1m temp
invalid size argument 1m


>Fix:
--- truncate.c.orig     Thu May 24 10:36:34 2001
+++ truncate.c  Thu May 24 10:37:56 2001
@@ -177,12 +177,15 @@

        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;

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200105240250.f4O2o4088056>