FACT++  1.0
int get_node_name ( char *  node_name)

Definition at line 33 of file utilities.c.

References i, and MAX_NODE_NAME.

Referenced by dic_get_id(), dna_open_client(), main(), register_services(), and unregister_service().

34 {
35 #ifndef VxWorks
36 struct hostent *host;
37 #endif
38 char *p;
39 int i;
40 #ifdef WIN32
41 extern void init_sock();
42 #endif
43 
44  DISABLE_AST
45 #ifdef WIN32
46  init_sock();
47 #endif
48  if( (p = getenv("DIM_HOST_NODE")) != NULL )
49  {
50  strcpy( node_name, p );
51  ENABLE_AST
52  return(1);
53  }
54  if((gethostname(node_name, MAX_NODE_NAME)) == -1)
55  {
56  ENABLE_AST
57  return(0);
58  }
59 #ifndef VxWorks
60 #ifndef RAID
61  if(!strchr(node_name,'.'))
62  {
63  if ((host = gethostbyname(node_name)) != (struct hostent *)0)
64  {
65  strcpy(node_name,host->h_name);
66  if(!strchr(node_name,'.'))
67  {
68  if(host->h_aliases)
69  {
70  if(host->h_aliases[0])
71  {
72  for(i = 0; host->h_aliases[i]; i++)
73  {
74  p = host->h_aliases[i];
75  if(strchr(p,'.'))
76  {
77  strcpy(node_name,p);
78  break;
79  }
80  }
81  }
82  }
83  }
84  }
85  }
86 #endif
87 #endif
88  ENABLE_AST
89  return(1);
90 }
int i
Definition: db_dim_client.c:21
#define MAX_NODE_NAME
Definition: dim.h:180

+ Here is the caller graph for this function: