Back to index

lightdm  1.3.2
system.c
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2010-2011 Robert Ancell.
00003  * Author: Robert Ancell <robert.ancell@canonical.com>
00004  *
00005  * This library is free software; you can redistribute it and/or modify it under
00006  * the terms of the GNU Lesser General Public License as published by the Free
00007  * Software Foundation; either version 3 of the License, or (at your option) any
00008  * later version. See http://www.gnu.org/copyleft/lgpl.html the full text of the
00009  * license.
00010  */
00011 
00012 #include <sys/utsname.h>
00013 
00014 #include "lightdm/system.h"
00015 
00016 static gchar *hostname = NULL;
00017 
00023 const gchar *
00024 lightdm_get_hostname (void)
00025 {
00026     if (!hostname)
00027     {
00028         struct utsname info;
00029         uname (&info);
00030         hostname = g_strdup (info.nodename);
00031     }
00032 
00033     return hostname;
00034 }