home *** CD-ROM | disk | FTP | other *** search
- /* gethostname() for SysV -- by Donald Burr
- Uses uname() and returns the system's UUCP nodename for a hostname
- A quick hack I did for locktty */
-
- #include <sys/utsname.h> /* #include for uname() call */
- #include <string.h> /* String routines strcpy() */
-
- int gethostname(hostname, somenumber)
-
- char *hostname[]; /* Where the hostname will be returned */
- int somenumber; /* Haven't figured out what this is */
-
- {
- struct utsname name; /* uname returns the sysname here */
- /* had an asterisk */
- if ((uname(&name)) == -1) /* did it fail? */
- return -1; /* failed, so return a failure */
- else {
- strcpy(hostname, name.nodename);
- /* return the nodename */
- return 1; } /* successfull completion */
-
- return -1; /* something must be wrong... exit */
- }
-