FACT++  1.0
int main ( int  argc,
char **  argv 
)

Definition at line 69 of file dim_send_command.c.

References data, dic_cmnd_callback(), dic_set_dns_node(), dic_set_dns_port(), dim_wait(), i, received, rout(), and str.

72 {
73 int i;
74 int silent = 0;
75 char data[1024] = {'\0'};
76 int data_int, data_int_flag = 0;
77 char dns_node[128], *ptr;
78 int dns_port = 0;
79 
80  dns_node[0] = '\0';
81  for(i = 1; i < argc; i++)
82  {
83  if(!strcmp(argv[i],"-dns"))
84  {
85  strcpy(dns_node,argv[i+1]);
86  if((ptr = strchr(dns_node,':')))
87  {
88  *ptr = '\0';
89  ptr++;
90  sscanf(ptr,"%d",&dns_port);
91  }
92  i++;
93  }
94  else if(!strcmp(argv[i],"-s"))
95  {
96  silent = 1;
97  }
98  else if(!strcmp(argv[i],"-i"))
99  {
100  data_int_flag = 1;
101  }
102  else
103  {
104  if(!str[0])
105  {
106  strcpy(str, argv[i]);
107  }
108  else if(!data[0])
109  {
110  strcpy(data,argv[i]);
111  }
112  }
113  }
114  if(dns_node[0])
115  {
116  dic_set_dns_node(dns_node);
117  }
118  if(dns_port)
119  {
120  dic_set_dns_port(dns_port);
121  }
122  if(!str[0])
123  {
124  printf("dim_send_command: Insufficient parameters\n");
125  printf("usage: dim_send_command <cmnd_name> [<data>] [-dns <dns_node>] [-s] [-i]\n");
126  exit(0);
127  }
128  if(!data[0])
129  data[0] = '\0';
130  if(data_int_flag)
131  {
132  sscanf(data,"%d",&data_int);
133  dic_cmnd_callback(str,&data_int,sizeof(int), rout, silent);
134  }
135  else
136  {
137  dic_cmnd_callback(str,data,(int)strlen(data)+1, rout, silent);
138  }
139  while(!received)
140  dim_wait();
141  sleep(1);
142  return(1);
143 }
int dim_wait(void)
Definition: dim_thr.c:409
int i
Definition: db_dim_client.c:21
int received
int dic_set_dns_node(char *node)
Definition: open_dns.c:58
int dic_set_dns_port(int port)
Definition: open_dns.c:107
void rout(int *tag, int *code)
float data[4 *1440]
char str[132]
int dic_cmnd_callback(char *serv_name, void *serv_address, int serv_size, void(*usr_routine)(), dim_long tag)
Definition: dic.c:716

+ Here is the call graph for this function: