diff options
author | Lennart Poettering <lennart@poettering.net> | 2004-12-23 16:08:40 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2004-12-23 16:08:40 +0000 |
commit | 33ccd714ea9469b5b7d3b36bbe468ba1b0f31dfc (patch) | |
tree | 833e8c3331b1f2d9a3e16c131852bf7fe1a00998 /util.c | |
parent | 2095aa52444f9ab598475ddcf8ca1773a02f8e13 (diff) |
initial commit
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@3 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -0,0 +1,26 @@ +#include <string.h> +#include <unistd.h> + +#include "util.h" + +gchar *flx_get_host_name(void) { + char t[256]; + gethostname(t, sizeof(t)); + return g_strndup(t, sizeof(t)); +} + +gchar *flx_normalize_name(gchar *s) { + size_t l; + g_assert(s); + + l = strlen(s); + + if (!l) + return g_strdup("."); + + if (s[l-1] == '.') + return g_strdup(s); + + return g_strdup_printf("%s.", s); +} + |