Mercurial > gftp.yaz
annotate src/gtk/misc-gtk.c @ 14:83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
* Sanity checking on the fdopen() calls. Also make sure that all of them have a + in their open mode. Doesn't affect UNIX, but it does affect Windows
* HTTP fixes when running under Solaris. Read from request->sockfd and write to request->sockfd_write (Solaris doesn't like it when you read/write to the same FILE structure)
* Display major/minor properly for a device when connected with the local protocol
author | masneyb |
---|---|
date | Wed, 04 Sep 2002 11:45:56 +0000 |
parents | 5551ab2301fe |
children | 3b2dcdefc7e9 |
rev | line source |
---|---|
1 | 1 /*****************************************************************************/ |
2 /* misc-gtk.c - misc stuff for the gtk+ 1.2 port of gftp */ | |
3 /* Copyright (C) 1998-2002 Brian Masney <masneyb@gftp.org> */ | |
4 /* */ | |
5 /* This program is free software; you can redistribute it and/or modify */ | |
6 /* it under the terms of the GNU General Public License as published by */ | |
7 /* the Free Software Foundation; either version 2 of the License, or */ | |
8 /* (at your option) any later version. */ | |
9 /* */ | |
10 /* This program is distributed in the hope that it will be useful, */ | |
11 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ | |
12 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ | |
13 /* GNU General Public License for more details. */ | |
14 /* */ | |
15 /* You should have received a copy of the GNU General Public License */ | |
16 /* along with this program; if not, write to the Free Software */ | |
17 /* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
18 /*****************************************************************************/ | |
19 | |
20 #include <gftp-gtk.h> | |
21 | |
22 static void set_menu_sensitive ( gftp_window_data * wdata, | |
23 char *path, | |
24 int sensitive ); | |
25 static void destroy_dialog_data ( gftp_dialog_data * data ); | |
26 static gint delete_event ( GtkWidget * widget, | |
27 GdkEvent * event, | |
28 gpointer data ); | |
29 static void trans_stop_button ( GtkWidget * widget, | |
30 gpointer data ); | |
31 | |
32 static GtkWidget * statuswid; | |
33 | |
34 | |
35 void | |
36 fix_display (void) | |
37 { | |
38 while (g_main_iteration (FALSE)); | |
39 } | |
40 | |
41 | |
42 void | |
43 remove_files_window (gftp_window_data * wdata) | |
44 { | |
45 wdata->show_selected = 0; | |
46 gtk_clist_freeze (GTK_CLIST (wdata->listbox)); | |
47 gtk_clist_clear (GTK_CLIST (wdata->listbox)); | |
48 free_file_list (wdata->files); | |
49 wdata->files = NULL; | |
50 gtk_clist_thaw (GTK_CLIST (wdata->listbox)); | |
51 } | |
52 | |
53 | |
54 void | |
55 ftp_log (gftp_logging_level level, void *ptr, const char *string, ...) | |
56 { | |
57 char tempstr[512]; | |
58 gftp_log * newlog; | |
59 gint delsize; | |
60 va_list argp; | |
61 guint len; | |
62 int upd; | |
63 #if GTK_MAJOR_VERSION == 1 && GTK_MINOR_VERSION == 2 | |
64 gftp_color * color; | |
65 GdkColor fore; | |
66 #else | |
67 GtkTextBuffer * textbuf; | |
68 GtkTextIter iter, iter2; | |
69 const char *descr; | |
70 guint inslen; | |
71 #endif | |
72 | |
73 if (ptr == (void *) 0x1) | |
74 { | |
75 newlog = g_malloc0 (sizeof (*newlog)); | |
76 newlog->type = level; | |
77 va_start (argp, string); | |
78 newlog->msg = g_strdup_vprintf (string, argp); | |
79 va_end (argp); | |
80 | |
81 pthread_mutex_lock (&log_mutex); | |
82 file_transfer_logs = g_list_append (file_transfer_logs, newlog); | |
83 pthread_mutex_unlock (&log_mutex); | |
84 return; | |
85 } | |
86 | |
87 va_start (argp, string); | |
88 g_vsnprintf (tempstr, sizeof (tempstr), string, argp); | |
89 va_end (argp); | |
90 | |
91 if (logfd != NULL) | |
92 { | |
93 if (fwrite (tempstr, strlen (tempstr), 1, logfd) != 1) | |
94 { | |
95 fclose (logfd); | |
96 logfd = NULL; | |
97 } | |
98 else | |
99 fflush (logfd); | |
100 } | |
101 | |
102 upd = logwdw_vadj->upper - logwdw_vadj->page_size == logwdw_vadj->value; | |
103 | |
104 #if GTK_MAJOR_VERSION == 1 && GTK_MINOR_VERSION == 2 | |
105 switch (level) | |
106 { | |
107 case gftp_logging_send: | |
108 color = &send_color; | |
109 break; | |
110 case gftp_logging_recv: | |
111 color = &recv_color; | |
112 break; | |
113 case gftp_logging_error: | |
114 color = &error_color; | |
115 break; | |
116 default: | |
117 color = &misc_color; | |
118 break; | |
119 } | |
120 | |
121 memset (&fore, 0, sizeof (fore)); | |
122 fore.red = color->red; | |
123 fore.green = color->green; | |
124 fore.blue = color->blue; | |
125 | |
126 gtk_text_freeze (GTK_TEXT (logwdw)); | |
127 gtk_text_insert (GTK_TEXT (logwdw), NULL, &fore, NULL, tempstr, -1); | |
128 | |
129 len = gtk_text_get_length (GTK_TEXT (logwdw)); | |
130 if (max_log_window_size > 0 && len > max_log_window_size) | |
131 { | |
132 delsize = len - max_log_window_size; | |
133 gtk_text_set_point (GTK_TEXT (logwdw), delsize); | |
134 gtk_text_backward_delete (GTK_TEXT (logwdw), delsize); | |
135 len = max_log_window_size; | |
136 } | |
137 gtk_text_set_point (GTK_TEXT (logwdw), len); | |
138 | |
139 gtk_text_thaw (GTK_TEXT (logwdw)); | |
140 | |
141 if (upd) | |
142 gtk_adjustment_set_value (logwdw_vadj, logwdw_vadj->upper); | |
143 #else | |
144 switch (level) | |
145 { | |
146 case gftp_logging_send: | |
147 descr = "send"; | |
148 break; | |
149 case gftp_logging_recv: | |
150 descr = "recv"; | |
151 break; | |
152 case gftp_logging_error: | |
153 descr = "error"; | |
154 break; | |
155 default: | |
156 descr = "misc"; | |
157 break; | |
158 } | |
159 | |
160 textbuf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (logwdw)); | |
161 len = gtk_text_buffer_get_char_count (textbuf); | |
162 inslen = strlen (tempstr); | |
163 gtk_text_buffer_get_iter_at_offset (textbuf, &iter, len); | |
164 gtk_text_buffer_insert_with_tags_by_name (textbuf, &iter, tempstr, inslen, | |
165 descr, NULL); | |
166 | |
167 if (upd) | |
168 { | |
169 gtk_text_buffer_move_mark (textbuf, logwdw_textmark, &iter); | |
170 gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (logwdw), logwdw_textmark, | |
171 0, 1, 1, 1); | |
172 } | |
173 | |
174 delsize = len + inslen - max_log_window_size; | |
175 if (max_log_window_size > 0 && delsize > 0) | |
176 { | |
177 gtk_text_buffer_get_iter_at_offset (textbuf, &iter, 0); | |
178 gtk_text_buffer_get_iter_at_offset (textbuf, &iter2, delsize); | |
179 gtk_text_buffer_delete (textbuf, &iter, &iter2); | |
180 } | |
181 #endif | |
182 | |
183 if (ptr == NULL) | |
184 fix_display (); | |
185 } | |
186 | |
187 | |
188 void | |
189 refresh (gftp_window_data * wdata) | |
190 { | |
191 if (!check_status (_("Refresh"), wdata, 0, 0, 0, 1)) | |
192 return; | |
193 gtk_clist_freeze (GTK_CLIST (wdata->listbox)); | |
194 remove_files_window (wdata); | |
195 gftp_delete_cache_entry (wdata->request); | |
196 ftp_list_files (wdata, 0); | |
197 gtk_clist_thaw (GTK_CLIST (wdata->listbox)); | |
198 fix_display (); | |
199 } | |
200 | |
201 | |
202 void | |
203 update_window_info (void) | |
204 { | |
205 char *tempstr, empty[] = ""; | |
206 GtkWidget * tempwid; | |
207 int i; | |
208 | |
209 if (current_wdata->request != NULL) | |
210 { | |
211 if ((tempstr = GFTP_GET_HOSTNAME (current_wdata->request)) == NULL) | |
212 tempstr = empty; | |
213 gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (hostedit)->entry), tempstr); | |
214 | |
215 if ((tempstr = GFTP_GET_USERNAME (current_wdata->request)) == NULL) | |
216 tempstr = empty; | |
217 gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (useredit)->entry), tempstr); | |
218 | |
219 if ((tempstr = GFTP_GET_PASSWORD (current_wdata->request)) == NULL) | |
220 tempstr = empty; | |
221 gtk_entry_set_text (GTK_ENTRY (passedit), tempstr); | |
222 | |
223 if (GFTP_GET_PORT (current_wdata->request) != 0) | |
224 { | |
225 tempstr = g_strdup_printf ("%d", GFTP_GET_PORT (current_wdata->request)); | |
226 gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (portedit)->entry), tempstr); | |
227 g_free (tempstr); | |
228 } | |
229 | |
230 for (i=0; gftp_protocols[i].init != NULL; i++) | |
231 { | |
232 if (current_wdata->request->init == gftp_protocols[i].init) | |
233 { | |
234 gtk_option_menu_set_history (GTK_OPTION_MENU (optionmenu), i); | |
235 break; | |
236 } | |
237 } | |
238 } | |
239 | |
240 update_window (&window1); | |
241 update_window (&window2); | |
242 | |
7 | 243 tempwid = gtk_item_factory_get_widget (factory, menus[tools_start+2].path); |
1 | 244 gtk_widget_set_sensitive (tempwid, GFTP_IS_CONNECTED (window1.request) |
245 && GFTP_IS_CONNECTED (window2.request)); | |
246 } | |
247 | |
248 | |
249 void | |
250 update_window (gftp_window_data * wdata) | |
251 { | |
252 char *dir, *tempstr, *temp1str, *fspec; | |
253 int connected, start; | |
254 | |
255 connected = GFTP_IS_CONNECTED (wdata->request); | |
256 if (connected) | |
257 { | |
258 fspec = wdata->show_selected ? "Selected" : strcmp (wdata->filespec, "*") == 0 ? _("All Files") : wdata->filespec; | |
259 | |
260 if ((temp1str = GFTP_GET_HOSTNAME (wdata->request)) == NULL) | |
261 temp1str = ""; | |
262 tempstr = g_strconcat (temp1str, *temp1str == '\0' ? "[" : " [", | |
263 GFTP_GET_PROTOCOL_NAME (wdata->request), | |
264 wdata->request->cached ? _("] (Cached) [") : "] [", | |
265 fspec, "]", current_wdata == wdata ? "*" : "", NULL); | |
266 gtk_label_set (GTK_LABEL (wdata->hoststxt), tempstr); | |
267 g_free (tempstr); | |
268 | |
269 if ((dir = GFTP_GET_DIRECTORY (wdata->request)) == NULL) | |
270 temp1str = ""; | |
271 else | |
272 temp1str = dir; | |
273 | |
274 gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (wdata->combo)->entry),temp1str); | |
275 } | |
276 else if (wdata->hoststxt != NULL) | |
277 { | |
278 tempstr = g_strconcat (_("Not connected"), | |
279 current_wdata == wdata ? "*" : "", NULL); | |
280 gtk_label_set (GTK_LABEL (wdata->hoststxt), tempstr); | |
281 g_free (tempstr); | |
282 gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (wdata->combo)->entry), ""); | |
283 } | |
284 | |
285 if (wdata == &window1) | |
286 start = local_start; | |
287 else | |
288 start = remote_start; | |
289 | |
290 set_menu_sensitive (wdata, menus[start + 3].path, connected && | |
291 strcmp (wdata->request->url_prefix, "file") != 0); | |
292 set_menu_sensitive (wdata, menus[start + 5].path, connected); | |
293 set_menu_sensitive (wdata, menus[start + 6].path, connected); | |
294 set_menu_sensitive (wdata, menus[start + 7].path, connected); | |
295 set_menu_sensitive (wdata, menus[start + 8].path, connected); | |
296 set_menu_sensitive (wdata, menus[start + 9].path, connected); | |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
297 set_menu_sensitive (wdata, menus[start + 11].path, connected); |
1 | 298 set_menu_sensitive (wdata, menus[start + 12].path, connected && |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
299 wdata->request->site != NULL); |
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
300 set_menu_sensitive (wdata, menus[start + 13].path, connected && |
1 | 301 wdata->request->chdir!= NULL); |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
302 set_menu_sensitive (wdata, menus[start + 14].path, connected && |
1 | 303 wdata->request->chmod != NULL); |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
304 set_menu_sensitive (wdata, menus[start + 15].path, connected && |
1 | 305 wdata->request->mkdir != NULL); |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
306 set_menu_sensitive (wdata, menus[start + 16].path, connected && |
1 | 307 wdata->request->rename != NULL); |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
308 set_menu_sensitive (wdata, menus[start + 17].path, connected && |
1 | 309 wdata->request->rmdir != NULL && |
310 wdata->request->rmfile != NULL); | |
311 set_menu_sensitive (wdata, menus[start + 18].path, connected && | |
312 wdata->request->get_file != NULL); | |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
313 set_menu_sensitive (wdata, menus[start + 19].path, connected && |
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
314 wdata->request->get_file != NULL); |
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
315 set_menu_sensitive (wdata, menus[start + 20].path, connected); |
1 | 316 fix_display (); |
317 } | |
318 | |
319 | |
320 static void | |
321 set_menu_sensitive (gftp_window_data * wdata, char *path, int sensitive) | |
322 { | |
323 GtkWidget * tempwid; | |
324 char * pos; | |
325 | |
326 tempwid = NULL; | |
327 | |
328 if (factory != NULL) | |
7 | 329 tempwid = gtk_item_factory_get_widget (factory, path); |
1 | 330 if (tempwid) |
331 gtk_widget_set_sensitive (tempwid, sensitive); | |
332 | |
333 if ((pos = strchr (path + 1, '/')) == NULL) | |
334 pos = path; | |
335 | |
336 if (wdata->ifactory) | |
7 | 337 tempwid = gtk_item_factory_get_widget (wdata->ifactory, pos); |
1 | 338 if (tempwid) |
339 gtk_widget_set_sensitive (tempwid, sensitive); | |
340 } | |
341 | |
342 | |
343 GtkWidget * | |
344 toolbar_pixmap (GtkWidget * widget, char *filename) | |
345 { | |
346 gftp_graphic * graphic; | |
347 GtkWidget *pix; | |
348 | |
349 if (filename == NULL || *filename == '\0') | |
350 return (NULL); | |
351 | |
352 graphic = open_xpm (widget, filename); | |
353 | |
354 if (graphic == NULL) | |
355 return (NULL); | |
356 | |
357 if ((pix = gtk_pixmap_new (graphic->pixmap, graphic->bitmap)) == NULL) | |
358 return (NULL); | |
359 | |
360 gtk_widget_show (pix); | |
361 return (pix); | |
362 } | |
363 | |
364 | |
365 gftp_graphic * | |
366 open_xpm (GtkWidget * widget, char *filename) | |
367 { | |
368 gftp_graphic * graphic; | |
369 GtkStyle *style; | |
370 char *exfile; | |
371 | |
372 if ((graphic = g_hash_table_lookup (graphic_hash_table, filename)) != NULL) | |
373 return (graphic); | |
374 | |
375 style = gtk_widget_get_style (widget); | |
376 | |
377 if ((exfile = get_xpm_path (filename, 0)) == NULL) | |
378 return (NULL); | |
379 | |
380 graphic = g_malloc0 (sizeof (*graphic)); | |
381 graphic->pixmap = gdk_pixmap_create_from_xpm (widget->window, | |
382 &graphic->bitmap, &style->bg[GTK_STATE_NORMAL], exfile); | |
383 g_free (exfile); | |
384 | |
385 if (graphic->pixmap == NULL) | |
386 { | |
387 g_free (graphic); | |
388 ftp_log (gftp_logging_error, NULL, _("Error opening file %s: %s\n"), | |
389 exfile, g_strerror (errno)); | |
390 return (NULL); | |
391 } | |
392 | |
393 graphic->filename = g_malloc (strlen (filename) + 1); | |
394 strcpy (graphic->filename, filename); | |
395 g_hash_table_insert (graphic_hash_table, graphic->filename, graphic); | |
396 | |
397 return (graphic); | |
398 } | |
399 | |
400 | |
401 void | |
402 gftp_free_pixmap (char *filename) | |
403 { | |
404 gftp_graphic * graphic; | |
405 | |
406 if ((graphic = g_hash_table_lookup (graphic_hash_table, filename)) == NULL) | |
407 return; | |
408 | |
409 #if GTK_MAJOR_VERSION == 1 && GTK_MINOR_VERSION == 2 | |
410 gdk_pixmap_unref (graphic->pixmap); | |
411 gdk_bitmap_unref (graphic->bitmap); | |
412 #else | |
413 gdk_drawable_unref (graphic->pixmap); | |
414 gdk_drawable_unref (graphic->bitmap); | |
415 #endif | |
416 | |
417 g_hash_table_remove (graphic_hash_table, filename); | |
418 g_free (graphic->filename); | |
419 g_free (graphic); | |
420 } | |
421 | |
422 | |
423 void | |
424 gftp_get_pixmap (GtkWidget * widget, char *filename, GdkPixmap ** pix, | |
425 GdkBitmap ** bitmap) | |
426 { | |
427 gftp_graphic * graphic; | |
428 | |
429 if (filename == NULL || *filename == '\0') | |
430 { | |
431 *pix = NULL; | |
432 *bitmap = NULL; | |
433 return; | |
434 } | |
435 | |
436 if ((graphic = g_hash_table_lookup (graphic_hash_table, filename)) == NULL) | |
437 graphic = open_xpm (widget, filename); | |
438 | |
439 if (graphic == NULL) | |
440 { | |
441 *pix = NULL; | |
442 *bitmap = NULL; | |
443 return; | |
444 } | |
445 | |
446 *pix = graphic->pixmap; | |
447 *bitmap = graphic->bitmap; | |
448 } | |
449 | |
450 | |
451 int | |
452 check_status (char *name, gftp_window_data *wdata, int check_other_stop, | |
453 int only_one, int at_least_one, int func) | |
454 { | |
455 gftp_window_data * owdata; | |
456 | |
457 owdata = wdata == &window1 ? &window2 : &window1; | |
458 | |
459 if (wdata->request->stopable) | |
460 { | |
461 ftp_log (gftp_logging_misc, NULL, | |
462 _("%s: Please hit the stop button first to do anything else\n"), | |
463 name); | |
464 return (0); | |
465 } | |
466 | |
467 if (check_other_stop && owdata->request->stopable) | |
468 { | |
469 ftp_log (gftp_logging_misc, NULL, | |
470 _("%s: Please hit the stop button first to do anything else\n"), | |
471 name); | |
472 return (0); | |
473 } | |
474 | |
475 if (!GFTP_IS_CONNECTED (wdata->request)) | |
476 { | |
477 ftp_log (gftp_logging_misc, NULL, | |
478 _("%s: Not connected to a remote site\n"), name); | |
479 return (0); | |
480 } | |
481 | |
482 if (!func) | |
483 { | |
484 ftp_log (gftp_logging_misc, NULL, | |
485 _("%s: This feature is not available using this protocol\n"), | |
486 name); | |
487 return (0); | |
488 } | |
489 | |
490 if (only_one && !IS_ONE_SELECTED (wdata)) | |
491 { | |
492 ftp_log (gftp_logging_misc, NULL, | |
493 _("%s: You must only have one item selected\n"), name); | |
494 return (0); | |
495 } | |
496 | |
497 if (at_least_one && !only_one && IS_NONE_SELECTED (wdata)) | |
498 { | |
499 ftp_log (gftp_logging_misc, NULL, | |
500 _("%s: You must have at least one item selected\n"), name); | |
501 return (0); | |
502 } | |
503 return (1); | |
504 } | |
505 | |
7 | 506 static gchar * |
507 gftp_item_factory_translate (const char *path, | |
508 gpointer func_data) | |
509 { | |
510 const gchar *strip_prefix = func_data; | |
511 const char *result; | |
512 | |
513 if (strip_prefix) | |
514 { | |
515 char *tmp_path = g_strconcat (strip_prefix, path, NULL); | |
516 result = gettext (tmp_path); | |
517 if (result == tmp_path) | |
518 result = path; | |
519 g_free (tmp_path); | |
520 } | |
521 else | |
522 result = gettext (path); | |
523 | |
524 return (char *)result; | |
525 } | |
526 | |
527 GtkItemFactory * | |
528 item_factory_new (GtkType container_type, | |
529 const char *path, | |
530 GtkAccelGroup *accel_group, | |
531 const char *strip_prefix) | |
532 { | |
533 GtkItemFactory *result = gtk_item_factory_new (container_type, path, accel_group); | |
534 gchar *strip_prefix_dup = g_strdup (g_strdup (strip_prefix)); | |
535 | |
536 gtk_item_factory_set_translate_func (result, gftp_item_factory_translate, | |
537 strip_prefix_dup, NULL); | |
538 | |
539 if (strip_prefix_dup) | |
540 gtk_object_set_data_full (GTK_OBJECT (result), "gftp-strip-prefix", | |
541 strip_prefix_dup, (GDestroyNotify)g_free); | |
542 | |
543 return result; | |
544 } | |
1 | 545 |
546 void | |
547 create_item_factory (GtkItemFactory * ifactory, guint n_entries, | |
548 GtkItemFactoryEntry * entries, gpointer callback_data) | |
549 { | |
550 int i; | |
7 | 551 const char *strip_prefix = gtk_object_get_data (GTK_OBJECT (ifactory), "gftp-strip-prefix"); |
552 int strip_prefix_len = 0; | |
553 | |
554 if (strip_prefix) | |
555 strip_prefix_len = strlen (strip_prefix); | |
1 | 556 |
557 for (i = 0; i < n_entries; i++) | |
558 { | |
7 | 559 GtkItemFactoryEntry dummy_item = entries[i]; |
560 if (strip_prefix && strncmp (entries[i].path, strip_prefix, strip_prefix_len) == 0) | |
561 dummy_item.path += strip_prefix_len; | |
562 | |
1 | 563 gtk_item_factory_create_item (ifactory, &dummy_item, callback_data, 1); |
564 } | |
565 } | |
566 | |
567 GList * | |
568 get_next_selection (GList * selection, GList ** list, int *curnum) | |
569 { | |
570 gftp_file * tempfle; | |
571 int i, newpos; | |
572 | |
573 newpos = (int) selection->data; | |
574 i = *curnum - newpos; | |
575 | |
576 if (i < 0) | |
577 { | |
578 while (i != 0) | |
579 { | |
580 tempfle = (*list)->data; | |
581 if (tempfle->shown) | |
582 { | |
583 ++*curnum; | |
584 i++; | |
585 } | |
586 *list = (*list)->next; | |
587 } | |
588 } | |
589 else if (i > 0) | |
590 { | |
591 while (i != 0) | |
592 { | |
593 tempfle = (*list)->data; | |
594 if (tempfle->shown) | |
595 { | |
596 --*curnum; | |
597 i--; | |
598 } | |
599 *list = (*list)->prev; | |
600 } | |
601 } | |
602 | |
603 tempfle = (*list)->data; | |
604 while ((*list)->next && !tempfle->shown) | |
605 { | |
606 *list = (*list)->next; | |
607 tempfle = (*list)->data; | |
608 } | |
609 return (selection->next); | |
610 } | |
611 | |
612 | |
613 void | |
614 add_history (GtkWidget * widget, GList ** history, unsigned int *histlen, | |
615 const char *str) | |
616 { | |
617 GList *node, *delnode; | |
618 char *tempstr; | |
619 int i; | |
620 | |
621 if (str == NULL || *str == '\0') | |
622 return; | |
623 | |
624 for (node = *history; node != NULL; node = node->next) | |
625 { | |
626 if (strcmp ((char *) node->data, str) == 0) | |
627 break; | |
628 } | |
629 | |
630 if (node == NULL) | |
631 { | |
632 if (*histlen >= MAX_HIST_LEN) | |
633 { | |
634 node = *history; | |
635 for (i = 1; i < MAX_HIST_LEN; i++) | |
636 node = node->next; | |
637 node->prev->next = NULL; | |
638 node->prev = NULL; | |
639 delnode = node; | |
640 while (delnode != NULL) | |
641 { | |
642 if (delnode->data) | |
643 g_free (delnode->data); | |
644 delnode = delnode->next; | |
645 } | |
646 g_list_free (node); | |
647 } | |
648 tempstr = g_malloc (strlen (str) + 1); | |
649 strcpy (tempstr, str); | |
650 *history = g_list_prepend (*history, tempstr); | |
651 ++*histlen; | |
652 } | |
653 else if (node->prev != NULL) | |
654 { | |
655 node->prev->next = node->next; | |
656 if (node->next != NULL) | |
657 node->next->prev = node->prev; | |
658 node->prev = NULL; | |
659 node->next = *history; | |
660 if (node->next != NULL) | |
661 node->next->prev = node; | |
662 *history = node; | |
663 } | |
664 gtk_combo_set_popdown_strings (GTK_COMBO (widget), *history); | |
665 } | |
666 | |
667 | |
668 int | |
669 check_reconnect (gftp_window_data *wdata) | |
670 { | |
671 return (wdata->request->cached && wdata->request->sockfd == NULL && | |
672 !ftp_connect (wdata, wdata->request, 0) ? -1 : 0); | |
673 } | |
674 | |
675 | |
676 void | |
677 add_file_listbox (gftp_window_data * wdata, gftp_file * fle) | |
678 { | |
679 char *add_data[7] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL }, *pos; | |
680 gftp_file_extensions * tempext; | |
681 char *tempstr, *str; | |
682 GdkBitmap * bitmap; | |
683 GList * templist; | |
684 GdkPixmap * pix; | |
685 int clist_num; | |
686 size_t stlen; | |
687 | |
688 if (wdata->show_selected) | |
689 { | |
690 fle->shown = fle->was_sel; | |
691 if (!fle->shown) | |
692 return; | |
693 } | |
694 else if ((!show_hidden_files && *fle->file == '.' && | |
695 strcmp (fle->file, "..") != 0) || | |
696 !gftp_match_filespec (fle->file, wdata->filespec)) | |
697 { | |
698 fle->shown = 0; | |
699 fle->was_sel = 0; | |
700 return; | |
701 } | |
702 else | |
703 fle->shown = 1; | |
704 | |
705 clist_num = gtk_clist_append (GTK_CLIST (wdata->listbox), add_data); | |
706 | |
707 if (fle->was_sel) | |
708 { | |
709 fle->was_sel = 0; | |
710 gtk_clist_select_row (GTK_CLIST (wdata->listbox), clist_num, 0); | |
711 } | |
712 | |
713 pix = NULL; | |
714 bitmap = NULL; | |
715 if (strcmp (fle->file, "..") == 0) | |
716 gftp_get_pixmap (wdata->listbox, "dotdot.xpm", &pix, &bitmap); | |
717 else if (fle->islink && fle->isdir) | |
718 gftp_get_pixmap (wdata->listbox, "linkdir.xpm", &pix, &bitmap); | |
719 else if (fle->islink) | |
720 gftp_get_pixmap (wdata->listbox, "linkfile.xpm", &pix, &bitmap); | |
721 else if (fle->isdir) | |
722 gftp_get_pixmap (wdata->listbox, "dir.xpm", &pix, &bitmap); | |
723 else if (fle->isexe) | |
724 gftp_get_pixmap (wdata->listbox, "exe.xpm", &pix, &bitmap); | |
725 else | |
726 { | |
727 stlen = strlen (fle->file); | |
728 templist = registered_exts; | |
729 while (templist != NULL) | |
730 { | |
731 tempext = templist->data; | |
732 if (stlen >= tempext->stlen && | |
733 strcmp (&fle->file[stlen - tempext->stlen], tempext->ext) == 0) | |
734 { | |
735 if (toupper (*tempext->ascii_binary) == 'A') | |
736 fle->ascii = 1; | |
737 | |
738 gftp_get_pixmap (wdata->listbox, tempext->filename, &pix, | |
739 &bitmap); | |
740 break; | |
741 } | |
742 templist = templist->next; | |
743 } | |
744 } | |
745 | |
746 if (pix == NULL && bitmap == NULL) | |
747 gftp_get_pixmap (wdata->listbox, "doc.xpm", &pix, &bitmap); | |
748 | |
749 gtk_clist_set_pixmap (GTK_CLIST (wdata->listbox), clist_num, 0, pix, bitmap); | |
750 | |
751 if (fle->file) | |
752 gtk_clist_set_text (GTK_CLIST (wdata->listbox), clist_num, 1, fle->file); | |
753 | |
754 if (fle->attribs && (*fle->attribs == 'b' || *fle->attribs == 'c')) | |
755 tempstr = g_strdup_printf ("%d, %d", (int) fle->size >> 16, | |
756 (int) fle->size & 0xFF); | |
757 else | |
758 tempstr = insert_commas (fle->size, NULL, 0); | |
759 | |
760 gtk_clist_set_text (GTK_CLIST (wdata->listbox), clist_num, 2, tempstr); | |
761 g_free (tempstr); | |
762 | |
763 if (fle->user) | |
764 gtk_clist_set_text (GTK_CLIST (wdata->listbox), clist_num, 3, fle->user); | |
765 if (fle->group) | |
766 gtk_clist_set_text (GTK_CLIST (wdata->listbox), clist_num, 4, fle->group); | |
767 if ((str = ctime (&fle->datetime))) | |
768 { | |
769 if ((pos = strchr (str, '\n')) != NULL) | |
770 *pos = '\0'; | |
771 gtk_clist_set_text (GTK_CLIST (wdata->listbox), clist_num, 5, str); | |
772 } | |
773 if (fle->attribs) | |
774 gtk_clist_set_text (GTK_CLIST (wdata->listbox), clist_num, 6, fle->attribs); | |
775 | |
776 } | |
777 | |
778 | |
779 void | |
780 MakeEditDialog (char *diagtxt, char *infotxt, char *deftext, int edit_shown, | |
781 int erase, char *checktext, | |
782 char *oktxt, void (*okfunc) (), void *okptr, | |
783 char *canceltxt, void (*cancelfunc) (), void *cancelptr) | |
784 { | |
785 gftp_dialog_data * d, * cancel_d; | |
786 GtkWidget * tempwid; | |
787 | |
788 d = g_malloc0 (sizeof (*d)); | |
789 cancel_d = g_malloc0 (sizeof (*cancel_d)); | |
790 cancel_d->data = cancelptr; | |
791 d->data = okptr; | |
792 cancel_d->all_buttons = d->all_buttons = NULL; | |
793 d->dialog = cancel_d->dialog = gtk_dialog_new (); | |
794 gtk_grab_add (d->dialog); | |
795 gtk_window_set_title (GTK_WINDOW (d->dialog), diagtxt); | |
796 gtk_window_set_wmclass (GTK_WINDOW(d->dialog), "edit", "gFTP"); | |
797 gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (d->dialog)->vbox), 10); | |
798 gtk_container_border_width (GTK_CONTAINER | |
799 (GTK_DIALOG (d->dialog)->action_area), 5); | |
800 gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (d->dialog)->vbox), 5); | |
801 gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (d->dialog)->action_area), 15); | |
802 gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (d->dialog)->action_area), TRUE); | |
803 gtk_window_set_position (GTK_WINDOW (d->dialog), GTK_WIN_POS_MOUSE); | |
804 | |
805 if (cancelfunc) | |
806 gtk_signal_connect (GTK_OBJECT (d->dialog), "delete_event", | |
807 GTK_SIGNAL_FUNC (cancelfunc), (gpointer) cancel_d); | |
808 | |
809 gtk_signal_connect_object (GTK_OBJECT (d->dialog), "delete_event", | |
810 GTK_SIGNAL_FUNC (destroy_dialog_data), | |
811 (gpointer) cancel_d); | |
812 tempwid = gtk_label_new (infotxt); | |
813 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (d->dialog)->vbox), tempwid, TRUE, | |
814 TRUE, 0); | |
815 gtk_widget_show (tempwid); | |
816 | |
817 d->edit = cancel_d->edit = gtk_entry_new (); | |
818 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (d->dialog)->vbox), d->edit, TRUE, | |
819 TRUE, 0); | |
820 if (okfunc) | |
821 gtk_signal_connect (GTK_OBJECT (d->edit), "activate", | |
822 GTK_SIGNAL_FUNC (okfunc), (gpointer) d); | |
823 if (erase || !okfunc) | |
824 gtk_signal_connect_object (GTK_OBJECT (d->edit), "activate", | |
825 GTK_SIGNAL_FUNC (gtk_widget_destroy), | |
826 (gpointer) d->dialog); | |
827 | |
828 gtk_widget_grab_focus (d->edit); | |
829 gtk_entry_set_visibility (GTK_ENTRY (d->edit), edit_shown); | |
830 if (deftext != NULL) | |
831 { | |
832 gtk_entry_set_text (GTK_ENTRY (d->edit), deftext); | |
833 gtk_entry_select_region (GTK_ENTRY (d->edit), 0, strlen (deftext)); | |
834 } | |
835 gtk_widget_show (d->edit); | |
836 | |
837 if (checktext) | |
838 { | |
839 d->checkbox = cancel_d->checkbox = | |
840 gtk_check_button_new_with_label (checktext); | |
841 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (d->dialog)->vbox), d->checkbox, | |
842 TRUE, TRUE, 0); | |
843 gtk_widget_show (d->checkbox); | |
844 } | |
845 | |
846 tempwid = gtk_button_new_with_label (oktxt); | |
847 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT); | |
848 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (d->dialog)->action_area), tempwid, | |
849 TRUE, TRUE, 0); | |
850 if (okfunc) | |
851 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked", | |
852 GTK_SIGNAL_FUNC (okfunc), (gpointer) d); | |
853 if (erase || !okfunc) | |
854 gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked", | |
855 GTK_SIGNAL_FUNC (gtk_widget_destroy), | |
856 (gpointer) d->dialog); | |
857 gtk_widget_grab_default (tempwid); | |
858 gtk_widget_show (tempwid); | |
859 | |
860 tempwid = gtk_button_new_with_label (canceltxt); | |
861 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT); | |
862 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (d->dialog)->action_area), tempwid, | |
863 TRUE, TRUE, 0); | |
864 if (cancelfunc) | |
865 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked", | |
866 GTK_SIGNAL_FUNC (cancelfunc), (gpointer) cancel_d); | |
867 if (erase || !cancelfunc) | |
868 gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked", | |
869 GTK_SIGNAL_FUNC (gtk_widget_destroy), | |
870 (gpointer) d->dialog); | |
871 gtk_widget_show (tempwid); | |
872 | |
873 d->all_buttons = g_list_append (d->all_buttons, d); | |
874 d->all_buttons = g_list_append (d->all_buttons, cancel_d); | |
875 cancel_d->all_buttons = d->all_buttons; | |
876 gtk_widget_show (d->dialog); | |
877 } | |
878 | |
879 | |
880 void | |
881 MakeYesNoDialog (char *diagtxt, char *infotxt, int erase, int num, ...) | |
882 { | |
883 GtkWidget * text, * tempwid, * dialog; | |
884 typedef void (*func) (); | |
885 gftp_dialog_data * d; | |
886 char *tempstr; | |
887 va_list argp; | |
888 func myfunc; | |
889 GList * list; | |
890 void *ptr; | |
891 int i; | |
892 | |
893 dialog = gtk_dialog_new (); | |
894 gtk_grab_add (dialog); | |
895 gtk_window_set_title (GTK_WINDOW (dialog), diagtxt); | |
896 gtk_window_set_wmclass (GTK_WINDOW(dialog), "yndiag", "gFTP"); | |
897 gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 10); | |
898 gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), | |
899 5); | |
900 gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 5); | |
901 gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area), 15); | |
902 gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->action_area), TRUE); | |
903 gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE); | |
904 | |
905 text = gtk_label_new (infotxt); | |
906 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), text, TRUE, TRUE, 0); | |
907 gtk_widget_show (text); | |
908 | |
909 list = NULL; | |
910 ptr = g_malloc0 (sizeof (gftp_dialog_data)); | |
911 list = g_list_append (list, ptr); | |
912 va_start (argp, num); | |
913 for (i = 0; i < num; i++) | |
914 { | |
915 tempstr = va_arg (argp, char *); | |
916 myfunc = va_arg (argp, func); | |
917 ptr = va_arg (argp, void *); | |
918 d = g_malloc (sizeof (gftp_dialog_data)); | |
919 list = g_list_append (list, d); | |
920 d->dialog = dialog; | |
921 d->data = ptr; | |
922 d->all_buttons = list; | |
923 | |
924 tempwid = gtk_button_new_with_label (tempstr); | |
925 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid, | |
926 TRUE, TRUE, 0); | |
927 if (myfunc) | |
928 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked", | |
929 GTK_SIGNAL_FUNC (myfunc), (gpointer) d); | |
930 if (erase || !myfunc) | |
931 gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked", | |
932 GTK_SIGNAL_FUNC (gtk_widget_destroy), | |
933 (gpointer) d->dialog); | |
934 gtk_widget_show (tempwid); | |
935 } | |
936 | |
937 gtk_widget_show (dialog); | |
938 } | |
939 | |
940 | |
941 static void | |
942 destroy_dialog_data (gftp_dialog_data * data) | |
943 { | |
944 GList * list; | |
945 | |
946 list = data->all_buttons; | |
947 while (list != NULL) | |
948 { | |
949 if (list->data != data && list->data) | |
950 g_free (list->data); | |
951 list = list->next; | |
952 } | |
953 g_list_free (data->all_buttons); | |
954 g_free (data); | |
955 } | |
956 | |
957 | |
958 void | |
959 update_directory_download_progress (gftp_transfer * transfer) | |
960 { | |
961 static GtkWidget * dialog = NULL, * textwid, * stopwid; | |
962 char tempstr[255]; | |
963 GtkWidget * vbox; | |
964 | |
965 if (transfer->numfiles < 0 || transfer->numdirs < 0) | |
966 { | |
967 if (dialog != NULL) | |
968 gtk_widget_destroy (dialog); | |
969 dialog = NULL; | |
970 return; | |
971 } | |
972 | |
973 if (dialog == NULL) | |
974 { | |
975 dialog = gtk_window_new (GTK_WINDOW_POPUP); | |
976 gtk_grab_add (dialog); | |
977 gtk_signal_connect (GTK_OBJECT (dialog), "delete_event", | |
978 GTK_SIGNAL_FUNC (delete_event), NULL); | |
979 gtk_window_set_title (GTK_WINDOW (dialog), | |
980 _("Getting directory listings")); | |
981 gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE); | |
982 gtk_window_set_wmclass (GTK_WINDOW(dialog), "dirlist", "gFTP"); | |
983 | |
984 vbox = gtk_vbox_new (FALSE, 5); | |
985 gtk_container_border_width (GTK_CONTAINER (vbox), 10); | |
986 gtk_container_add (GTK_CONTAINER (dialog), vbox); | |
987 gtk_widget_show (vbox); | |
988 | |
989 textwid = gtk_label_new (NULL); | |
990 gtk_box_pack_start (GTK_BOX (vbox), textwid, TRUE, TRUE, 0); | |
991 gtk_widget_show (textwid); | |
992 | |
993 statuswid = gtk_progress_bar_new (); | |
994 gtk_progress_set_activity_mode (GTK_PROGRESS (statuswid), 1); | |
995 gtk_progress_bar_set_activity_step (GTK_PROGRESS_BAR (statuswid), 3); | |
996 gtk_progress_bar_set_activity_blocks (GTK_PROGRESS_BAR (statuswid), 5); | |
997 gtk_box_pack_start (GTK_BOX (vbox), statuswid, TRUE, TRUE, 0); | |
998 gtk_widget_show (statuswid); | |
999 | |
1000 stopwid = gtk_button_new_with_label (_(" Stop ")); | |
1001 gtk_signal_connect (GTK_OBJECT (stopwid), "clicked", | |
1002 GTK_SIGNAL_FUNC (trans_stop_button), transfer); | |
1003 gtk_box_pack_start (GTK_BOX (vbox), stopwid, TRUE, TRUE, 0); | |
1004 gtk_widget_show (stopwid); | |
1005 | |
1006 gtk_widget_show (dialog); | |
1007 } | |
1008 | |
1009 g_snprintf (tempstr, sizeof (tempstr), | |
1010 _("Received %ld directories\nand %ld files"), | |
1011 transfer->numdirs, transfer->numfiles); | |
1012 gtk_label_set_text (GTK_LABEL (textwid), tempstr); | |
1013 } | |
1014 | |
1015 | |
1016 void * | |
1017 generic_thread (void * (*func) (void *), gftp_window_data * wdata) | |
1018 { | |
1019 void * ret; | |
1020 | |
1021 if (wdata->request->use_threads) | |
1022 { | |
1023 wdata->request->stopable = 1; | |
1024 gtk_widget_set_sensitive (stop_btn, 1); | |
1025 pthread_create (&wdata->tid, NULL, func, wdata); | |
1026 | |
1027 while (wdata->request->stopable) | |
1028 g_main_iteration (TRUE); | |
1029 | |
1030 pthread_join (wdata->tid, &ret); | |
1031 gtk_widget_set_sensitive (stop_btn, 0); | |
1032 } | |
1033 else | |
1034 ret = func (wdata); | |
1035 | |
1036 if (!GFTP_IS_CONNECTED (wdata->request)) | |
1037 disconnect (wdata); | |
1038 | |
1039 return (ret); | |
1040 } | |
1041 | |
1042 | |
1043 int | |
1044 progress_timeout (gpointer data) | |
1045 { | |
1046 gftp_transfer * tdata; | |
1047 double val; | |
1048 | |
1049 tdata = data; | |
1050 | |
1051 update_directory_download_progress (tdata); | |
1052 | |
1053 val = gtk_progress_get_value (GTK_PROGRESS (statuswid)); | |
1054 if (val >= 1.0) | |
1055 val = 0; | |
1056 else | |
1057 val += 0.10; | |
1058 gtk_progress_bar_update (GTK_PROGRESS_BAR (statuswid), val); | |
1059 | |
1060 return (1); | |
1061 } | |
1062 | |
1063 | |
1064 static gint | |
1065 delete_event (GtkWidget * widget, GdkEvent * event, gpointer data) | |
1066 { | |
1067 return (TRUE); | |
1068 } | |
1069 | |
1070 | |
1071 static void | |
1072 trans_stop_button (GtkWidget * widget, gpointer data) | |
1073 { | |
1074 gftp_transfer * transfer; | |
1075 | |
1076 transfer = data; | |
1077 pthread_kill (((gftp_window_data *) transfer->fromwdata)->tid, SIGINT); | |
1078 } | |
1079 | |
1080 void | |
1081 display_cached_logs (void) | |
1082 { | |
1083 gftp_log * templog; | |
1084 GList * templist; | |
1085 | |
1086 pthread_mutex_lock (&log_mutex); | |
1087 templist = file_transfer_logs; | |
1088 while (templist != NULL) | |
1089 { | |
1090 templog = (gftp_log *) templist->data; | |
1091 ftp_log (templog->type, (void *) 0x2, "%s", templog->msg); | |
1092 g_free (templog->msg); | |
1093 g_free (templog); | |
1094 templist->data = NULL; | |
1095 templist = templist->next; | |
1096 } | |
1097 g_list_free (file_transfer_logs); | |
1098 file_transfer_logs = NULL; | |
1099 pthread_mutex_unlock (&log_mutex); | |
1100 } | |
1101 | |
1102 #if !defined (HAVE_GETADDRINFO) || !defined (HAVE_GAI_STRERROR) | |
1103 | |
1104 static pthread_mutex_t netfunclock = PTHREAD_MUTEX_INITIALIZER; | |
1105 | |
1106 struct hostent * | |
1107 r_gethostbyname (const char *name, struct hostent *result_buf, int *h_errnop) | |
1108 { | |
1109 struct hostent *hent; | |
1110 | |
1111 pthread_mutex_lock (&netfunclock); | |
1112 if ((hent = gethostbyname (name)) == NULL) | |
1113 { | |
1114 if (h_errnop) | |
1115 *h_errnop = h_errno; | |
1116 } | |
1117 else | |
1118 { | |
1119 *result_buf = *hent; | |
1120 hent = result_buf; | |
1121 } | |
1122 pthread_mutex_unlock (&netfunclock); | |
1123 return (hent); | |
1124 } | |
1125 | |
1126 | |
1127 struct servent * | |
1128 r_getservbyname (const char *name, const char *proto, | |
1129 struct servent *result_buf, int *h_errnop) | |
1130 { | |
1131 struct servent *sent; | |
1132 | |
1133 pthread_mutex_lock (&netfunclock); | |
1134 if ((sent = getservbyname (name, proto)) == NULL) | |
1135 { | |
1136 if (h_errnop) | |
1137 *h_errnop = h_errno; | |
1138 } | |
1139 else | |
1140 { | |
1141 *result_buf = *sent; | |
1142 sent = result_buf; | |
1143 } | |
1144 pthread_mutex_unlock (&netfunclock); | |
1145 return (sent); | |
1146 } | |
1147 | |
1148 #endif /* !HAVE_GETADDRINFO */ | |
1149 |