From 68fb44012982897ea883b336c56d0e8c12ddce0d Mon Sep 17 00:00:00 2001 From: Yaniv Kamay Date: Mon, 28 Dec 2009 01:15:08 +0200 Subject: client: add GUI infrastructure + functional login dialog --- client/utils.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'client/utils.cpp') diff --git a/client/utils.cpp b/client/utils.cpp index 29201743..c27aa361 100644 --- a/client/utils.cpp +++ b/client/utils.cpp @@ -37,3 +37,14 @@ void wstring_printf(std::wstring& str, const wchar_t* format, ...) va_end(ap); } +int str_to_port(const char *str) +{ + long port; + char *endptr; + port = strtol(str, &endptr, 0); + if (endptr != str + strlen(str) || port < 0 || port > 0xffff) { + return -1; + } + return port; +} + -- cgit