From a6cb77fd232318a363f951ec54b822445810595f Mon Sep 17 00:00:00 2001 From: Dick Date: Sun, 14 Sep 2008 03:47:53 -0400 Subject: [PATCH] Prompt for input for 'stuff' command if necessary " This feature is useful when using a very slow remote shell session (SSH over a bad GPRS connection). By locally preparing a command you can enter a command and send it as bulk (without typos ;-)). " The gain from this patch is that, instead of doing ^a:stuff "command", the user would be doing ^aXcommand. This is a relatively pretty minor convenience, but I suppose it could be useful if the user needs to do this frequently. --- src/comm.c | 2 +- src/process.c | 17 +++++++++++++++++ src/termcap.c | 4 ++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/comm.c b/src/comm.c index 5ac1244..7c7a97e 100644 --- a/src/comm.c +++ b/src/comm.c @@ -292,7 +292,7 @@ struct comm comms[RC_LAST + 1] = { "source", ARGS_1 }, { "split", NEED_DISPLAY|ARGS_01 }, { "startup_message", ARGS_1 }, - { "stuff", NEED_LAYER|ARGS_12 }, + { "stuff", NEED_LAYER|ARGS_012 }, #ifdef MULTIUSER { "su", NEED_DISPLAY|ARGS_012 }, #endif diff --git a/src/process.c b/src/process.c index 264ee8d..001007d 100644 --- a/src/process.c +++ b/src/process.c @@ -1053,6 +1053,18 @@ char **args; return i; } +static void +StuffFin(buf, len, data) +char *buf; +int len; +char *data; +{ + if (!flayer) + return; + while(len) + LayProcess(&buf, &len); +} + /*ARGSUSED*/ void DoAction(act, key) @@ -1661,6 +1673,11 @@ int key; break; case RC_STUFF: s = *args; + if (!args[0]) + { + Input("Stuff:", 100, INP_COOKED, StuffFin, NULL, 0); + break; + } n = *argl; if (args[1]) { diff --git a/src/termcap.c b/src/termcap.c index b96497d..e7021d1 100644 --- a/src/termcap.c +++ b/src/termcap.c @@ -530,9 +530,9 @@ int map; a1 = 0; if (a2 && a2->nr == RC_ILLEGAL) a2 = 0; - if (a1 && a1->nr == RC_STUFF && strcmp(a1->args[0], s) == 0) + if (a1 && a1->nr == RC_STUFF && a1->args[0] && strcmp(a1->args[0], s) == 0) a1 = 0; - if (a2 && a2->nr == RC_STUFF && strcmp(a2->args[0], s) == 0) + if (a2 && a2->nr == RC_STUFF && a2->args[0] && strcmp(a2->args[0], s) == 0) a2 = 0; domap |= (a1 || a2); if (tab == umtab) -- 2.11.4.GIT