Define a build time configurable default value for the new BASH_SOURCE_PATH variable. Look for libraries in the user's home directory as well as the system wide directories.
Signed-off-by: Matheus Afonso Martins Moreira <math...@matheusmoreira.com> --- config-top.h | 7 +++++++ variables.c | 1 + 2 files changed, 8 insertions(+) diff --git a/config-top.h b/config-top.h index b6e73c4b..65d52cb2 100644 --- a/config-top.h +++ b/config-top.h @@ -78,6 +78,13 @@ "/usr/local/lib/bash:/usr/lib/bash:/opt/local/lib/bash:/usr/pkg/lib/bash:/opt/pkg/lib/bash:." #endif +/* The default value of the BASH_SOURCE_PATH variable + which is used by source -l instead of PATH. */ +#ifndef DEFAULT_SOURCE_PATH +#define DEFAULT_SOURCE_PATH \ + "~/.local/share/bash/source:/usr/local/share/bash/source:/usr/share/bash/source" +#endif + /* Default primary and secondary prompt strings. */ #define PPROMPT "\\s-\\v\\$ " #define SPROMPT "> " diff --git a/variables.c b/variables.c index 84b30d93..eb363332 100644 --- a/variables.c +++ b/variables.c @@ -694,6 +694,7 @@ initialize_shell_variables (char **env, int privmode) uidset (); temp_var = set_if_not ("BASH_LOADABLES_PATH", DEFAULT_LOADABLE_BUILTINS_PATH); + temp_var = set_if_not ("BASH_SOURCE_PATH", DEFAULT_SOURCE_PATH); temp_var = find_variable ("BASH_XTRACEFD"); if (temp_var && imported_p (temp_var)) -- 2.44.0