mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
* command.c: (command_insert): New function - insert quoted
text into the command line. * main.c: Use command_insert() instead of stuff(). This ensures that the names in the command line are quoted. Reported by Arpad Biro <biro_arpad@yahoo.com>
This commit is contained in:
parent
f6f02a0295
commit
b295faf096
@ -1,5 +1,11 @@
|
||||
2002-09-20 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* command.c: (command_insert): New function - insert quoted
|
||||
text into the command line.
|
||||
* main.c: Use command_insert() instead of stuff(). This ensures
|
||||
that the names in the command line are quoted.
|
||||
Reported by Arpad Biro <biro_arpad@yahoo.com>
|
||||
|
||||
* command.c: Make `command' a standard WInput widget, just
|
||||
change its callback. Eliminate input_w(). Adjust all
|
||||
dependencies.
|
||||
|
@ -272,3 +272,17 @@ command_new (int y, int x, int cols)
|
||||
return cmd;
|
||||
}
|
||||
|
||||
/*
|
||||
* Insert quoted text in input line. The function is meant for the
|
||||
* command line, so the percent sign is quoted as well.
|
||||
*/
|
||||
void
|
||||
command_insert (WInput * in, char *text, int insert_extra_space)
|
||||
{
|
||||
char *quoted_text;
|
||||
|
||||
quoted_text = name_quote (text, 1);
|
||||
stuff (in, quoted_text, insert_extra_space);
|
||||
g_free (quoted_text);
|
||||
}
|
||||
|
||||
|
@ -5,5 +5,6 @@ extern WInput *cmdline;
|
||||
|
||||
WInput *command_new (int y, int x, int len);
|
||||
void do_cd_command (char *cmd);
|
||||
void command_insert (WInput * in, char *text, int insert_extra_space);
|
||||
|
||||
#endif /* __COMMAND_H */
|
||||
|
38
src/main.c
38
src/main.c
@ -1254,9 +1254,9 @@ static void copy_current_pathname (void)
|
||||
if (!command_prompt)
|
||||
return;
|
||||
|
||||
stuff (cmdline, cpanel->cwd, 0);
|
||||
command_insert (cmdline, cpanel->cwd, 0);
|
||||
if (cpanel->cwd [strlen (cpanel->cwd) - 1] != PATH_SEP)
|
||||
stuff (cmdline, PATH_SEP_STR, 0);
|
||||
command_insert (cmdline, PATH_SEP_STR, 0);
|
||||
}
|
||||
|
||||
static void copy_other_pathname (void)
|
||||
@ -1267,9 +1267,9 @@ static void copy_other_pathname (void)
|
||||
if (!command_prompt)
|
||||
return;
|
||||
|
||||
stuff (cmdline, opanel->cwd, 0);
|
||||
command_insert (cmdline, opanel->cwd, 0);
|
||||
if (cpanel->cwd [strlen (opanel->cwd) - 1] != PATH_SEP)
|
||||
stuff (cmdline, PATH_SEP_STR, 0);
|
||||
command_insert (cmdline, PATH_SEP_STR, 0);
|
||||
}
|
||||
|
||||
static void copy_readlink (WPanel *panel)
|
||||
@ -1285,7 +1285,7 @@ static void copy_readlink (WPanel *panel)
|
||||
g_free (p);
|
||||
if (i > 0) {
|
||||
buffer [i] = 0;
|
||||
stuff (cmdline, buffer, 0);
|
||||
command_insert (cmdline, buffer, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1312,31 +1312,29 @@ void copy_prog_name (void)
|
||||
|
||||
if (get_current_type () == view_tree){
|
||||
WTree *tree = (WTree *) get_panel_widget (get_current_index ());
|
||||
tmp = name_quote (tree->selected_ptr->name, 1);
|
||||
tmp = tree->selected_ptr->name;
|
||||
} else
|
||||
tmp = name_quote (selection (cpanel)->fname, 1);
|
||||
stuff (cmdline, tmp, 1);
|
||||
g_free (tmp);
|
||||
tmp = selection (cpanel)->fname;
|
||||
|
||||
command_insert (cmdline, tmp, 1);
|
||||
}
|
||||
|
||||
static void copy_tagged (WPanel *panel)
|
||||
static void
|
||||
copy_tagged (WPanel * panel)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!command_prompt)
|
||||
return;
|
||||
input_disable_update (cmdline);
|
||||
if (panel->marked){
|
||||
for (i = 0; i < panel->count; i++)
|
||||
if (panel->dir.list [i].f.marked) {
|
||||
char *tmp = name_quote (panel->dir.list [i].fname, 1);
|
||||
stuff (cmdline, tmp, 1);
|
||||
g_free (tmp);
|
||||
}
|
||||
if (panel->marked) {
|
||||
for (i = 0; i < panel->count; i++) {
|
||||
if (panel->dir.list[i].f.marked)
|
||||
command_insert (cmdline, panel->dir.list[i].fname, 1);
|
||||
}
|
||||
} else {
|
||||
char *tmp = name_quote (panel->dir.list [panel->selected].fname, 1);
|
||||
stuff (cmdline, tmp, 1);
|
||||
g_free (tmp);
|
||||
command_insert (cmdline, panel->dir.list[panel->selected].fname,
|
||||
1);
|
||||
}
|
||||
input_enable_update (cmdline);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user