Refine cmd-char parsing for pasted path text mentioned at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=897426

This commit is contained in:
2026-04-06 14:26:47 -06:00
parent 5ff704459c
commit 9f8faf0a6e

View File

@@ -4883,6 +4883,9 @@ xit:
static int static int
handle_user_input (session *sess, char *text, int history, int nocommand) handle_user_input (session *sess, char *text, int history, int nocommand)
{ {
char cmd_char = prefs.hex_input_command_char[0];
unsigned int i;
if (*text == '\0') if (*text == '\0')
return 1; return 1;
@@ -4890,50 +4893,22 @@ handle_user_input (session *sess, char *text, int history, int nocommand)
history_add (&sess->history, text); history_add (&sess->history, text);
/* is it NOT a command, just text? */ /* is it NOT a command, just text? */
if (nocommand || text[0] != prefs.hex_input_command_char[0]) if (nocommand || text[0] != cmd_char)
{ {
handle_say (sess, text, TRUE); handle_say (sess, text, TRUE);
return 1; return 1;
} }
/* check for // */ for (i = 1; text[i]; i++)
if (text[0] == prefs.hex_input_command_char[0] && text[1] == prefs.hex_input_command_char[0])
{ {
handle_say (sess, text + 1, TRUE); if (text[i] == cmd_char)
return 1;
}
#if 0 /* Who would remember all this? */
if (prefs.hex_input_command_char[0] == '/')
{
int i;
const char *unix_dirs [] = {
"/bin/",
"/boot/",
"/dev/",
"/etc/",
"/home/",
"/lib/",
"/lost+found/",
"/mnt/",
"/opt/",
"/proc/",
"/root/",
"/sbin/",
"/tmp/",
"/usr/",
"/var/",
"/gnome/",
NULL
};
for (i = 0; unix_dirs[i] != NULL; i++)
if (strncmp (text, unix_dirs[i], strlen (unix_dirs[i]))==0)
{ {
handle_say (sess, text, TRUE); handle_say (sess, text, TRUE);
return 1; return 1;
} }
if (text[i] == ' ')
break;
} }
#endif
return handle_command (sess, text + 1, TRUE); return handle_command (sess, text + 1, TRUE);
} }