Index: ossp-pkg/var/var.c RCS File: /v/ossp/cvs/ossp-pkg/var/var.c,v rcsdiff -q -kk '-r1.63' '-r1.64' -u '/v/ossp/cvs/ossp-pkg/var/var.c,v' 2>/dev/null --- var.c 2002/02/28 08:48:44 1.63 +++ var.c 2002/02/28 09:29:48 1.64 @@ -653,8 +653,21 @@ do. */ if (name.begin == name.end) { - rc = VAR_ERR_INCOMPLETE_VARIABLE_SPEC; - goto error_return; + if (force_expand) { + rc = VAR_ERR_INCOMPLETE_VARIABLE_SPEC; + goto error_return; + } + else { + /* If no force_expand is requested, we have to back-off. + We're not sure whether our approach here is 100% correct, + because it _could_ have side-effects according to Peter + Simons, but as far as we know and tried it, it is + correct. But be warned -- RSE */ + result->begin = begin - 1; + result->end = p; + result->buffer_size = 0; + goto goahead; + } } /* If the next token is START-INDEX, read the index specification. */ @@ -725,6 +738,7 @@ } } + goahead: if (p[-1] == ':') { /* Parse and execute commands. */ Index: ossp-pkg/var/var_test.c RCS File: /v/ossp/cvs/ossp-pkg/var/var_test.c,v rcsdiff -q -kk '-r1.35' '-r1.36' -u '/v/ossp/cvs/ossp-pkg/var/var_test.c,v' 2>/dev/null --- var_test.c 2002/02/28 08:48:44 1.35 +++ var_test.c 2002/02/28 09:29:48 1.36 @@ -111,6 +111,7 @@ }; const struct test_case tests[] = { + { "${HOME}${!!}", "/home/regression-tests${!!}" }, { "$HOME", "/home/regression-tests" }, { "${FOO}", "os" }, { "${BAR}", "type" },