89 |
|
|
90 |
|
|
91 |
|
|
92 |
|
/* Expand variable NAME into its contents, per the rules above. |
93 |
|
* |
94 |
|
* CVSROOT is used to expanding $CVSROOT. |
95 |
|
* |
96 |
|
* RETURNS |
97 |
|
* A pointer to the requested variable contents or NULL when the requested |
98 |
|
* variable is not found. |
99 |
|
* |
100 |
|
* ERRORS |
101 |
|
* None, though this function may generate warning messages when NAME is not |
102 |
|
* found. |
103 |
|
*/ |
104 |
static const char * |
static const char * |
105 |
expand_variable (const char *name, const char *file, int line) |
expand_variable (const char *name, const char *cvsroot, |
106 |
|
const char *file, int line) |
107 |
{ |
{ |
108 |
if (!strcmp (name, CVSROOT_ENV)) |
if (!strcmp (name, CVSROOT_ENV)) |
109 |
return current_parsed_root->directory; |
return cvsroot; |
110 |
else if (!strcmp (name, "RCSBIN")) |
else if (!strcmp (name, "RCSBIN")) |
111 |
{ |
{ |
112 |
error (0, 0, "RCSBIN internal variable is no longer supported"); |
error (0, 0, "RCSBIN internal variable is no longer supported"); |
183 |
* |
* |
184 |
* When FORMATSAFE is set, percent signs (`%') in variable contents are doubled |
* When FORMATSAFE is set, percent signs (`%') in variable contents are doubled |
185 |
* to prevent later expansion by format_cmdline. |
* to prevent later expansion by format_cmdline. |
186 |
|
* |
187 |
|
* CVSROOT is used to expanding $CVSROOT. |
188 |
*/ |
*/ |
189 |
char * |
char * |
190 |
expand_path (const char *name, bool formatsafe, const char *file, int line) |
expand_path (const char *name, const char *cvsroot, bool formatsafe, |
191 |
|
const char *file, int line) |
192 |
{ |
{ |
193 |
size_t s, d, p; |
size_t s, d, p; |
194 |
const char *e; |
const char *e; |
264 |
expand_string (&mybuf, &mybuf_size, d + 1); |
expand_string (&mybuf, &mybuf_size, d + 1); |
265 |
} |
} |
266 |
mybuf[--d] = '\0'; |
mybuf[--d] = '\0'; |
267 |
e = expand_variable (&mybuf[p+flag], file, line); |
e = expand_variable (&mybuf[p+flag], cvsroot, file, line); |
268 |
|
|
269 |
if (e) |
if (e) |
270 |
{ |
{ |