summaryrefslogtreecommitdiffstats
path: root/client/utils.cpp
diff options
context:
space:
mode:
authorYaniv Kamay <ykamay@redhat.com>2009-12-28 01:15:08 +0200
committerYaniv Kamay <ykamay@redhat.com>2009-12-28 12:38:58 +0200
commit68fb44012982897ea883b336c56d0e8c12ddce0d (patch)
tree209556db04762b5f5f7581af4f51970f04e8d836 /client/utils.cpp
parent659be313a43fc741ed9decd95178efbeedf2c4fd (diff)
downloadspice-68fb44012982897ea883b336c56d0e8c12ddce0d.tar.gz
spice-68fb44012982897ea883b336c56d0e8c12ddce0d.tar.xz
spice-68fb44012982897ea883b336c56d0e8c12ddce0d.zip
client: add GUI infrastructure + functional login dialog
Diffstat (limited to 'client/utils.cpp')
-rw-r--r--client/utils.cpp11
1 files changed, 11 insertions, 0 deletions
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;
+}
+