#include "globals.h" #define _XOPEN_SOURCE 500 #include #include #include "trace.h" static char *_hostname = NULL; const char *get_system_name() { if (_hostname == NULL) { _hostname = malloc(256 * sizeof(char)); if (gethostname(_hostname, 255) == -1) { TRACE(4, "get_hostname(): gethostname returned -1"); free(_hostname); _hostname = NULL; } } // TODO: try to get full qualified hostname return _hostname; }