screen: Introduce Xx string escape showing the executed command of a window either only the executed command ('X') or the whole command line ('x') of each window is shown. Signed-off-by: Thomas Renninger diff --git a/doc/screen.1 b/doc/screen.1 index 7a0c1de..57352f1 100644 --- a/doc/screen.1 +++ b/doc/screen.1 @@ -3750,6 +3750,10 @@ window; with '+' qualifier: starting with the window after the current one. .IP W all window numbers and names except the current one +.IP x +the executed command including arguments running in this windows +.IP X +the executed command without arguments running in this windows .IP y last two digits of the year number .IP Y diff --git a/screen.c b/screen.c index efb73d3..e8a553c 100644 --- a/screen.c +++ b/screen.c @@ -2681,6 +2681,23 @@ int rec; } p += strlen(p) - 1; break; + case 'X': case 'x': + if (!win) + break; + if (win->w_cmdargs[0]) { + sprintf(p, "%s", win->w_cmdargs[0]); + p += strlen(p); + } + else + break; + if (*s == 'x') { + for (i = 1; win->w_cmdargs[i]; i++) { + sprintf(p, " %s", win->w_cmdargs[i]); + p += strlen(p); + } + } + p--; + break; case 'l': #ifdef LOADAV *p = 0;