home *** CD-ROM | disk | FTP | other *** search
/ PC Shareware 1999 March / PCShareware-3-99.iso / IMPLE / DJGPP.RAR / DJGPP2 / XLIB-SR0.ZIP / SRC / XLIBEMU / GETHOSTN.C < prev    next >
C/C++ Source or Header  |  1994-02-18  |  338b  |  18 lines

  1. /* $Id: gethostn.c 1.1 1994/02/18 21:10:19 ulrich Exp $ */
  2. /*
  3.  * gethostname() needed for XLib(emu).
  4.  */
  5. #include <string.h>
  6.  
  7. extern char *getenv (const char *);
  8.  
  9. int gethostname(char *buf, int size)
  10. {
  11.   char *p = getenv ("HOST");
  12.   if (p == (char *) 0) 
  13.     p = "noname";
  14.   strncpy (buf, p, size - 1);
  15.   buf[size - 1] = 0;
  16.   return 0;
  17. }
  18.