Mon Mar 2 12:11:37 1998 Norbert Warmuth <k3190@fh-sw.de>

* vfs/ftpfs.c (changetype): Removed the hack which always forced
	sending the command "TYPE I" when changing to binary transfer mode
	was requested even when MC thought the connection was already in
	binary mode (bucket->isbinary == 1). The correct fix is now in
	login_server.

	* vfs/ftpfs.c (login_server): Set the transfer mode stored in
	the bucket to UNKNOWN (the bucket might be reused and the old
	transfer mode isn't valid any longer).

	* screen.c (panel_key): Cleanup: deleted if-clause with -1 (EV_NONE)
	which isn't delivered to widgets by the dialog manager; always
	return 1 when key was handled; removed the function keys from the
	panel's keymap (the function keys are always handled by the
	buttonbar); don't eat characters below ' ' (C-l and Shift-F3 now
	work even when quick search was started); characters between 32 and
	255 start quick search if there is no commandline (no C-s necessary
	to start search).

	* tree.c (tree_key): likewise
This commit is contained in:
Miguel de Icaza 1998-03-02 18:09:16 +00:00
parent 4ab0e653f8
commit 51e39b09b5
4 changed files with 88 additions and 55 deletions

View File

@ -1,3 +1,26 @@
Mon Mar 2 12:11:37 1998 Norbert Warmuth <k3190@fh-sw.de>
* vfs/ftpfs.c (changetype): Removed the hack which always forced
sending the command "TYPE I" when changing to binary transfer mode
was requested even when MC thought the connection was already in
binary mode (bucket->isbinary == 1). The correct fix is now in
login_server.
* vfs/ftpfs.c (login_server): Set the transfer mode stored in
the bucket to UNKNOWN (the bucket might be reused and the old
transfer mode isn't valid any longer).
* screen.c (panel_key): Cleanup: deleted if-clause with -1 (EV_NONE)
which isn't delivered to widgets by the dialog manager; always
return 1 when key was handled; removed the function keys from the
panel's keymap (the function keys are always handled by the
buttonbar); don't eat characters below ' ' (C-l and Shift-F3 now
work even when quick search was started); characters between 32 and
255 start quick search if there is no commandline (no C-s necessary
to start search).
* tree.c (tree_key): likewise
Tue Feb 24 18:37:36 1998 Stas Maximov <stmax@u213.srcc.msu.su>
* subshell.c: Set subshell_pid to 1 on startup

View File

@ -2027,21 +2027,10 @@ static key_map panel_keymap [] = {
{ XCTRL('n'), move_down }, /* C-n like emacs */
{ XCTRL('s'), start_search }, /* C-s like emacs */
{ ALT('s'), start_search }, /* M-s not like emacs */
/* The functions keys we deal with */
{ KEY_F(3), view_cmd },
{ KEY_F(13), view_simple_cmd },
{ KEY_F(4), edit_cmd },
{ KEY_F(14), edit_cmd_new },
{ KEY_F(5), copy_cmd },
{ KEY_F(6), ren_cmd },
{ KEY_F(7), mkdir_cmd },
{ KEY_F(8), delete_cmd },
{ KEY_DC, delete_cmd },
{ XCTRL('t'), mark_file },
{ ALT('o'), chdir_other_panel },
{ ALT('l'), chdir_to_readlink },
{ KEY_DC, delete_cmd},
{ 0, 0 }
};
@ -2058,8 +2047,10 @@ panel_key (WPanel *panel, int key)
return 1;
}
}
if (torben_fj_mode && key == ALT('h'))
if (torben_fj_mode && key == ALT('h')) {
goto_middle_file (panel);
return 1;
}
/* We do not want to take a key press if nothing can be done with it */
/* The command line widget may do something more usefull */
@ -2067,30 +2058,29 @@ panel_key (WPanel *panel, int key)
return move_left (panel, key);
if (key == KEY_RIGHT)
move_right (panel, key);
return move_right (panel, key);
if (is_abort_char (key)) {
panel->searching = 0;
display_mini_info (panel);
}
if (panel->searching){
do_search (panel, key);
return 1;
}
if (!command_prompt)
start_search (panel);
if (key == -1)
return 0;
if (panel_keymap [i].key_code == 0){
/* Do not eat characters not meant for the panel below ' ' (e.g. C-l). */
if ((key >= ' '&& key <= 255) || key == 8 || key == KEY_BACKSPACE) {
if (panel->searching){
panel->searching = 0;
display_mini_info (panel);
do_search (panel, key);
return 1;
}
if (!command_prompt) {
start_search (panel);
do_search (panel, key);
return 1;
}
return 0;
}
return 1;
return 0;
}
int

View File

@ -59,6 +59,7 @@
#include "key.h" /* For mi_getch() */
#include "tree.h"
#include "cmd.h"
#include "command.h"
#include "../vfs/vfs.h"
extern int command_prompt;
@ -1365,6 +1366,7 @@ static key_map tree_keymap [] = {
{ XCTRL('s'), start_search },
{ ALT('s'), start_search },
{ XCTRL('r'), tree_rescan_cmd },
{ KEY_DC, tree_rmdir_cmd },
{ 0, 0 }
};
@ -1378,37 +1380,45 @@ static inline int tree_key (WTree *tree, int key)
tree->searching = 0;
(*tree_keymap [i].fn)(tree);
show_tree (tree);
break;
return 1;
}
}
/* We do not want to use them if we do not need to */
/* Input line may want to take the motion key event */
if (key == KEY_LEFT)
return move_left (tree);
if (key == KEY_RIGHT)
move_right (tree);
return move_right (tree);
if (is_abort_char (key)) {
tree->searching = 0;
if (tree->is_panel) {
tree->searching = 0;
show_tree (tree);
return 1; /* eat abort char */
}
return 0; /* modal tree dialog: let upper layer see the
abort character and close the dialog */
}
if (tree->searching){
tree_do_search (tree, key);
return 1;
}
if (!command_prompt)
start_search (tree);
/* Do not eat characters not meant for the tree below ' ' (e.g. C-l). */
if ((key >= ' '&& key <= 255) || key == 8 || key == KEY_BACKSPACE) {
if (tree->searching){
tree_do_search (tree, key);
show_tree (tree);
return 1;
}
if (key == -1)
return 0;
if (tree_keymap [i].key_code == 0){
if (tree->search_buffer [0])
tree->search_buffer [0] = 0;
show_tree (tree);
if (!command_prompt) {
start_search (tree);
tree_do_search (tree, key);
return 1;
}
return tree->is_panel;
}
return (key > ' ') ? tree->is_panel : 0;
return 0;
}
static void tree_frame (Dlg_head *h, WTree *tree)

View File

@ -386,10 +386,19 @@ ftpfs_connection_destructor(void *data)
ftpfs_free_bucket (data);
}
/* some defines only used by changetype */
/* These two are valid values for the second parameter */
#define TYPE_ASCII 0
#define TYPE_BINARY 1
/* This one is only used to initialize bucket->isbinary, don't use it as
second parameter to changetype. */
#define TYPE_UNKNOWN -1
static int
changetype (struct ftpfs_connection *bucket, int binary)
{
if (binary || binary != bucket->isbinary) {
if (binary != bucket->isbinary) {
if (command (bucket, WAIT_REPLY, "TYPE %c", binary ? 'I' : 'A') != COMPLETE) {
ftpfserrno = EIO;
return -1;
@ -417,7 +426,8 @@ login_server (struct ftpfs_connection *bucket, char *netrcpass)
char *op;
char *name; /* login user name */
int anon = 0;
bucket->isbinary = TYPE_UNKNOWN;
if (netrcpass)
op = strdup (netrcpass);
else {
@ -824,7 +834,7 @@ open_command_connection (char *host, char *user, int port, char *netrcpass)
bucket->password = 0;
bucket->use_passive_connection = ftpfs_use_passive_connections | source_route;
bucket->use_source_route = source_route;
bucket->isbinary = -1;
bucket->isbinary = TYPE_UNKNOWN;
/* We do not want to use the passive if we are using proxies */
if (bucket->use_proxy)
@ -1243,11 +1253,11 @@ resolve_symlink(struct ftpfs_connection *bucket, struct ftpfs_dir *dir)
print_vfs_message("ftpfs: CWD failed.");
return;
}
sock = open_data_connection (bucket, "LIST -lLa", ".", 0);
sock = open_data_connection (bucket, "LIST -lLa", ".", TYPE_ASCII);
}
else
sock = open_data_connection (bucket, "LIST -lLa",
dir->remote_path, 0);
dir->remote_path, TYPE_ASCII);
if (sock == -1) {
print_vfs_message("ftpfs: couldn't resolve symlink");
@ -1396,11 +1406,11 @@ retrieve_dir(struct ftpfs_connection *bucket, char *remote_path)
dcache->count = 1;
if (has_spaces)
sock = open_data_connection (bucket, "LIST -la", ".", 0);
sock = open_data_connection (bucket, "LIST -la", ".", TYPE_ASCII);
else {
char *path = copy_strings (remote_path, PATH_SEP_STR, ".", (char *) 0);
sock = open_data_connection (bucket, "LIST -la", path, 0);
sock = open_data_connection (bucket, "LIST -la", path, TYPE_ASCII);
free (path);
}
@ -1529,7 +1539,7 @@ store_file(struct ftpentry *fe)
return 0;
}
fstat(local_handle, &s);
sock = open_data_connection(fe->bucket, "STOR", fe->remote_filename, 1);
sock = open_data_connection(fe->bucket, "STOR", fe->remote_filename, TYPE_BINARY);
if (sock < 0) {
close(local_handle);
return 0;
@ -1606,7 +1616,7 @@ int retrieve_file_start(struct ftpentry *fe)
ftpfserrno = ENOMEM;
return 0;
}
remotesock = open_data_connection(fe->bucket, "RETR", fe->remote_filename, 1);
remotesock = open_data_connection(fe->bucket, "RETR", fe->remote_filename, TYPE_BINARY);
if (remotesock == -1) {
ftpfserrno = EACCES;
free (fe->local_filename);
@ -1746,7 +1756,7 @@ int retrieve_file(struct ftpentry *fe)
fe->local_filename = NULL;
return 0;
}
sock = open_data_connection(fe->bucket, "RETR", fe->remote_filename, 1);
sock = open_data_connection(fe->bucket, "RETR", fe->remote_filename, TYPE_BINARY);
if (sock == -1) {
ftpfserrno = EACCES;
goto error_3;