Support for parsing env vars in gimprc

-Yosh
This commit is contained in:
Manish Singh 1998-03-26 03:33:45 +00:00
parent 8b717a0ade
commit 39a2761783
2 changed files with 32 additions and 2 deletions

View File

@ -1,3 +1,7 @@
Wed Mar 25 19:29:09 PST 1998 Manish Singh <yosh@gimp.org>
* app/gimprc.c: support for parsing env vars in gimprc
Wed Mar 25 18:06:39 PST 1998 Manish Singh <yosh@gimp.org>
* applied gimp-quinet-980122-0 and tweaked the tests a bit,

View File

@ -1353,10 +1353,13 @@ transform_path (char *path,
char *tmp;
char *tmp2;
int substituted;
int is_env;
UnknownToken *ut;
home = getenv ("HOME");
length = 0;
substituted = FALSE;
is_env = FALSE;
tmp = path;
while (*tmp)
@ -1383,9 +1386,32 @@ transform_path (char *path,
*tmp = '\0';
tmp2 = gimprc_find_token (token);
if (tmp2 == NULL)
{
/* maybe token is an environment variable */
tmp2 = getenv (token);
if (tmp2 != NULL)
{
is_env = TRUE;
}
}
tmp2 = transform_path (tmp2, FALSE);
gimprc_set_token (token, tmp2);
if (is_env)
{
/* then add to list of unknown tokens */
/* but only if it isn't already in list */
if (gimprc_find_token (token) == NULL)
{
ut = g_new (UnknownToken, 1);
ut->token = g_strdup (token);
ut->value = g_strdup (tmp2);
unknown_tokens = g_list_append (unknown_tokens, ut);
}
}
else
{
gimprc_set_token (token, tmp2);
}
length += strlen (tmp2);
*tmp = '}';