aboutsummaryrefslogtreecommitdiff
path: root/apps/apps.cpp
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2015-06-21 00:53:28 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2015-06-21 00:55:21 +0200
commit7e2fb834d8ba2eb3fd6453f135d3e8ef30c852c6 (patch)
tree166f6400567834834442d6b167cc42f1d58a57b2 /apps/apps.cpp
parentc56840f03cf139d60c6d90b55cf16e70f6ae2bc2 (diff)
downloadble-toys-7e2fb834d8ba2eb3fd6453f135d3e8ef30c852c6.tar.gz
ble-toys-7e2fb834d8ba2eb3fd6453f135d3e8ef30c852c6.tar.bz2
ble-toys-7e2fb834d8ba2eb3fd6453f135d3e8ef30c852c6.tar.xz
ble-toys-7e2fb834d8ba2eb3fd6453f135d3e8ef30c852c6.zip
o Using ends_with when checking for which app to launch too.
sm-get-value: o Using the io code for writing samples
Diffstat (limited to 'apps/apps.cpp')
-rw-r--r--apps/apps.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/apps/apps.cpp b/apps/apps.cpp
index 783c0b0..e0bb631 100644
--- a/apps/apps.cpp
+++ b/apps/apps.cpp
@@ -9,6 +9,12 @@ using namespace std;
namespace po = boost::program_options;
std::string get_hostname() {
+ static string s = "";
+
+ if (!s.empty()) {
+ return s;
+ }
+
struct addrinfo hints, *info, *p;
// int gai_result;
@@ -25,10 +31,8 @@ std::string get_hostname() {
return "uknown";
}
- string s = "unknown";
-
if (info) {
- s = string(info->ai_canonname);
+ s = info->ai_canonname;
}
freeaddrinfo(info);