home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / D / LIBC / LIBC-4.6 / LIBC-4 / libc-linux / compat / m68k / __old__ghn.c next >
Encoding:
C/C++ Source or Header  |  1994-01-24  |  390 b   |  25 lines

  1. #include <string.h>
  2. #include <unistd.h>
  3. #include <linux/utsname.h>
  4. #include <errno.h>
  5.  
  6. int
  7. __old__gethostname(char *name, size_t len)
  8. {
  9.   struct old_utsname uts;
  10.  
  11.   if (name == NULL) {
  12.     errno = EINVAL;
  13.     return -1;
  14.   }
  15.  
  16.   if (__old__uname(&uts) == -1) return -1;
  17.  
  18.   if (strlen(uts.nodename)+1 > len) {
  19.     errno = EINVAL;
  20.     return -1;
  21.   }
  22.   strcpy(name, uts.nodename);
  23.   return 0;
  24. }
  25.