/[inetutils]/inetutils/libinetutils/localhost.c
ViewVC logotype

Diff of /inetutils/libinetutils/localhost.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.11 by gray, Sat Jul 14 14:48:38 2001 UTC revision 1.12 by ams, Fri Jan 21 12:53:49 2005 UTC
# Line 1  Line 1 
1  /* A slightly more convenient wrapper for gethostname  /* A slightly more convenient wrapper for gethostname
2    
3     Copyright (C) 1996, 1997, 2000 Free Software Foundation, Inc.     Copyright (C) 1996, 1997, 2000, 2005 Free Software Foundation, Inc.
4    
5     Written by Miles Bader <miles@gnu.ai.mit.edu>     Written by Miles Bader <miles@gnu.ai.mit.edu>
6    
# Line 36  Line 36 
36  #include <netinet/in.h>  #include <netinet/in.h>
37  #include <netdb.h>  #include <netdb.h>
38    
 #if __STDC__  
 # define VOID void  
 #else  
 # define VOID char  
 #endif  
 extern VOID *xrealloc __P((VOID *p, size_t n));  
   
39  /* Return the name of the localhost.  This is just a wrapper for gethostname,  /* Return the name of the localhost.  This is just a wrapper for gethostname,
40     which takes care of allocating a big enough buffer, and caches the result     which takes care of allocating a big enough buffer, and caches the result
41     after the first call (so the result should be copied before modification).     after the first call (so the result should be copied before modification).
# Line 62  localhost (void) Line 55  localhost (void)
55        errno = 0;        errno = 0;
56    
57        buf_len += 256;   /* Initial guess */        buf_len += 256;   /* Initial guess */
58        tmp = xrealloc (buf, buf_len);        tmp = realloc (buf, buf_len);
   
59        if (tmp == NULL)        if (tmp == NULL)
60          {          {
61            errno = ENOMEM;            errno = ENOMEM;

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26