X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Fhelper%2Foptions.c;h=573026a6e39f7396ce5e2b21b683810587e3575a;hb=1dd5277ba3eb8c5938832b41c2bf6cb5bf19146e;hp=e26782ff937473cde80cf5bc265b373b249356f2;hpb=1186f7efa72a86a7000dce60b090bd4f822cdceb;p=openocd.git diff --git a/src/helper/options.c b/src/helper/options.c index e26782ff93..573026a6e3 100644 --- a/src/helper/options.c +++ b/src/helper/options.c @@ -26,13 +26,13 @@ #include "configuration.h" // @todo the inclusion of server.h here is a layering violation -#include "server.h" +#include #include static int help_flag, version_flag; -static struct option long_options[] = +static const struct option long_options[] = { {"help", no_argument, &help_flag, 1}, {"version", no_argument, &version_flag, 1}, @@ -101,7 +101,22 @@ static void add_default_dirs(void) * listed last in the built-in search order, so the user can * override these scripts with site-specific customizations. */ - /// @todo Implement @c add_script_search_dir("${HOME}/.openocd"). + + const char *home = getenv("HOME"); + + if (home) + { + char *path; + + path = alloc_printf("%s/.openocd", home); + + if (path) + { + add_script_search_dir(path); + free(path); + } + } + add_script_search_dir(PKGDATADIR "/site"); add_script_search_dir(PKGDATADIR "/scripts"); #endif