Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 29592
Collapse All | Expand All

(-)geotrace-0.0.4/callbacks.c (-6 / +11 lines)
Lines 219-237 Link Here
219
void add_trace_to_list (char *ret_string) {
219
void add_trace_to_list (char *ret_string) {
220
	struct trace_node *new_node;
220
	struct trace_node *new_node;
221
	int hop;
221
	int hop;
222
	char *ip,*name;
222
	char *ipbuffer,*ip,*name;
223
	float rtt;
223
	float rtt;
224
224
225
	if (debug_mode)
225
	if (debug_mode)
226
	        fprintf (stdout,"(callbacks.c) add_trace_to_list\n");
226
	        fprintf (stdout,"(callbacks.c) add_trace_to_list\n");
227
	new_node = malloc (sizeof(struct trace_node));
227
	new_node = malloc (sizeof(struct trace_node));
228
	ip = malloc (18);
228
	ipbuffer = malloc (18);
229
	name = malloc (40);
229
	ip = ipbuffer;
230
	ip[0] = 0;
231
	name = malloc (60);
232
	name[0] = 0;
230
	if (strchr(ret_string,'*') == NULL) {
233
	if (strchr(ret_string,'*') == NULL) {
231
		if (resolve)
234
		if (resolve)
232
			sscanf (ret_string,"%d %s %s %f",&hop,name,ip,&rtt);
235
			sscanf (ret_string,"%d %59s %17s %f",&hop,name,ip,&rtt);
233
		else
236
		else
234
			sscanf (ret_string,"%d %s %f",&hop,ip,&rtt);
237
			sscanf (ret_string,"%d %17s %f",&hop,ip,&rtt);
238
		ip[17] = 0;
239
		name[59] = 0;
235
		new_node->timed_out = 0;
240
		new_node->timed_out = 0;
236
		new_node->ip = malloc (strlen(ip)+1);
241
		new_node->ip = malloc (strlen(ip)+1);
237
		sprintf (new_node->ip,"%s",strtok(ip,"()"));
242
		sprintf (new_node->ip,"%s",strtok(ip,"()"));
Lines 253-259 Link Here
253
	gdk_threads_enter();
258
	gdk_threads_enter();
254
	trace_linked_list = g_list_append (trace_linked_list,new_node);
259
	trace_linked_list = g_list_append (trace_linked_list,new_node);
255
	gdk_threads_leave();
260
	gdk_threads_leave();
256
	free (ip);
261
	free (ipbuffer);
257
	free (name);
262
	free (name);
258
}
263
}
259
264
(-)geotrace-0.0.4/map.c (-3 / +4 lines)
Lines 45-55 Link Here
45
45
46
void scan_maps_file () {
46
void scan_maps_file () {
47
	FILE *map_props_file;
47
	FILE *map_props_file;
48
	char *tmpstr,*tmpstr2,*tmppath;
48
	char *stralloc, *tmpstr,*tmpstr2,*tmppath;
49
49
50
	map_strings = NULL;
50
	map_strings = NULL;
51
	host_strings = NULL;
51
	host_strings = NULL;
52
	tmpstr = malloc (512);
52
	stralloc = malloc (512);
53
	tmpstr = stralloc;
53
	tmppath = malloc (strlen(maps_dir_path)+strlen(MAP_FILE)+1);
54
	tmppath = malloc (strlen(maps_dir_path)+strlen(MAP_FILE)+1);
54
	sprintf (tmppath,"%s%s",maps_dir_path,MAP_FILE);
55
	sprintf (tmppath,"%s%s",maps_dir_path,MAP_FILE);
55
	map_props_file = fopen(tmppath,"r");
56
	map_props_file = fopen(tmppath,"r");
Lines 69-75 Link Here
69
		}
70
		}
70
	}
71
	}
71
	fclose (map_props_file);
72
	fclose (map_props_file);
72
	free (tmpstr);
73
	free (stralloc);
73
	free (tmppath);
74
	free (tmppath);
74
}
75
}
75
76
(-)geotrace-0.0.4/netgeoclient.c (-4 / +5 lines)
Lines 10-20 Link Here
10
10
11
	if (debug_mode)
11
	if (debug_mode)
12
	        fprintf (stdout,"(netgeoclient.c) get_netgeo_info\n");
12
	        fprintf (stdout,"(netgeoclient.c) get_netgeo_info\n");
13
	buffer = malloc (strlen(GEO_STRING)+strlen(request)+2);
13
	buffer = malloc (strlen(GEO_STRING)+strlen(request)+strlen(HTTP_STRING)+1);
14
	memset(buffer,0,strlen(GEO_STRING)+strlen(request)+2);
14
	memset(buffer,0,strlen(GEO_STRING)+strlen(request)+strlen(HTTP_STRING)+1);
15
	strcat (buffer,GEO_STRING);
15
	strcat (buffer,GEO_STRING);
16
	strcat (buffer,request);	
16
	strcat (buffer,request);	
17
	strcat (buffer,"\n");
17
	strcat (buffer,HTTP_STRING);
18
	outfile = fopen (tmpgeofile,"w");
18
	outfile = fopen (tmpgeofile,"w");
19
19
20
	send_socket = socket(PF_INET,SOCK_STREAM,0);
20
	send_socket = socket(PF_INET,SOCK_STREAM,0);
Lines 50-57 Link Here
50
	parse_node = malloc (sizeof(struct netgeo_format));
50
	parse_node = malloc (sizeof(struct netgeo_format));
51
	infile = fopen (tmpgeofile,"r");
51
	infile = fopen (tmpgeofile,"r");
52
	fscanf(infile,"%[^\n]\n",tmpstr);
52
	fscanf(infile,"%[^\n]\n",tmpstr);
53
	while (strchr(tmpstr,':')==NULL) 
53
	while (strstr(tmpstr,"<p>")==NULL) 
54
		fscanf(infile,"%[^\n]\n",tmpstr);
54
		fscanf(infile,"%[^\n]\n",tmpstr);
55
	fscanf(infile,"%[^\n]\n",tmpstr);
55
	while (!feof(infile)) {
56
	while (!feof(infile)) {
56
		if (strchr(tmpstr,':')!= NULL) {
57
		if (strchr(tmpstr,':')!= NULL) {
57
			tmpstr2 = strtok (tmpstr,":");
58
			tmpstr2 = strtok (tmpstr,":");
(-)geotrace-0.0.4/netgeoclient.h (+1 lines)
Lines 1-4 Link Here
1
#define GEO_STRING      "GET /perl/netgeo.cgi?target="
1
#define GEO_STRING      "GET /perl/netgeo.cgi?target="
2
#define HTTP_STRING	" HTTP/1.0\r\n\r\n"
2
struct netgeo_format {
3
struct netgeo_format {
3
        char *target;
4
        char *target;
4
        char *city;
5
        char *city;

Return to bug 29592