Mercurial > gftp.yaz
comparison src/gtk/view_dialog.c @ 58:c01d91c10f6c
2002-11-20 Brian Masney <masneyb@gftp.org>
* lib/protocols.c lib/gftp.h - added gftp_get_line(), gftp_read(),
gftp_write(), gftp_writefmt(), and gftp_set_sockblocking() functions.
Added struct_gftp_getline_buffer for gftp_get_line function()
* lib/cache.c lib/gftp.h lib/local.c lib/misc.c lib/protocols.c
lib/rfc2068.c lib/rfc959.c lib/ssh.c lib/sshv2.c - *_get_file() returns
off_t instead of long. *_{get,put}_next_file_chunk returns ssize_t
instead of size_t. Added *_set_config_options function to gftp_request
structure and protocol files. Use the new network functions
documented above. Convert usage of ANSI C IO (FILE *) to standard BSD
sockets so that I can use timeouts properly with select
* lib/misc.c (ssh_start_login_sequence) - use gftp_set_sockblock(),
gftp_read() and gftp_write() functions
* lib/protocols.c - move some protocol specific code to the protocol
specific files
* lib/local.c - log succesful messages to gftp_logging_misc instead
of gftp_logging_error
* lib/cache.c - log some more error conditions to the user
* lib/rfc959.c - added rfc959_getcwd(). In,
rfc959_accept_active_connection(), set set socket to blocking mode
before calling accept()
* src/text/gftk-text.c - If we get no files in gftp_text_ls(),
return instead of segfaulting
* src/gtk/gftp-gtk.c - expand the port field in the toolbar to be 45
pixels wide
* src/text/gftp-text.c src/gtk/misc-gtk.c src/gtk/transfer.c
src/gtk/view_dialog.c - changes for conversion of request->{sock,data}
from ANSI C IO (FILE *) to standard BSD sockets
author | masneyb |
---|---|
date | Thu, 21 Nov 2002 00:33:51 +0000 |
parents | e5f6054590b5 |
children | fe0b21c006f6 |
comparison
equal
deleted
inserted
replaced
57:72f6ca02c83a | 58:c01d91c10f6c |
---|---|
26 view_dialog (gpointer data) | 26 view_dialog (gpointer data) |
27 { | 27 { |
28 GList * templist, * filelist, * newfile; | 28 GList * templist, * filelist, * newfile; |
29 gftp_window_data * fromwdata, * towdata; | 29 gftp_window_data * fromwdata, * towdata; |
30 gftp_file * new_fle; | 30 gftp_file * new_fle; |
31 int num, fd; | 31 int num; |
32 | 32 |
33 fromwdata = data; | 33 fromwdata = data; |
34 towdata = fromwdata == &window1 ? &window2 : &window1; | 34 towdata = fromwdata == &window1 ? &window2 : &window1; |
35 if (!check_status (_("View"), fromwdata, 0, 1, 1, 1)) | 35 if (!check_status (_("View"), fromwdata, 0, 1, 1, 1)) |
36 return; | 36 return; |
54 { | 54 { |
55 new_fle = copy_fdata (curfle); | 55 new_fle = copy_fdata (curfle); |
56 if (new_fle->destfile) | 56 if (new_fle->destfile) |
57 g_free (new_fle->destfile); | 57 g_free (new_fle->destfile); |
58 new_fle->destfile = g_strconcat (g_get_tmp_dir (), "/gftp-view.XXXXXX", NULL); | 58 new_fle->destfile = g_strconcat (g_get_tmp_dir (), "/gftp-view.XXXXXX", NULL); |
59 if ((fd = mkstemp (new_fle->destfile)) < 0) | 59 if ((new_fle->fd = mkstemp (new_fle->destfile)) < 0) |
60 { | 60 { |
61 ftp_log (gftp_logging_misc, NULL, | 61 ftp_log (gftp_logging_misc, NULL, |
62 _("Error: Cannot open %s for writing: %s\n"), | 62 _("Error: Cannot open %s for writing: %s\n"), |
63 new_fle->destfile, g_strerror (errno)); | 63 new_fle->destfile, g_strerror (errno)); |
64 free_fdata (new_fle); | 64 free_fdata (new_fle); |
65 return; | 65 return; |
66 } | 66 } |
67 | 67 |
68 chmod (new_fle->destfile, S_IRUSR | S_IWUSR); | 68 fchmod (new_fle->fd, S_IRUSR | S_IWUSR); |
69 if ((new_fle->fd = fdopen (fd, "rw+")) == NULL) | |
70 { | |
71 ftp_log (gftp_logging_error, NULL, | |
72 _("Cannot fdopen() socket: %s\n"), | |
73 g_strerror (errno)); | |
74 return; | |
75 } | |
76 | 69 |
77 new_fle->is_fd = 1; | 70 new_fle->is_fd = 1; |
78 new_fle->done_view = 1; | 71 new_fle->done_view = 1; |
79 new_fle->done_rm = 1; | 72 new_fle->done_rm = 1; |
80 newfile = g_list_append (NULL, new_fle); | 73 newfile = g_list_append (NULL, new_fle); |
88 edit_dialog (gpointer data) | 81 edit_dialog (gpointer data) |
89 { | 82 { |
90 gftp_window_data * fromwdata, * towdata; | 83 gftp_window_data * fromwdata, * towdata; |
91 GList * templist, * filelist, * newfile; | 84 GList * templist, * filelist, * newfile; |
92 gftp_file * new_fle; | 85 gftp_file * new_fle; |
93 int num, fd; | 86 int num; |
94 | 87 |
95 fromwdata = data; | 88 fromwdata = data; |
96 towdata = fromwdata == &window1 ? &window2 : &window1; | 89 towdata = fromwdata == &window1 ? &window2 : &window1; |
97 if (!check_status (_("Edit"), fromwdata, 0, 1, 1, 1)) | 90 if (!check_status (_("Edit"), fromwdata, 0, 1, 1, 1)) |
98 return; | 91 return; |
124 new_fle = copy_fdata (curfle); | 117 new_fle = copy_fdata (curfle); |
125 if (new_fle->destfile) | 118 if (new_fle->destfile) |
126 g_free (new_fle->destfile); | 119 g_free (new_fle->destfile); |
127 new_fle->destfile = g_strconcat (g_get_tmp_dir (), "/gftp-view.XXXXXX", | 120 new_fle->destfile = g_strconcat (g_get_tmp_dir (), "/gftp-view.XXXXXX", |
128 NULL); | 121 NULL); |
129 if ((fd = mkstemp (new_fle->destfile)) < 0) | 122 if ((new_fle->fd = mkstemp (new_fle->destfile)) < 0) |
130 { | 123 { |
131 ftp_log (gftp_logging_misc, NULL, | 124 ftp_log (gftp_logging_misc, NULL, |
132 _("Error: Cannot open %s for writing: %s\n"), | 125 _("Error: Cannot open %s for writing: %s\n"), |
133 new_fle->destfile, g_strerror (errno)); | 126 new_fle->destfile, g_strerror (errno)); |
134 free_fdata (new_fle); | 127 free_fdata (new_fle); |
135 return; | 128 return; |
136 } | 129 } |
137 | 130 |
138 chmod (new_fle->destfile, S_IRUSR | S_IWUSR); | 131 fchmod (new_fle->fd, S_IRUSR | S_IWUSR); |
139 if ((new_fle->fd = fdopen (fd, "rw+")) == NULL) | |
140 { | |
141 ftp_log (gftp_logging_error, NULL, | |
142 _("Cannot fdopen() socket: %s\n"), | |
143 g_strerror (errno)); | |
144 return; | |
145 } | |
146 | 132 |
147 new_fle->is_fd = 1; | 133 new_fle->is_fd = 1; |
148 new_fle->done_edit = 1; | 134 new_fle->done_edit = 1; |
149 newfile = g_list_append (NULL, new_fle); | 135 newfile = g_list_append (NULL, new_fle); |
150 add_file_transfer (fromwdata->request, towdata->request, | 136 add_file_transfer (fromwdata->request, towdata->request, |