mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 18:14:25 +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>
|
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
|
* command.c: Make `command' a standard WInput widget, just
|
||||||
change its callback. Eliminate input_w(). Adjust all
|
change its callback. Eliminate input_w(). Adjust all
|
||||||
dependencies.
|
dependencies.
|
||||||
|
@ -272,3 +272,17 @@ command_new (int y, int x, int cols)
|
|||||||
return cmd;
|
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);
|
WInput *command_new (int y, int x, int len);
|
||||||
void do_cd_command (char *cmd);
|
void do_cd_command (char *cmd);
|
||||||
|
void command_insert (WInput * in, char *text, int insert_extra_space);
|
||||||
|
|
||||||
#endif /* __COMMAND_H */
|
#endif /* __COMMAND_H */
|
||||||
|
36
src/main.c
36
src/main.c
@ -1254,9 +1254,9 @@ static void copy_current_pathname (void)
|
|||||||
if (!command_prompt)
|
if (!command_prompt)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
stuff (cmdline, cpanel->cwd, 0);
|
command_insert (cmdline, cpanel->cwd, 0);
|
||||||
if (cpanel->cwd [strlen (cpanel->cwd) - 1] != PATH_SEP)
|
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)
|
static void copy_other_pathname (void)
|
||||||
@ -1267,9 +1267,9 @@ static void copy_other_pathname (void)
|
|||||||
if (!command_prompt)
|
if (!command_prompt)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
stuff (cmdline, opanel->cwd, 0);
|
command_insert (cmdline, opanel->cwd, 0);
|
||||||
if (cpanel->cwd [strlen (opanel->cwd) - 1] != PATH_SEP)
|
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)
|
static void copy_readlink (WPanel *panel)
|
||||||
@ -1285,7 +1285,7 @@ static void copy_readlink (WPanel *panel)
|
|||||||
g_free (p);
|
g_free (p);
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
buffer [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){
|
if (get_current_type () == view_tree){
|
||||||
WTree *tree = (WTree *) get_panel_widget (get_current_index ());
|
WTree *tree = (WTree *) get_panel_widget (get_current_index ());
|
||||||
tmp = name_quote (tree->selected_ptr->name, 1);
|
tmp = tree->selected_ptr->name;
|
||||||
} else
|
} else
|
||||||
tmp = name_quote (selection (cpanel)->fname, 1);
|
tmp = selection (cpanel)->fname;
|
||||||
stuff (cmdline, tmp, 1);
|
|
||||||
g_free (tmp);
|
command_insert (cmdline, tmp, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void copy_tagged (WPanel *panel)
|
static void
|
||||||
|
copy_tagged (WPanel * panel)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!command_prompt)
|
if (!command_prompt)
|
||||||
return;
|
return;
|
||||||
input_disable_update (cmdline);
|
input_disable_update (cmdline);
|
||||||
if (panel->marked){
|
if (panel->marked) {
|
||||||
for (i = 0; i < panel->count; i++)
|
for (i = 0; i < panel->count; i++) {
|
||||||
if (panel->dir.list [i].f.marked) {
|
if (panel->dir.list[i].f.marked)
|
||||||
char *tmp = name_quote (panel->dir.list [i].fname, 1);
|
command_insert (cmdline, panel->dir.list[i].fname, 1);
|
||||||
stuff (cmdline, tmp, 1);
|
|
||||||
g_free (tmp);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
char *tmp = name_quote (panel->dir.list [panel->selected].fname, 1);
|
command_insert (cmdline, panel->dir.list[panel->selected].fname,
|
||||||
stuff (cmdline, tmp, 1);
|
1);
|
||||||
g_free (tmp);
|
|
||||||
}
|
}
|
||||||
input_enable_update (cmdline);
|
input_enable_update (cmdline);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user