When called without any arguments, the program displays the current name as set by the hostname command. You can change the output format to display always the short or the long host name (FQDN). When called with arguments, the program will set the value of the host name to the value specified. This usually is done only once, at system startup time, by the /etc/rc.d/rc.inet1 configuration script.
Note, that only the super-user can change the host name.
If the program was called as dnsdomainname it will show the DNS domain name. You can't change the DNS domain name with dnsdomainname (see below).