FACT++  1.0
void do_got_service_list ( SERVER servp)

Definition at line 2805 of file didMarkus.c.

References create_str(), Curr_service_list_id, delete_str(), Memory::free(), i, id, Memory::malloc(), MAX_NAME, DNS_SERVER_INFO::n_services, DNS_SERVICE_INFO::name, item::server, item::service_ptr, set_something(), and DNS_SERVICE_INFO::type.

Referenced by got_service_list(), and main().

2806 {
2807 char cmd_str[256], svc_str[256];
2808 DNS_SERVER_INFO *ptr;
2809 DNS_SERVICE_INFO *service_ptr;
2810 Widget id;
2811 char *curr_str, max_str[MAX_NAME], *sptr;
2812 DID_SLOT *service_list;
2813 int i, j, curr_index = 0, n_services;
2814 XmString xstr;
2815 void delete_str();
2816 
2817  ptr = &servp->server;
2818  id = Curr_service_list_id;
2819 
2820  XmListDeleteAllItems(id);
2821 
2822  strcpy(cmd_str,"CMD: ");
2823  strcpy(svc_str,"SVC: ");
2824 
2825  service_ptr = servp->service_ptr;
2826  service_list = (DID_SLOT *)malloc(ptr->n_services * MAX_NAME);
2827  n_services = ptr->n_services;
2828 
2829  for(i=0;i<n_services; i++)
2830  {
2831  strcpy(service_list[i],service_ptr->name);
2832  service_ptr++;
2833  }
2834  strcpy(max_str,"zzzzzzzzzzzzzzzzzzzzzzzzzzzz");
2835  for(i=0;i<n_services; i++)
2836  {
2837  curr_str = max_str;
2838  for(j=0;j<n_services; j++)
2839  {
2840  sptr = service_list[j];
2841  if(!*sptr)
2842  continue;
2843 
2844  if(strcmp(sptr,curr_str) < 0)
2845  {
2846  curr_str = sptr;
2847  curr_index = j;
2848  }
2849  }
2850  service_list[curr_index][0] = '\0';
2851  service_ptr = &(servp->service_ptr[curr_index]);
2852  if(service_ptr->type)
2853  {
2854  strcpy(&cmd_str[5],service_ptr->name);
2855  xstr = create_str(cmd_str);
2856  XmListAddItem(id,xstr,i+1);
2857  delete_str(xstr);
2858  }
2859  else
2860  {
2861  strcpy(&svc_str[5],service_ptr->name);
2862  xstr = create_str(svc_str);
2863  XmListAddItem(id,xstr,i+1);
2864  delete_str(xstr);
2865  }
2866  }
2867  free(service_list);
2868 
2869  set_something(id,XmNlistItemCount,i);
2870  set_something(id,XmNlistVisibleItemCount,(i < 20) ? i : 20);
2871 }
#define MAX_NAME
Definition: dim.h:182
int i
Definition: db_dim_client.c:21
void * malloc()
Definition: EventBuilder.cc:99
char id[4]
Definition: FITS.h:71
DNS_SERVICE_INFO * service_ptr
Definition: did.h:45
char name[MAX_NAME]
Definition: dim.h:331
Widget Curr_service_list_id
Definition: didMarkus.c:27
void set_something()
DNS_SERVER_INFO server
Definition: did.h:44
void delete_str(XmString str)
Definition: dui_util.c:55
void free(void *mem)
XmString create_str()
char DID_SLOT[MAX_NAME]
Definition: didMarkus.c:2781
int n_services
Definition: dim.h:341

+ Here is the call graph for this function:

+ Here is the caller graph for this function: