New function. Returns the machine's name, or one of its names. Document

2005-06-22  Tor Lillqvist  <tml@novell.com>

	* glib/gutils.c (g_get_host_name): New function. Returns the
	machine's name, or one of its names. Document that it is
	best-effort only, and not guaranteed to be unique or anything.
	(g_get_any_init): Get the host name here. On Unix use
	gethostname(), on Windows use GetComputerName(). (#5200)

	* glib/gutils.h
	* glib/glib.symbols: Add here, too.

	* tests/testglib.c: Test it.
This commit is contained in:
Tor Lillqvist
2005-06-22 08:54:28 +00:00
committed by Tor Lillqvist
parent da4aefe4a1
commit 477989f555
8 changed files with 101 additions and 0 deletions

View File

@@ -438,6 +438,7 @@ main (int argc,
g_free (string);
g_print ("user: %s\n", g_get_user_name ());
g_print ("real: %s\n", g_get_real_name ());
g_print ("host: %s\n", g_get_host_name ());
s = g_get_home_dir ();
g_print ("home: %s\n", s ? s : "NULL!");
s = g_get_user_data_dir ();