about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorStevan Andjelkovic <stevan@student.chalmers.se>2011-02-02 14:40:06 +0000
committerStevan Andjelkovic <stevan@student.chalmers.se>2011-02-02 14:40:06 +0000
commit9b3a908734858b8446814558d83bb47b3860811b (patch)
tree0d754816242b0e511856eac0cc439c1c5ecbb5e1
parenta34fec2cbdd85aef23661b90b629271c7d96bce8 (diff)
downloadxombrero-9b3a908734858b8446814558d83bb47b3860811b.tar.gz
Trim leading spaces of load_uri input.
ok marco@
-rw-r--r--xxxterm.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/xxxterm.c b/xxxterm.c
index 3be93d9..e78b14f 100644
--- a/xxxterm.c
+++ b/xxxterm.c
@@ -41,6 +41,7 @@
 #include <errno.h>
 #include <signal.h>
 #include <libgen.h>
+#include <ctype.h>
 
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -1156,6 +1157,13 @@ load_uri(WebKitWebView *wv, gchar *uri)
 	if (uri == NULL || !strlen(uri))
 		return;
 
+	/* Strip leading spaces. */
+	while(*uri && isspace(*uri))
+		uri++;
+
+	if (!strlen(uri))
+		return;
+
 	if (valid_url_type(uri)) {
 		newuri = guess_url_type(uri);
 		uri = newuri;