about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMarco Peereboom <marco@conformal.com>2011-11-03 13:48:43 -0500
committerMarco Peereboom <marco@conformal.com>2011-11-03 13:48:43 -0500
commit5d86a4392fad1329624ff547eedbf9e8f46888dc (patch)
tree9901751c50b333601aba51e8e69bc53e04392bdd
parent2a1efecda379102f81bc4edeab808f7ccb894860 (diff)
downloadxombrero-5d86a4392fad1329624ff547eedbf9e8f46888dc.tar.gz
Fix 2 clever bugs
First :js/pl/cookie domain save wasn't saving the actual domain.  I
tried being clever to save a switch statement.  FAIL.

Second I tried to save an else statement.  Again FAIL.

Next time I am doing clever things please yell at me.
-rw-r--r--whitelist.c29
-rw-r--r--xxxterm.c10
2 files changed, 27 insertions, 12 deletions
diff --git a/whitelist.c b/whitelist.c
index 4c85e5d..caf5143 100644
--- a/whitelist.c
+++ b/whitelist.c
@@ -90,7 +90,7 @@ wl_save(struct tab *t, struct karg *args, int list)
 {
 	char			file[PATH_MAX], *lst_str = NULL;
 	FILE			*f;
-	char			*line = NULL, *lt = NULL, *dom = NULL;
+	char			*line = NULL, *lt = NULL, *dom;
 	size_t			linelen;
 	const gchar		*uri;
 	struct karg		a;
@@ -104,22 +104,15 @@ wl_save(struct tab *t, struct karg *args, int list)
 	if (runtime_settings[0] == '\0')
 		return (1);
 
-	snprintf(file, sizeof file, "%s/%s", work_dir, runtime_settings);
-	if ((f = fopen(file, "r+")) == NULL)
-		return (1);
-
 	switch (list) {
 	case XT_WL_JAVASCRIPT:
 		lst_str = "JavaScript";
-		lt = g_strdup_printf("js_wl=%s", dom);
 		break;
 	case XT_WL_COOKIE:
 		lst_str = "Cookie";
-		lt = g_strdup_printf("cookie_wl=%s", dom);
 		break;
 	case XT_WL_PLUGIN:
 		lst_str = "Plugin";
-		lt = g_strdup_printf("pl_wl=%s", dom);
 		break;
 	default:
 		show_oops(t, "Invalid list id: %d", list);
@@ -134,6 +127,26 @@ wl_save(struct tab *t, struct karg *args, int list)
 		goto done;
 	}
 
+	switch (list) {
+	case XT_WL_JAVASCRIPT:
+		lt = g_strdup_printf("js_wl=%s", dom);
+		break;
+	case XT_WL_COOKIE:
+		lt = g_strdup_printf("cookie_wl=%s", dom);
+		break;
+	case XT_WL_PLUGIN:
+		lt = g_strdup_printf("pl_wl=%s", dom);
+		break;
+	default:
+		/* can't happen */
+		show_oops(t, "Invalid list id: %d", list);
+		return (1);
+	}
+
+	snprintf(file, sizeof file, "%s/%s", work_dir, runtime_settings);
+	if ((f = fopen(file, "r+")) == NULL)
+		return (1);
+
 	while (!feof(f)) {
 		line = fparseln(f, &linelen, NULL, NULL, 0);
 		if (line == NULL)
diff --git a/xxxterm.c b/xxxterm.c
index 795156c..2541e39 100644
--- a/xxxterm.c
+++ b/xxxterm.c
@@ -5325,16 +5325,18 @@ cmd_activate_cb(GtkEntry *entry, struct tab *t)
 		t->search_forward = c[0] == '/';
 
 		history_add(&shl, search_file, s, &search_history_count);
-		goto done;
 	} else if (c[0] == '.' || c[0] == ',') {
 		run_script(t, "hints.fire();");
 		/* XXX history for link following? */
-		goto done;
+	} else if (c[0] == ':') {
+		history_add(&chl, command_file, s, &cmd_history_count);
+		cmd_execute(t, s);
+		/* can't call hide_cmd after cmd_execute */
+		return;
 	}
 
-	history_add(&chl, command_file, s, &cmd_history_count);
-	cmd_execute(t, s);
 done:
+	hide_cmd(t);
 	return;
 }