tcp.c   tcp.c 
skipping to change at line 17 skipping to change at line 17
* tcp.c -- unix tcp connection routines * tcp.c -- unix tcp connection routines
* *
*/ */
#if HAVE_CONFIG_H #if HAVE_CONFIG_H
#include <conf.h> #include <conf.h>
#endif #endif
#if HAVE_UNISTD_H #if HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
#if HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#include <xport.h> #include <xport.h>
#include <tcp.h> #include <tcp.h>
/* the ever-present */ /* the ever-present */
#ifndef SZ_LINE #ifndef SZ_LINE
#define SZ_LINE 1024 #define SZ_LINE 1024
#endif #endif
/* name of user environment variable specifying this host */
#ifndef MYHOST
#define MYHOST "XPA_HOST"
#endif
/* other modules can set this variable and the default for various routines /* other modules can set this variable and the default for various routines
will be "localhost" instead of the DNS-dependent hostname */ will be "localhost" instead of the DNS-dependent hostname */
int use_localhost=0; int use_localhost=0;
static char myhost[SZ_LINE]; /* hostname to registering access points */
/* /*
*------------------------------------------------------------------------- --- *------------------------------------------------------------------------- ---
* *
* *
* Private Routines and Data * Private Routines and Data
* *
* *
*------------------------------------------------------------------------- --- *------------------------------------------------------------------------- ---
*/ */
skipping to change at line 77 skipping to change at line 87
gethost ( gethost (
char *xhost, /* (out) corresponding hostname */ char *xhost, /* (out) corresponding hostname */
int len /* (in) length of host buffer */ int len /* (in) length of host buffer */
) )
#else #else
int gethost(xhost, len) int gethost(xhost, len)
char *xhost; /* (out) corresponding hostname */ char *xhost; /* (out) corresponding hostname */
int len; /* (in) length of host buffer */ int len; /* (in) length of host buffer */
#endif #endif
{ {
char *s=NULL;
struct hostent *hent; struct hostent *hent;
static int init=0;
if( use_localhost == 0 ){ if( use_localhost == 0 ){
gethostname(xhost, len); if( init == 0 ){
if( (s=(char *)getenv(MYHOST)) != NULL ){
strncpy(myhost, s, SZ_LINE-1);
} else {
gethostname(myhost, SZ_LINE-1);
}
init++;
}
strncpy(xhost, myhost, len-1);
if( (hent = gethostbyname(xhost)) == NULL ){ if( (hent = gethostbyname(xhost)) == NULL ){
return(-1); return(-1);
} }
strncpy(xhost, hent->h_name, len-1); strncpy(xhost, hent->h_name, len-1);
} }
else{ else{
strncpy(xhost, "localhost", len-1); strncpy(xhost, "localhost", len-1);
} }
xhost[len-1] = '\0'; xhost[len-1] = '\0';
return(0); return(0);
 End of changes. 6 change blocks. 
1 lines changed or deleted 21 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/