1 | /*
|
---|
2 | * Copyright (C) 2010-2011 Robert Ancell.
|
---|
3 | * Author: Robert Ancell <[email protected]>
|
---|
4 | *
|
---|
5 | * This library is free software; you can redistribute it and/or modify it under
|
---|
6 | * the terms of the GNU Lesser General Public License as published by the Free
|
---|
7 | * Software Foundation; either version 2 or version 3 of the License.
|
---|
8 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license.
|
---|
9 | */
|
---|
10 |
|
---|
11 | #include <sys/utsname.h>
|
---|
12 |
|
---|
13 | #include "lightdm/system.h"
|
---|
14 |
|
---|
15 | static gchar *hostname = NULL;
|
---|
16 |
|
---|
17 | /**
|
---|
18 | * lightdm_get_hostname:
|
---|
19 | *
|
---|
20 | * Return value: The name of the host we are running on.
|
---|
21 | **/
|
---|
22 | const gchar *
|
---|
23 | lightdm_get_hostname (void)
|
---|
24 | {
|
---|
25 | if (!hostname)
|
---|
26 | {
|
---|
27 | struct utsname info;
|
---|
28 | uname (&info);
|
---|
29 | hostname = g_strdup (info.nodename);
|
---|
30 | }
|
---|
31 |
|
---|
32 | return hostname;
|
---|
33 | }
|
---|