On Sun, Nov 22, 2009 at 1:13 AM, Zach Welch <z...@superlucidity.net> wrote:
> Checkout your branch and run 'git rebase master'.  That will update your
> branch against the current master.  Then, do the same thing with '-i'.
> Select the patches to change and mark them with 'e', change the files,
> add them and --amend the comment, then --continue the rebase. Rinse and
> repeat for all marked files.

Great, that was easy, thanks! Here's an updated patch, this time using
C99 variable length arrays. I'm using the unbounded string functions
here, guessing we can trust getenv() to return a piece of memory that
won't change on the fly.

Btw, is it suitable to attach an updated patch as an attachment like
this? I thought git-send-email was fancy, but I hardly think it can
figure out to send the new patch as a reply in the old thread?

/Andreas
From 4fb41a4855e58448070f5d4e3434878aa1c8c72f Mon Sep 17 00:00:00 2001
From: Andreas Fritiofson <andreas.fritiof...@gmail.com>
Date: Thu, 19 Nov 2009 23:58:15 +0100
Subject: [PATCH 2/2] support for scripts in $HOME/.openocd

Add $HOME/.openocd as the first default script search directory, allowing
the user to override the standard scripts.

Signed-off-by: Andreas Fritiofson <andreas.fritiof...@gmail.com>
---
 src/helper/options.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/src/helper/options.c b/src/helper/options.c
index 5792e11..84e391b 100644
--- a/src/helper/options.c
+++ b/src/helper/options.c
@@ -101,7 +101,18 @@ 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");
+	const char *suffix = "/.openocd";
+
+	if (home) {
+		char path[strlen(home) + strlen(suffix) + 1];
+
+		strcpy(path, home);
+		strcat(path, suffix);
+		add_script_search_dir(path);
+	}
+
 	add_script_search_dir(PKGDATADIR "/site");
 	add_script_search_dir(PKGDATADIR "/scripts");
 #endif
-- 
1.6.3.3

_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to