diff options
author | Brendan Taylor <whateley@gmail.com> | 2011-01-13 12:11:19 -0700 |
---|---|---|
committer | Brendan Taylor <whateley@gmail.com> | 2011-01-13 17:52:42 -0700 |
commit | 975e322d37afaca6e565b37282f2d9e6038124bc (patch) | |
tree | f2fca34cd3dd36bfa52bfc84313757468a3c601a /src/uzbl-core.c | |
parent | 9340e4f23264c7e820b52f18de5ca29132c68e72 (diff) |
add a variable @_ that expands to the result of the last sync command
Diffstat (limited to 'src/uzbl-core.c')
-rw-r--r-- | src/uzbl-core.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/uzbl-core.c b/src/uzbl-core.c index ba6b4de..8e14982 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -145,6 +145,7 @@ const struct var_name_to_ptr_t { { "SELECTED_URI", PTR_C_STR(uzbl.state.selected_url, NULL)}, { "NAME", PTR_C_STR(uzbl.state.instance_name, NULL)}, { "PID", PTR_C_STR(uzbl.info.pid_str, NULL)}, + { "_", PTR_C_STR(uzbl.state.last_result, NULL)}, { NULL, {.ptr.s = NULL, .type = TYPE_INT, .dump = 0, .writeable = 0, .func = NULL}} }; @@ -1347,6 +1348,11 @@ run_parsed_command(CommandInfo *c, GArray *a, GString *result) { send_event(COMMAND_EXECUTED, tmp->str, NULL); g_string_free(tmp, TRUE); } + + if(result) { + g_free(uzbl.state.last_result); + uzbl.state.last_result = g_strdup(result->str); + } } void @@ -2294,7 +2300,8 @@ initialize(int argc, char *argv[]) { uzbl.state.executable_path = g_strdup(argv[0]); uzbl.state.selected_url = NULL; - uzbl.state.searchtx = NULL; + uzbl.state.searchtx = NULL; + uzbl.state.last_result = NULL; GOptionContext* context = g_option_context_new ("[ uri ] - load a uri by default"); g_option_context_add_main_entries (context, entries, NULL); |