Make size suffix case insensitive.

PR:            bin/27604
Submitted by:  David Xu <davidx@viasoft.com.cn>
This commit is contained in:
Lukas Ertl 2004-07-22 13:38:10 +00:00
parent aae01d2439
commit 6b61c155e6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=132542
2 changed files with 6 additions and 3 deletions

View file

@ -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

View file

@ -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;