summaryrefslogtreecommitdiff
path: root/src/helper/options.c
diff options
context:
space:
mode:
authorAndreas Fritiofson <andreas.fritiofson@gmail.com>2009-11-24 00:32:54 +0100
committerØyvind Harboe <oyvind.harboe@zylin.com>2009-11-24 08:57:02 +0100
commit0583cb0a0d222787c4048f9362292c5db9d969b0 (patch)
tree68ba2a8dba00f0906df1d64296477df1aab93425 /src/helper/options.c
parent0d06a06f8bb7d0dcb91ec7d31ab00c0c730f1cf4 (diff)
downloadopenocd+libswd-0583cb0a0d222787c4048f9362292c5db9d969b0.tar.gz
openocd+libswd-0583cb0a0d222787c4048f9362292c5db9d969b0.tar.bz2
openocd+libswd-0583cb0a0d222787c4048f9362292c5db9d969b0.tar.xz
openocd+libswd-0583cb0a0d222787c4048f9362292c5db9d969b0.zip
support for scripts in $HOME/.openocd
Add $HOME/.openocd as the first default script search directory, allowing the user to override the standard scripts. Update the user guide with information on where OpenOCD expects to find configuration files and scripts. Also fixed some minor formatting issues. Add entry to NEWS as well. Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Diffstat (limited to 'src/helper/options.c')
-rw-r--r--src/helper/options.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/helper/options.c b/src/helper/options.c
index 874196ea..3db96fd7 100644
--- a/src/helper/options.c
+++ b/src/helper/options.c
@@ -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