unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (HP-UX-11.11)
Page:
Section:
Apropos / Subsearch:
optional field



 gethostname(2)						      gethostname(2)




 NAME
      gethostname - get name of current host

 SYNOPSIS
      #include <&lt&lt&lt;unistd.h>&gt&gt&gt;

      int gethostname(char *hostname, size_t size);

 DESCRIPTION
      gethostname() returns in the array to which hostname points, the
      standard host name for the current processor as set by sethostname()
      (see sethostname(2)).  size specifies the length of the hostname
      array.  hostname is null-terminated unless insufficient space is
      provided.

 RETURN VALUE
      gethostname() returns 0 if successful.  Otherwise, it returns -1 and
      sets errno to indicate the error.

 ERRORS
      gethostname() can fail if the following is true:

      [EFAULT]	     hostname points to an illegal address.  The reliable
		     detection of this error is implementation dependent.

      [EINVAL]	     size is less than one.

 AUTHOR
      gethostname() was developed by the University of California, Berkeley.

 SEE ALSO
      hostname(1), uname(1), sethostname(2), uname(2).






















 Hewlett-Packard Company	    - 1 -   HP-UX Release 11i: November 2000