aboutsummaryrefslogtreecommitdiffhomepage
path: root/uzbl.c
diff options
context:
space:
mode:
authorGravatar dusanx <ef_dva@yahoo.com>2009-04-27 22:57:38 +0200
committerGravatar dusanx <ef_dva@yahoo.com>2009-04-27 22:57:38 +0200
commite6f0542071874fdc4d041e9f2161e0f0bac2ecf4 (patch)
treebd4894d8655c4d1333b8b5b4bdff793cdc33c30c /uzbl.c
parentc401636ea1034edd0832e82d5a80a5930e352db4 (diff)
Uri check -- append http:// if needed
Diffstat (limited to 'uzbl.c')
-rw-r--r--uzbl.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/uzbl.c b/uzbl.c
index 3528bf4..da73bfe 100644
--- a/uzbl.c
+++ b/uzbl.c
@@ -214,9 +214,20 @@ static Command commands[] =
/* -- CORE FUNCTIONS -- */
+static gchar*
+uricheck (gchar* uri) {
+ if (g_strrstr (uri,"://") == NULL) {
+ GString* newuri = g_string_new (uri);
+ free(uri);
+ g_string_prepend (newuri, "http://");
+ uri = g_string_free (newuri, FALSE);
+ }
+ return (uri);
+}
+
+
static bool
-file_exists (const char * filename)
-{
+file_exists (const char * filename) {
FILE *file = fopen (filename, "r");
if (file) {
fclose (file);
@@ -260,7 +271,7 @@ parse_command(const char *cmd) {
if (c->func_2_params != NULL) {
if (command_param != NULL) {
printf ("command executing: \"%s %s\"\n", command_name, command_param);
- c->func_2_params (web_view, command_param);
+ c->func_2_params (web_view, uricheck(command_param));
} else {
if (c->func_1_param != NULL) {
printf ("command executing: \"%s\"\n", command_name);
@@ -605,7 +616,7 @@ main (int argc, char* argv[]) {
main_window = create_window ();
gtk_container_add (GTK_CONTAINER (main_window), vbox);
- webkit_web_view_load_uri (web_view, uri);
+ webkit_web_view_load_uri (web_view, uricheck(uri));
gtk_widget_grab_focus (GTK_WIDGET (web_view));
gtk_widget_show_all (main_window);