diff options
author | 2015-04-25 18:09:28 +0000 | |
---|---|---|
committer | 2015-04-25 18:09:28 +0000 | |
commit | 3b2ac4f9d31b028c037b08b09465c6477a09689c (patch) | |
tree | c4bf975e599631a9c1e14f3e9f168148fb1a44e8 /usr.bin/tmux/session.c | |
parent | double word fix; from david vasek (diff) | |
download | wireguard-openbsd-3b2ac4f9d31b028c037b08b09465c6477a09689c.tar.xz wireguard-openbsd-3b2ac4f9d31b028c037b08b09465c6477a09689c.zip |
Move the functions to convert ids from strings into session.c and window.c.
Diffstat (limited to 'usr.bin/tmux/session.c')
-rw-r--r-- | usr.bin/tmux/session.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/usr.bin/tmux/session.c b/usr.bin/tmux/session.c index 09da65c3ed4..f809f06bbf8 100644 --- a/usr.bin/tmux/session.c +++ b/usr.bin/tmux/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.47 2015/04/22 15:32:33 nicm Exp $ */ +/* $OpenBSD: session.c,v 1.48 2015/04/25 18:09:28 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -70,6 +70,22 @@ session_find(const char *name) return (RB_FIND(sessions, &sessions, &s)); } +/* Find session by id parsed from a string. */ +struct session * +session_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 (session_find_by_id(id)); +} + /* Find session by id. */ struct session * session_find_by_id(u_int id) |