gethostname() - get name of current host
#include <unistd.h>
int gethostname (char *name, int namelen)
The gethostname(2) function returns the standard host name for the current processor. The parameter namelen specifies the size of the name array. The returned name is null-terminated unless insufficient space is provided.
If the call succeeds, it returns 0. If the call fails, it returns -1 and sets errno to indicate the error.
The following errors may be returned by these calls:
Host names are limited to {MAXHOSTNAMELEN} (from <limits.h>) characters.