mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-08 12:44:23 +01:00
Allow ${foo} syntax for variables.
This commit is contained in:
parent
f8e3f699a9
commit
e0dbe037b7
@ -1,3 +1,7 @@
|
|||||||
|
2007-10-12 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* gpg-connect-agent.c (substitute_line): Allow ${foo} syntax.
|
||||||
|
|
||||||
2007-10-11 Werner Koch <wk@g10code.com>
|
2007-10-11 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* gpg-connect-agent.c (get_var): Expand environment variables.
|
* gpg-connect-agent.c (get_var): Expand environment variables.
|
||||||
|
@ -228,6 +228,8 @@ get_var (const char *name)
|
|||||||
variable_t var;
|
variable_t var;
|
||||||
const char *s;
|
const char *s;
|
||||||
|
|
||||||
|
if (!*name)
|
||||||
|
return "";
|
||||||
for (var = variable_table; var; var = var->next)
|
for (var = variable_table; var; var = var->next)
|
||||||
if (!strcmp (var->name, name))
|
if (!strcmp (var->name, name))
|
||||||
break;
|
break;
|
||||||
@ -264,9 +266,24 @@ substitute_line (char *buffer)
|
|||||||
line = p + 1;
|
line = p + 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (pend=p+1; *pend && !spacep (pend) && *pend != '$' ; pend++)
|
if (p[1] == '{')
|
||||||
;
|
{
|
||||||
if (*pend)
|
for (pend=p+2; *pend && *pend != '}' ; pend++)
|
||||||
|
;
|
||||||
|
if (!*pend)
|
||||||
|
return result; /* Unclosed - don't substitute. */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (pend=p+1; *pend && !spacep (pend) && *pend != '$' ; pend++)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
if (p[1] == '{' && *pend == '}')
|
||||||
|
{
|
||||||
|
*pend++ = 0;
|
||||||
|
value = get_var (p+2);
|
||||||
|
}
|
||||||
|
else if (*pend)
|
||||||
{
|
{
|
||||||
int save = *pend;
|
int save = *pend;
|
||||||
*pend = 0;
|
*pend = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user