From 000eea67ffd1f3250385a17a8aea8a8871e14210 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 3 Aug 2014 06:55:55 +0200 Subject: the rest of the clipboard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/libmdsserver/util.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/libmdsserver/util.c') diff --git a/src/libmdsserver/util.c b/src/libmdsserver/util.c index df11b1a..01f5cbe 100644 --- a/src/libmdsserver/util.c +++ b/src/libmdsserver/util.c @@ -30,6 +30,31 @@ #include + +/** + * Convert a client ID string into a client ID integer + * + * @param str The client ID string + * @return The client ID integer + */ +uint64_t parse_client_id(const char* str) +{ + char client_words[22]; + char* client_high; + char* client_low; + uint64_t client; + + strcpy(client_high = client_words, str); + client_low = rawmemchr(client_words, ':'); + *client_low++ = '\0'; + client = (uint64_t)atoll(client_high); + client <<= 32; + client |= (uint64_t)atoll(client_low); + + return client; +} + + /** * Read an environment variable, but handle it as undefined if empty * -- cgit v1.2.3-70-g09d2