diff options
author | Robert Manea <gotmor@gmail.com> | 2009-05-30 13:22:08 +0200 |
---|---|---|
committer | Robert Manea <gotmor@gmail.com> | 2009-05-30 13:22:08 +0200 |
commit | f219ef203be9b8b89a8ef13b7ebc78aa3ff01112 (patch) | |
tree | abdbb3f3fc4a7f8628f4f6c836400638f1d3c96a /uzbl.c | |
parent | 1a21270bc6ac7ef3eea63b2de1538f267a0713a6 (diff) |
added print command
Diffstat (limited to 'uzbl.c')
-rw-r--r-- | uzbl.c | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -616,7 +616,8 @@ static struct {char *name; Command command[2];} cmdlist[] = { "keycmd", {keycmd, NOSPLIT} }, { "keycmd_nl", {keycmd_nl, NOSPLIT} }, { "keycmd_bs", {keycmd_bs, 0} }, - { "chain", {chain, 0} } + { "chain", {chain, 0} }, + { "print", {print, NOSPLIT} } }; static void @@ -675,6 +676,16 @@ get_var(WebKitWebView *page, GArray *argv) { } static void +print(WebKitWebView *page, GArray *argv) { + (void) page; + gchar* buf; + + buf = expand_vars(argv_idx(argv, 0)); + puts(buf); + g_free(buf); +} + +static void act_bind(WebKitWebView *page, GArray *argv) { (void) page; gchar **split = g_strsplit(argv_idx(argv, 0), " = ", 2); @@ -1583,9 +1594,10 @@ parse_cmd_line(const char *ctl_line) { else { /* parse a command */ gchar *ctlstrip; gchar **tokens = NULL; + len = strlen(ctl_line); - if (ctl_line[strlen(ctl_line) - 1] == '\n') /* strip trailing newline */ - ctlstrip = g_strndup(ctl_line, strlen(ctl_line) - 1); + if (ctl_line[len - 1] == '\n') /* strip trailing newline */ + ctlstrip = g_strndup(ctl_line, len - 1); else ctlstrip = g_strdup(ctl_line); tokens = g_strsplit(ctlstrip, " ", 2); |