Mapper
get_drt_menu.c
Go to the documentation of this file.
1 #include <stdio.h>
2 #include <string.h>
3 #include <stdlib.h>
4 #include <errno.h>
5 #include "prototypes.h"
6 
8 {
9 
10 /*
11 extern void drt_select();
12 */
13 extern int errno;
14 extern struct MenuItem drt_items[100];
15 char kbuf[256],*p,file[128],*sname[128],nm[128],*sfile[128];
16 char line[128],done[128];
17 FILE *fp1,*pf;
18 int j,k,ier;
19 int debug=1;
20 int time_stamp;
21 
22  j=0;
23  ier=chdir(data_file);
24 
25  pf=popen("ls -1 *hydro*","r");
26  while(fgets(nm,sizeof(nm),pf))
27  {
28  /* trim filename */
29  *(nm+(strlen(nm)-1))='\0';
30  if(debug)
31  printf("%s\n",nm);
32 
33  if((fp1 = fopen (nm,"r")))
34  {
35  if(fgets(line,sizeof(line),fp1))
36  {
37  k=sscanf(line,"%d %s",&time_stamp,done);
38  if(k)
39  {
40  if(!strcmp(done,"done"))
41  {
42  sname[j]=calloc(1,strlen(nm)+1);
43  strcpy(sname[j],nm);
44  sfile[j]=calloc(1,strlen(file)+1);
45  strcpy(sfile[j],file);
46  drt_items[j].label=sname[j];
47 /*
48  drt_items[j].callback=drt_select;
49 */
50  drt_items[j].callback=NULL;
52  j++;
53  }
54  }
55  }
56  }
57  }
58  drt_items[j].label=NULL;
59  return;
60 }
void get_drt_menu(char *data_file)
Definition: get_drt_menu.c:7
int debug
Definition: hydro_data.h:53
printf("fbuf is %s\n", fbuf)
int j
Definition: mapp2h.h:48
int k
Definition: mapp2h.h:48
struct sensor_file * sfile
Definition: mapper.c:126
char data_file[100]
Definition: mapper.c:20
struct MenuItem drt_items[100]
Definition: mapper.c:138
Definition: misc.h:459
char * label
Definition: misc.h:461
void(* callback)()
Definition: misc.h:463
XtPointer callback_data
Definition: misc.h:464