blob: 7d3c3b6bf8ff579aa884ac81c3dcf0f69312851e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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);
}
|