diff options
author | le <le@FreeBSD.org> | 2004-07-22 13:38:10 +0000 |
---|---|---|
committer | le <le@FreeBSD.org> | 2004-07-22 13:38:10 +0000 |
commit | 8295db903869b2df8493758b549ce7a7ba1907eb (patch) | |
tree | 3b4ff5937d46b983bac6e2659be82ce31412aa8b /usr.bin/truncate | |
parent | f895222e8149d7dae0dcd68b1eb2a25f157d9b30 (diff) | |
download | FreeBSD-src-8295db903869b2df8493758b549ce7a7ba1907eb.zip FreeBSD-src-8295db903869b2df8493758b549ce7a7ba1907eb.tar.gz |
Make size suffix case insensitive.
PR: bin/27604
Submitted by: David Xu <davidx@viasoft.com.cn>
Diffstat (limited to 'usr.bin/truncate')
-rw-r--r-- | usr.bin/truncate/truncate.1 | 6 | ||||
-rw-r--r-- | usr.bin/truncate/truncate.c | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/truncate/truncate.1 b/usr.bin/truncate/truncate.1 index 6c1d657..9449939 100644 --- a/usr.bin/truncate/truncate.1 +++ b/usr.bin/truncate/truncate.1 @@ -39,7 +39,7 @@ .Sm off .Op Cm + | - .Ar size -.Op Cm K | M | G +.Op Cm K | k | M | m | G | g .Sm on .Xc .Ek @@ -71,7 +71,7 @@ Truncate files to the length of the file .Sm off .Op Cm + | - .Ar size -.Op Cm K | M | G +.Op Cm K | k | M | m | G | g .Sm on .Xc If the @@ -97,7 +97,7 @@ argument may be suffixed with one of .Cm M or .Cm G -to indicate a multiple of +(either upper or lower case) to indicate a multiple of Kilobytes, Megabytes or Gigabytes respectively. .El diff --git a/usr.bin/truncate/truncate.c b/usr.bin/truncate/truncate.c index 2901ae9..6011935 100644 --- a/usr.bin/truncate/truncate.c +++ b/usr.bin/truncate/truncate.c @@ -177,12 +177,15 @@ parselength(char *ls, off_t *sz) 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; |