Fawkes API Fawkes Development Version
qa_hostinfo.cpp
1
2/***************************************************************************
3 * qa_hostinfo.h - QA for HostInfo
4 *
5 * Generated: Fri Jan 16 16:31:20 2007
6 * Copyright 2005-2007 Tim Niemueller [www.niemueller.de]
7 *
8 ****************************************************************************/
9
10/* This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version. A runtime exception applies to
14 * this software (see LICENSE.GPL_WRE file mentioned below for details).
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Library General Public License for more details.
20 *
21 * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22 */
23
24// Do not include in api reference
25///@cond QA
26
27#include <utils/system/hostinfo.h>
28
29#include <cstdio>
30
31using namespace fawkes;
32
33int
34main(int argc, char **argv)
35{
36 HostInfo h;
37
38 printf("Hostname: %s\n"
39 "Short hostname: %s\n"
40 "Domain name: %s\n"
41 "Architecture: %s\n"
42 "Sys Name: %s\n"
43 "Sys Release: %s\n"
44 "Sys Version: %s\n",
45 h.name(),
46 h.short_name(),
47 h.domain(),
48 h.arch(),
49 h.sys_name(),
50 h.sys_release(),
51 h.sys_version());
52
53 return 0;
54}
55
56/// @endcond
Host information.
Definition: hostinfo.h:32
const char * sys_release()
Get system release (kernel version on Linux).
Definition: hostinfo.cpp:145
const char * name()
Get full hostname.
Definition: hostinfo.cpp:100
const char * domain()
Get domain name (after first dot or none if no dot in name).
Definition: hostinfo.cpp:118
const char * arch()
Get architecture (like i686 or x86_64).
Definition: hostinfo.cpp:127
const char * short_name()
Get short hostname (up to first dot).
Definition: hostinfo.cpp:109
const char * sys_version()
Get system version (build date on Linux).
Definition: hostinfo.cpp:154
const char * sys_name()
Get system name (like Linux).
Definition: hostinfo.cpp:136
Fawkes library namespace.