Index: ossp-pkg/var/var.c RCS File: /v/ossp/cvs/ossp-pkg/var/var.c,v rcsdiff -q -kk '-r1.35' '-r1.36' -u '/v/ossp/cvs/ossp-pkg/var/var.c,v' 2>/dev/null --- var.c 2001/11/20 15:36:42 1.35 +++ var.c 2001/11/20 15:46:35 1.36 @@ -893,7 +893,6 @@ if (!tokenbuf_assign(&res, p, data->end - p)) return VAR_ERR_OUT_OF_MEMORY; } else { /* OK, then use num2. */ - if (isrange) { if ((p + num2) > data->end) return VAR_ERR_RANGE_OUT_OF_BOUNDS; @@ -904,9 +903,7 @@ return VAR_ERR_OFFSET_LOGIC; if ((data->begin + num2) > data->end) return VAR_ERR_RANGE_OUT_OF_BOUNDS; - if (!tokenbuf_assign(&res, p, num2 - num1)) -//FIXME THL: I expect start-end *inclusive* -//FIXME THL: I expect start,len len characters not len-1 + if (!tokenbuf_assign(&res, p, num2 - num1 + 1)) return VAR_ERR_OUT_OF_MEMORY; } } Index: ossp-pkg/var/var.pod RCS File: /v/ossp/cvs/ossp-pkg/var/var.pod,v rcsdiff -q -kk '-r1.7' '-r1.8' -u '/v/ossp/cvs/ossp-pkg/var/var.pod,v' 2>/dev/null --- var.pod 2001/11/20 13:08:17 1.7 +++ var.pod 2001/11/20 15:46:35 1.8 @@ -531,22 +531,17 @@ This operation will replace the contents of $name with "word" if $name is not empty. Otherwise, it will expand to the contents of $name. -=item ${name:o-} +=item ${name:o,} This operation will cut the string starting at position "start" to ending position "end" out of the contents of $name and return that. -Please note that the character at position "end" is not included in -the result, "end - 1" is the last character position returned. -${name:o3,4}, for instance, will return the substring from position 3 -to position 4 -- that is exactly one character. Also, please note that -start positions begin at zero (0)! If the "end" parameter is left out, -as in ${name:o3,}, the operation will return the string starting at -position 3 until the end. +Please note that the character at position "end" is included in the +result; ${name:o3,4} for instance, will return a two-character string. +Also, please note that start positions begin at zero (0)! If the "end" +parameter is left out, as in ${name:o3,}, the operation will return +the string starting at position 3 until the end. -//FIXME THL: I expect start-end *inclusive* -//FIXME THL: I expect start,len len characters not len-1 - -=item ${name:o,} +=item ${name:o-} This operation will cut the range of "start" to "end" out of the contents of $name and return that. ${name:o3-4} means, for instance, Index: ossp-pkg/var/var_test.c RCS File: /v/ossp/cvs/ossp-pkg/var/var_test.c,v rcsdiff -q -kk '-r1.13' '-r1.14' -u '/v/ossp/cvs/ossp-pkg/var/var_test.c,v' 2>/dev/null --- var_test.c 2001/11/20 11:49:24 1.13 +++ var_test.c 2001/11/20 15:46:35 1.14 @@ -77,10 +77,10 @@ {"${HOME:s/E/bla/ti}", "/hombla/regression-tests"}, {"${HOME:s/E/bla/tig}", "/hombla/rblagrblassion-tblasts"}, {"${HOME:o1-5}", "home/"}, - {"${HOME:o1,5}", "home"}, + {"${HOME:o1,5}", "home/"}, {"${HOME:o5,}", "/regression-tests"}, {"${HOME:o5-}", "/regression-tests"}, - {"${HOME:o7,13}", "egress"}, + {"${HOME:o7,13}", "egressi"}, {"${HOME:y/a-z/A-YZ/}", "/HOME/REGRESSION-TESTS"}, {"${HOME:y/e-g/a-c/}", "/homa/racrassion-tasts"}, {"${FOO:p/15/../l}", "os............."}, @@ -94,10 +94,8 @@ {"${HOME:s/g(res)s/x\\1x/g}", "/home/rexresxion-tests"}, {"${HOME:s/(s+)/_\\1_/g}", "/home/regre_ss_ion-te_s_t_s_"}, {"${HOME:s/\\x65/\\x45/g}", "/homE/rEgrEssion-tEsts"}, - {"${HOME:s/(s*)/x\\1X/g}", - "xXxXxXxXxXxXxXxXxXxXxXxssXxXxXxXxXxXxXxsXxXxsX"}, - {"${HOME:s/./\\\\/g}", - "\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"} + {"${HOME:s/(s*)/x\\1X/g}", "xXxXxXxXxXxXxXxXxXxXxXxssXxXxXxXxXxXxXxsXxXxsX"}, + {"${HOME:s/./\\\\/g}", "\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"} }; char *tmp; size_t tmp_len;