aboutsummaryrefslogtreecommitdiff
path: root/window.c
diff options
context:
space:
mode:
authornicm <nicm>2015-04-25 18:09:28 +0000
committernicm <nicm>2015-04-25 18:09:28 +0000
commit6dbd63ba4f2da666d55267692c610b9ed8d1d8dd (patch)
tree371fc59e074cf40d3ac07964916dd64d1953bfc7 /window.c
parentd23af6cca0c4d55097d567bbfea42aecf0ca36b0 (diff)
downloadrtmux-6dbd63ba4f2da666d55267692c610b9ed8d1d8dd.tar.gz
rtmux-6dbd63ba4f2da666d55267692c610b9ed8d1d8dd.tar.bz2
rtmux-6dbd63ba4f2da666d55267692c610b9ed8d1d8dd.zip
Move the functions to convert ids from strings into session.c and window.c.
Diffstat (limited to 'window.c')
-rw-r--r--window.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/window.c b/window.c
index 5ca8aa0c..acbcd33d 100644
--- a/window.c
+++ b/window.c
@@ -254,6 +254,21 @@ winlink_stack_remove(struct winlink_stack *stack, struct winlink *wl)
}
struct window *
+window_find_by_id_str(const char* s)
+{
+ const char *errstr;
+ u_int id;
+
+ if (*s != '@')
+ return (NULL);
+
+ id = strtonum(s + 1, 0, UINT_MAX, &errstr);
+ if (errstr != NULL)
+ return (NULL);
+ return (window_find_by_id(id));
+}
+
+struct window *
window_find_by_id(u_int id)
{
struct window w;
@@ -653,7 +668,21 @@ window_printable_flags(struct session *s, struct winlink *wl)
return (xstrdup(flags));
}
-/* Find pane in global tree by id. */
+struct window_pane *
+window_pane_find_by_id_str(const char *s)
+{
+ const char *errstr;
+ u_int id;
+
+ if (*s != '%')
+ return (NULL);
+
+ id = strtonum(s + 1, 0, UINT_MAX, &errstr);
+ if (errstr != NULL)
+ return (NULL);
+ return (window_pane_find_by_id(id));
+}
+
struct window_pane *
window_pane_find_by_id(u_int id)
{