]>
Commit | Line | Data |
---|---|---|
ff6d7fd6 | 1 | diff -Nru bash-2.05b/builtins/evalfile.c bash-2.05b.new/builtins/evalfile.c |
2 | --- bash-2.05b/builtins/evalfile.c Thu Feb 21 20:08:52 2002 | |
3 | +++ bash-2.05b.new/builtins/evalfile.c Sun Mar 23 14:59:23 2003 | |
4 | @@ -208,6 +208,23 @@ | |
5 | return ((flags & FEVAL_BUILTIN) ? result : 1); | |
6 | } | |
7 | ||
8 | +static char * | |
9 | +config_dir_tilde_expand (s, config_dir) | |
10 | + const char *s; | |
11 | + const char *config_dir; | |
12 | +{ | |
13 | + int old_immed, r; | |
14 | + char *ret; | |
15 | + | |
16 | + if (*s == '~' && *(s+1) == '/') | |
17 | + { | |
18 | + ret = xmalloc(strlen(config_dir) + strlen(s) - 1); | |
19 | + sprintf(ret, "%s/%s", config_dir, s+3); | |
20 | + } | |
21 | + else return bash_tilde_expand(s, 0); | |
22 | + return (ret); | |
23 | +} | |
24 | + | |
25 | int | |
26 | maybe_execute_file (fname, force_noninteractive) | |
27 | const char *fname; | |
28 | @@ -215,8 +232,12 @@ | |
29 | { | |
30 | char *filename; | |
31 | int result, flags; | |
32 | - | |
33 | - filename = bash_tilde_expand (fname, 0); | |
34 | + char *config_dir = getenv("CONFIG_DIR"); | |
35 | + | |
36 | + if (config_dir) | |
37 | + filename = config_dir_tilde_expand(fname, config_dir); | |
38 | + else | |
39 | + filename = bash_tilde_expand (fname, 0); | |
40 | flags = FEVAL_ENOENTOK; | |
41 | if (force_noninteractive) | |
42 | flags |= FEVAL_NONINT; |