=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/window.c,v retrieving revision 1.122 retrieving revision 1.123 diff -u -r1.122 -r1.123 --- src/usr.bin/tmux/window.c 2015/04/22 15:30:11 1.122 +++ src/usr.bin/tmux/window.c 2015/04/25 18:09:28 1.123 @@ -1,4 +1,4 @@ -/* $OpenBSD: window.c,v 1.122 2015/04/22 15:30:11 nicm Exp $ */ +/* $OpenBSD: window.c,v 1.123 2015/04/25 18:09:28 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -254,6 +254,21 @@ } 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 @@ 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) {