SHA256
1
0
forked from pool/screen

Accepting request 312094 from home:Alexander_Naumov:branches:Base:System

new version, GNU screen 4.3.0 release

OBS-URL: https://build.opensuse.org/request/show/312094
OBS-URL: https://build.opensuse.org/package/show/Base:System/screen?expand=0&rev=57
This commit is contained in:
Thomas Renninger 2015-06-15 16:01:12 +00:00 committed by Git OBS Bridge
parent a97ac5dc03
commit 7aa7f49293
12 changed files with 28 additions and 805 deletions

View File

@ -1,5 +1,5 @@
--- ./configure.in.orig 2012-06-11 14:43:51.000000000 +0000
+++ ./configure.in 2012-06-11 14:45:19.000000000 +0000
--- ./configure.ac.orig 2012-06-11 14:43:51.000000000 +0000
+++ ./configure.ac 2012-06-11 14:45:19.000000000 +0000
@@ -668,8 +668,8 @@ tgetent((char *)0, (char *)0);
LIBS="-ltermcap $olibs"
AC_CHECKING(libtermcap)

View File

@ -1,323 +0,0 @@
--- ./extern.h.orig 2012-06-08 15:20:18.000000000 +0000
+++ ./extern.h 2012-06-08 15:58:08.000000000 +0000
@@ -458,8 +458,7 @@ extern void LayProcessMouseSwitch __P((
/* teln.c */
#ifdef BUILTIN_TELNET
-extern int TelOpen __P((char **));
-extern int TelConnect __P((struct win *));
+extern int TelOpenAndConnect __P((struct win *));
extern int TelIsline __P((struct win *p));
extern void TelProcessLine __P((char **, int *));
extern int DoTelnet __P((char *, int *, int));
--- ./help.c.orig 2012-06-08 15:20:18.000000000 +0000
+++ ./help.c 2012-06-08 15:58:08.000000000 +0000
@@ -66,6 +66,10 @@ char *myname, *message, *arg;
{
printf("Use: %s [-opts] [cmd [args]]\n", myname);
printf(" or: %s -r [host.tty]\n\nOptions:\n", myname);
+#ifdef BUILTIN_TELNET
+ printf("-4 Use IPv4.\n");
+ printf("-6 Use IPv6.\n");
+#endif
printf("-a Force all capabilities into each window's termcap.\n");
printf("-A -[r|R] Adapt all windows to the new display width & height.\n");
printf("-c file Read configuration file instead of '.screenrc'.\n");
--- ./screen.c.orig 2012-06-08 15:20:18.000000000 +0000
+++ ./screen.c 2012-06-08 15:58:08.000000000 +0000
@@ -248,8 +248,9 @@ struct layer *flayer;
struct win *fore;
struct win *windows;
struct win *console_window;
-
-
+#ifdef BUILTIN_TELNET
+int af;
+#endif
/*
* Do this last
@@ -507,6 +508,9 @@ char **av;
nwin = nwin_undef;
nwin_options = nwin_undef;
strcpy(screenterm, "screen");
+#ifdef BUILTIN_TELNET
+ af = AF_UNSPEC;
+#endif
logreopen_register(lf_secreopen);
@@ -541,6 +545,14 @@ char **av;
{
switch (*ap)
{
+#ifdef BUILTIN_TELNET
+ case '4':
+ af = AF_INET;
+ break;
+ case '6':
+ af = AF_INET6;
+ break;
+#endif
case 'a':
nwin_options.aflag = 1;
break;
--- ./teln.c.orig 2009-07-22 15:59:27.000000000 +0000
+++ ./teln.c 2012-06-08 15:58:08.000000000 +0000
@@ -30,6 +30,7 @@
#include <sys/socket.h>
#include <fcntl.h>
#include <netdb.h>
+#include <stdio.h>
#include "config.h"
@@ -42,12 +43,13 @@ extern struct win *fore;
extern struct layer *flayer;
extern int visual_bell;
extern char screenterm[];
+extern int af;
static void TelReply __P((struct win *, char *, int));
static void TelDocmd __P((struct win *, int, int));
static void TelDosub __P((struct win *));
-
-#define TEL_DEFPORT 23
+// why TEL_DEFPORT has "
+#define TEL_DEFPORT "23"
#define TEL_CONNECTING (-2)
#define TC_IAC 255
@@ -105,86 +107,78 @@ char *data;
}
int
-TelOpen(args)
-char **args;
-{
- int fd;
- int on = 1;
-
- if ((fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1)
- {
- Msg(errno, "TelOpen: socket");
- return -1;
- }
- if (setsockopt(fd, SOL_SOCKET, SO_OOBINLINE, (char *)&on, sizeof(on)))
- Msg(errno, "TelOpen: setsockopt SO_OOBINLINE");
- return fd;
-}
-
-int
-TelConnect(p)
-struct win *p;
-{
- int port = TEL_DEFPORT;
- struct hostent *hp;
- char **args;
+TelOpenAndConnect(struct win *p) {
+ int fd, on = 1;
char buf[256];
- args = p->w_cmdargs + 1;
-
- if (!*args)
- {
- Msg(0, "Usage: screen //telnet host [port]");
- return -1;
- }
- if (args[1])
- port = atoi(args[1]);
- p->w_telsa.sin_family = AF_INET;
- if((p->w_telsa.sin_addr.s_addr = inet_addr(*args)) == -1)
- {
- if ((hp = gethostbyname(*args)) == NULL)
- {
- Msg(0, "unknown host: %s", *args);
- return -1;
- }
- if (hp->h_length != sizeof(p->w_telsa.sin_addr.s_addr) || hp->h_addrtype != AF_INET)
- {
- Msg(0, "Bad address type for %s", hp->h_name);
- return -1;
- }
- bcopy((char *)hp->h_addr,(char *)&p->w_telsa.sin_addr.s_addr, hp->h_length);
- p->w_telsa.sin_family = hp->h_addrtype;
- }
- p->w_telsa.sin_port = htons(port);
- if (port != TEL_DEFPORT)
- sprintf(buf, "Trying %s %d...", inet_ntoa(p->w_telsa.sin_addr), port);
- else
- sprintf(buf, "Trying %s...", inet_ntoa(p->w_telsa.sin_addr));
- WriteString(p, buf, strlen(buf));
- if (connect(p->w_ptyfd, (struct sockaddr *)&p->w_telsa, sizeof(p->w_telsa)))
- {
- if (errno == EINPROGRESS)
- {
- p->w_telstate = TEL_CONNECTING;
- p->w_telconnev.fd = p->w_ptyfd;
- p->w_telconnev.handler = tel_connev_fn;
- p->w_telconnev.data = (char *)p;
- p->w_telconnev.type = EV_WRITE;
- p->w_telconnev.pri = 1;
- debug("telnet connect in progress...\n");
- evenq(&p->w_telconnev);
- }
- else
- {
- Msg(errno, "TelOpen: connect");
- return -1;
- }
- }
- else
- WriteString(p, "connected.\r\n", 12);
- if (port == TEL_DEFPORT)
- TelReply(p, (char *)tn_init, sizeof(tn_init));
- return 0;
+ struct addrinfo hints, *res0, *res;
+
+ if (!(p->w_cmdargs[1])) {
+ Msg(0, "Usage: screen //telnet host [port]");
+ return -1;
+ }
+
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = af;
+ hints.ai_socktype = SOCK_STREAM;
+ hints.ai_protocol = IPPROTO_TCP;
+ if(getaddrinfo(p->w_cmdargs[1], p->w_cmdargs[2] ? p->w_cmdargs[2] : TEL_DEFPORT,
+ &hints, &res0)) {
+ Msg(0, "unknown host: %s", p->w_cmdargs[1]);
+ return -1;
+ }
+
+ for(res = res0; res; res = res->ai_next) {
+ if((fd = socket(res->ai_family, res->ai_socktype, res->ai_protocol)) == -1) {
+ if(res->ai_next)
+ continue;
+ else {
+ Msg(errno, "TelOpenAndConnect: socket");
+ freeaddrinfo(res0);
+ return -1;
+ }
+ }
+
+ if (setsockopt(fd, SOL_SOCKET, SO_OOBINLINE, (char *)&on, sizeof(on)))
+ Msg(errno, "TelOpenAndConnect: setsockopt SO_OOBINLINE");
+
+ if (p->w_cmdargs[2] && strcmp(p->w_cmdargs[2], TEL_DEFPORT))
+ snprintf(buf, 256, "Trying %s %s...", p->w_cmdargs[1], p->w_cmdargs[2]);
+ else
+ snprintf(buf, 256, "Trying %s...", p->w_cmdargs[1]);
+ WriteString(p, buf, strlen(buf));
+ if (connect(fd, res->ai_addr, res->ai_addrlen)) {
+ if (errno == EINPROGRESS) {
+ p->w_telstate = TEL_CONNECTING;
+ p->w_telconnev.fd = fd;
+ p->w_telconnev.handler = tel_connev_fn;
+ p->w_telconnev.data = (char *)p;
+ p->w_telconnev.type = EV_WRITE;
+ p->w_telconnev.pri = 1;
+ debug("telnet connect in progress...\n");
+ evenq(&p->w_telconnev);
+ }
+ else {
+ close(fd);
+ if(res->ai_next)
+ continue;
+ else {
+ Msg(errno, "TelOpenAndConnect: connect");
+ freeaddrinfo(res0);
+ return -1;
+ }
+ }
+ }
+ else
+ WriteString(p, "connected.\r\n", 12);
+ if (!(p->w_cmdargs[2] && strcmp(p->w_cmdargs[2], TEL_DEFPORT)))
+ TelReply(p, (char *)tn_init, sizeof(tn_init));
+ p->w_ptyfd = fd;
+ memcpy(&p->w_telsa, &res->ai_addr, sizeof(res->ai_addr));
+ freeaddrinfo(res0);
+ return 0;
+ }
+ return -1;
}
int
--- ./window.c.orig 2012-06-08 15:20:18.000000000 +0000
+++ ./window.c 2012-06-08 16:01:54.000000000 +0000
@@ -607,6 +607,13 @@ struct NewWindow *newwin;
n = pp - wtab;
debug1("Makewin creating %d\n", n);
+#ifdef BUILTIN_TELNET
+ if(!strcmp(nwin.args[0], "//telnet")) {
+ type = W_TYPE_TELNET;
+ TtyName = "telnet";
+ }
+ else
+#endif
if ((f = OpenDevice(nwin.args, nwin.lflag, &type, &TtyName)) < 0)
return -1;
if (type == W_TYPE_GROUP)
@@ -768,7 +775,7 @@ struct NewWindow *newwin;
#ifdef BUILTIN_TELNET
if (type == W_TYPE_TELNET)
{
- if (TelConnect(p))
+ if (TelOpenAndConnect(p))
{
FreeWindow(p);
return -1;
@@ -880,6 +887,13 @@ struct win *p;
int lflag, f;
lflag = nwin_default.lflag;
+#ifdef BUILTIN_TELNET
+ if(!strcmp(p->w_cmdargs[0], "//telnet")) {
+ p->w_type = W_TYPE_TELNET;
+ TtyName = "telnet";
+ }
+ else
+#endif
if ((f = OpenDevice(p->w_cmdargs, lflag, &p->w_type, &TtyName)) < 0)
return -1;
@@ -913,7 +927,7 @@ struct win *p;
#ifdef BUILTIN_TELNET
if (p->w_type == W_TYPE_TELNET)
{
- if (TelConnect(p))
+ if (TelOpenAndConnect(p))
return -1;
}
else
@@ -1072,16 +1086,6 @@ char **namep;
*namep = "telnet";
return 0;
}
-#ifdef BUILTIN_TELNET
- if (strcmp(arg, "//telnet") == 0)
- {
- f = TelOpen(args + 1);
- lflag = 0;
- *typep = W_TYPE_TELNET;
- *namep = "telnet";
- }
- else
-#endif
if (strncmp(arg, "//", 2) == 0)
{
Msg(0, "Invalid argument '%s'", arg);
--- ./window.h.orig 2012-06-08 15:20:18.000000000 +0000
+++ ./window.h 2012-06-08 15:58:08.000000000 +0000
@@ -268,7 +268,7 @@ struct win
struct display *w_zdisplay;
#endif
#ifdef BUILTIN_TELNET
- struct sockaddr_in w_telsa;
+ struct sockaddr_storage w_telsa;
char w_telbuf[IOSIZE];
int w_telbufl;
char w_telmopts[256];

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5468545047e301d2b3579f9d9ce00466d14a7eec95ce806e3834a3d6b0b9b080
size 1062485

Binary file not shown.

3
screen-4.3.0.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5164e89bcc60d7193177e6e02885cc42411d1d815c839e174fb9abafb9658c46
size 845838

BIN
screen-4.3.0.tar.gz.sig Normal file

Binary file not shown.

View File

@ -1,206 +0,0 @@
screen: Implement dead/zombie window polling
Currently if zombie keys are defined, one needs to explicitly
hit a key to tell screen to try to reconnect a window.
This is rather unfortunte if you for example have dozens of screens
connected to foreign machines through network connections.
Once the network connection is cut for a while, all windows will
enter the dead/zombie state and one has to go through all windows
manually and hit the zombie resurrect key, once the network got
set up again.
This patch implements auto-reconnecting via zombie_timeout
(in seconds) variable. By default it is set to 0 which complies
to current behavior (no polling is done).
Signed-off-by: Thomas Renninger <trenn@suse.de>
--- ./comm.c.orig 2013-09-13 13:22:50.993279658 +0000
+++ ./comm.c 2013-09-13 13:23:15.264279615 +0000
@@ -339,5 +339,6 @@ struct comm comms[RC_LAST + 1] =
#ifdef ZMODEM
{ "zmodem", ARGS_012 },
#endif
- { "zombie", ARGS_012 }
+ { "zombie", ARGS_012 },
+ { "zombie_timeout", ARGS_1 }
};
--- ./doc/screen.1.orig 2013-09-13 13:22:50.993279658 +0000
+++ ./doc/screen.1 2013-09-13 13:23:15.266279615 +0000
@@ -3547,6 +3547,15 @@ Optionally you can put the word \*Qonerr
to monitor exit status of the process running in the window. If it exits normally ('0'),
the window disappears. Any other exit value causes the window to become a zombie.
+.BR "zombie_timeout" [\fIseconds\fP]
+.PP
+Per default
+.I screen
+windows are removed from the window list as soon as
+the windows process (e.g. shell) exits. If \fBzombie\fP keys are defined
+(compare with above \fBzombie\fP command), it is possible to also set a
+timeout when screen tries to automatically reconnect a dead screen window.
+
.SH "THE MESSAGE LINE"
.I Screen
displays informational messages and other diagnostics in a \fImessage line\fP.
--- ./doc/screen.texinfo.orig 2013-09-13 13:22:50.985279658 +0000
+++ ./doc/screen.texinfo 2013-09-13 13:23:15.268279615 +0000
@@ -1239,6 +1239,8 @@ Send an XON character. @xref{XON/XOFF}.
Define how screen treats zmodem requests. @xref{Zmodem}.
@item zombie [@var{keys} [onerror] ]
Keep dead windows. @xref{Zombie}.
+@item zombie_timeout [@var{seconds}]
+Try to reconnect dead windows after timeout. @xref{Zombie}.
@end table
@node New Window, Selecting, Commands, Top
@@ -5223,6 +5225,8 @@ Display the version and modification dat
@section Zombie
@deffn Command zombie [@var{keys} [onerror] ]
@deffnx Command defzombie [@var{keys}]
+@deffn Command zombie_timeout [@var{seconds}]
+@end deffn
(none)@*
Per default windows are removed from the window list as soon as the
windows process (e.g. shell) exits. When a string of two keys is
@@ -5242,6 +5246,11 @@ Optionally you can put the word @code{on
cause screen to monitor exit status of the process running in the window.
If it exits normally ('0'), the window disappears. Any other exit value
causes the window to become a zombie.
+
+Additionally the @code{zombie_timeout} command exists.
+If a window is declared ``dead'', screen will automatically try to
+resurrect the window after the timeout.
+It only works if zombie keys are defined via @code{zombie} command.
@end deffn
@node Printcmd, Rendition, Zombie, Miscellaneous
--- ./process.c.orig 2013-09-13 13:22:50.994279658 +0000
+++ ./process.c 2013-09-13 13:23:15.270279615 +0000
@@ -3067,6 +3067,18 @@ int key;
}
WindowChanged((struct win *)0, 0);
break;
+ case RC_ZOMBIE_TIMEOUT:
+ if (argc != 1)
+ {
+ Msg(0, "Setting zombie polling needs a timeout arg\n");
+ break;
+ }
+ nwin_default.poll_zombie_timeout = atoi(args[0]);
+ if (fore)
+ fore->w_poll_zombie_timeout = nwin_default.poll_zombie_timeout;
+
+ debug1("Setting zombie polling to %d\n", nwin_default.poll_zombie_timeout);
+ break;
case RC_SILENCE:
n = fore->w_silence != 0;
i = fore->w_silencewait;
--- ./screen.c.orig 2013-09-13 13:22:50.989279658 +0000
+++ ./screen.c 2013-09-13 13:23:15.270279615 +0000
@@ -1557,6 +1557,13 @@ int wstat_valid;
p->w_y = MFindUsedLine(p, p->w_bot, 1);
sprintf(buf, "\n\r=== Command %s (%s) ===", reason, s ? s : "?");
WriteString(p, buf, strlen(buf));
+ if (p->w_poll_zombie_timeout)
+ {
+ debug2("Set zombie poll timeout for window %s to %d\n", p->w_title,
+ p->w_poll_zombie_timeout);
+ SetTimeout(&p->w_zombieev, p->w_poll_zombie_timeout * 1000);
+ evenq(&p->w_zombieev);
+ }
WindowChanged(p, 'f');
}
else
--- ./window.c.orig 2013-09-13 13:22:50.990279658 +0000
+++ ./window.c 2013-09-13 13:23:15.270279615 +0000
@@ -87,6 +87,7 @@ static int DoAutolf __P((char *, int *,
static void ZombieProcess __P((char **, int *));
static void win_readev_fn __P((struct event *, char *));
static void win_writeev_fn __P((struct event *, char *));
+static void win_resurrect_zombie_fn __P((struct event *, char *));
static int muchpending __P((struct win *, struct event *));
#ifdef COPY_PASTE
static void paste_slowev_fn __P((struct event *, char *));
@@ -164,7 +165,8 @@ struct NewWindow nwin_default =
0, /* bce */
0, /* encoding */
(char *)0, /* hstatus */
- (char *)0 /* charset */
+ (char *)0, /* charset */
+ 0 /* poll_zombie_timeout */
};
struct NewWindow nwin_options;
@@ -198,6 +200,7 @@ struct NewWindow *def, *new, *res;
COMPOSE(encoding);
COMPOSE(hstatus);
COMPOSE(charset);
+ COMPOSE(poll_zombie_timeout);
#undef COMPOSE
}
@@ -842,6 +845,14 @@ struct NewWindow *newwin;
DoStartLog(p, buf, sizeof(buf));
}
+ /* Is this all where I have to init window poll timeout? */
+ if (nwin.poll_zombie_timeout)
+ p->w_poll_zombie_timeout = nwin.poll_zombie_timeout;
+
+ p->w_zombieev.type = EV_TIMEOUT;
+ p->w_zombieev.data = (char *)p;
+ p->w_zombieev.handler = win_resurrect_zombie_fn;
+
p->w_readev.fd = p->w_writeev.fd = p->w_ptyfd;
p->w_readev.type = EV_READ;
p->w_writeev.type = EV_WRITE;
@@ -1064,6 +1075,7 @@ struct win *wp;
evdeq(&wp->w_readev); /* just in case */
evdeq(&wp->w_writeev); /* just in case */
evdeq(&wp->w_silenceev);
+ evdeq(&wp->w_zombieev);
evdeq(&wp->w_destroyev);
#ifdef COPY_PASTE
FreePaster(&wp->w_paster);
@@ -1945,6 +1957,21 @@ char *data;
return;
}
+static void
+win_resurrect_zombie_fn(ev, data)
+struct event *ev;
+char *data;
+{
+ struct win *p = (struct win *)data;
+ debug2("Try to resurrecting Zombie event: %d [%s]\n",
+ p->w_number, p->w_title);
+ /* Already reconnected? */
+ if (p->w_deadpid != p->w_pid)
+ return;
+ debug1("Resurrecting Zombie: %d\n", p->w_number);
+ WriteString(p, "\r\n", 2);
+ RemakeWindow(p);
+}
static void
win_writeev_fn(ev, data)
--- ./window.h.orig 2013-09-13 13:22:50.990279658 +0000
+++ ./window.h 2013-09-13 13:23:15.270279615 +0000
@@ -57,6 +57,7 @@ struct NewWindow
int encoding;
char *hstatus;
char *charset;
+ int poll_zombie_timeout;
};
#ifdef PSEUDOS
@@ -150,6 +151,8 @@ struct win
struct event w_readev;
struct event w_writeev;
struct event w_silenceev; /* silence event */
+ struct event w_zombieev; /* event to try to resurrect window */
+ int w_poll_zombie_timeout;
int w_ptyfd; /* fd of the master pty */
char w_inbuf[IOSIZE];
int w_inlen;

View File

@ -1,3 +1,22 @@
-------------------------------------------------------------------
Mon Jun 15 09:28:15 UTC 2015 - alexander_naumov@opensuse.org
- GNU screen 4.3.0:
* Introduce Xx string escape showing the executed command of a window
* Implement dead/zombie window polling, allowing for auto reconnecting
* Allow setting hardstatus on first line
* 'sort' command sorting windows by title
* 'bumpleft', 'bumpright' - manually move windows on window list
* 'collapse' removing numbering 'gaps' between windows, by renumbering
* 'windows' command now accepts arguments for use with querying
- packaging changes:
* move screen-poll-zombies.patch to savannah git
* move screen-4.0.3-ipv6.patch to savannah git
* move sort_command.patch to savannah git
* move xX_string_escape.patch to savannah git
* move screen_enhance_windows_list.patch to savannah git
-------------------------------------------------------------------
Fri May 2 19:42:12 UTC 2014 - andreas.stieger@gmx.de

View File

@ -1,7 +1,7 @@
#
# spec file for package screen
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -38,23 +38,17 @@ BuildRequires: autoconf
BuildRequires: automake
PreReq: %install_info_prereq
PreReq: coreutils
Version: 4.2.1
Version: 4.3.0
Release: 0
Summary: A program to allow multiple screens on a VT100/ANSI Terminal
License: GPL-2.0+
License: GPL-3.0+
Group: System/Console
Source: http://ftp.gnu.org/gnu/screen/%{name}-%{version}.tar.gz
Source1: screen.conf
Source2: http://ftp.gnu.org/gnu/screen/%{name}-%{version}.tar.gz.sig
Source3: https://savannah.gnu.org/project/memberlist-gpgkeys.php?group=screen&download=1#/%{name}.keyring
Patch0: global_screenrc.patch
Patch3: screen-4.0.3-ipv6.patch
# upstream savannah#30880
Patch5: sort_command.patch
Patch6: libtinfo.diff
Patch10: screen-poll-zombies.patch
Patch11: xX_string_escape.patch
Patch12: screen_enhance_windows_list.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
@ -68,18 +62,9 @@ Documentation: man page
%setup
# global_screenrc.patch
%patch0
# screen-4.0.3-ipv6.patch
%patch3
# sort_command.patch
%patch5
# libtinfo.diff
%patch6
# screen-poll-zombies.patch
%patch10 -p1
# xX_string_escape.patch
%patch11
# screen_enhance_windows_list.patch
%patch12
%build
sh ./autogen.sh

View File

@ -1,121 +0,0 @@
screen: Introduce argument to windows command
A string escape can be passed which makes the windows command
much more flexible. The default string escape if no argument
is passed is "%n%f %t " which is intended to rebuild
the same output the windows command would give as good
as possible (slight changes with the flags can happen).
This command is also not be limited in output size
(the windows command is limited to 1024 bytes).
The windowsx command can be queried (-Q command) and
this is its main purpose (be able to query the exact
window list status of an active screen session from
shell).
Signed-off-by: Thomas Renninger <trenn@suse.de>
--- ./comm.c.orig 2013-09-13 13:37:01.440278153 +0000
+++ ./comm.c 2013-09-13 13:37:21.830278117 +0000
@@ -328,7 +328,7 @@ struct comm comms[RC_LAST + 1] =
{ "wall", NEED_DISPLAY|ARGS_1},
{ "width", ARGS_0123 },
{ "windowlist", ARGS_012 },
- { "windows", CAN_QUERY|ARGS_0 },
+ { "windows", CAN_QUERY|ARGS_01 },
{ "wrap", NEED_FORE|ARGS_01 },
#ifdef COPY_PASTE
{ "writebuf", ARGS_0123 },
--- ./doc/screen.1.orig 2013-09-13 13:39:15.327277916 +0000
+++ ./doc/screen.1 2013-09-13 13:38:46.391277967 +0000
@@ -3435,7 +3435,7 @@ settings).
and 6 characters high in order to display.
.sp
.ne 3
-.B windows
+.B windows [ string ]
.PP
Uses the message line to display a list of all the windows.
Each window is listed by number with the name of process that has been
@@ -3451,6 +3451,9 @@ windows occupied by other users are mark
windows in the zombie state are marked with `Z'.
If this list is too long to fit on the terminal's status line only the
portion around the current window is displayed.
+The optional string parameter follows the \*QSTRING ESCAPES\*U format.
+If string parameter is passed, the output size is unlimited.
+The default command without any parameter is limited to a size of 1024 bytes.
.sp
.ne 3
.BR "wrap " [ on | off ]
--- ./doc/screen.texinfo.orig 2013-09-13 13:38:53.376277955 +0000
+++ ./doc/screen.texinfo 2013-09-13 13:39:47.392277859 +0000
@@ -2617,7 +2617,7 @@ before displaying a message. Default is
@section Windows
@kindex w
@kindex C-w
-@deffn Command windows
+@deffn Command windows [string]
(@kbd{C-a w}, @kbd{C-a C-w})@*
Uses the message line to display a list of all the windows. Each
window is listed by number with the name of the program running in the
@@ -2636,6 +2636,11 @@ windows in the zombie state are marked w
If this list is too long to fit on the terminal's status line only the
portion around the current window is displayed.
+
+You can customize the output format to any string you like including
+string escapes (@pxref{String Escapes}).
+In this case, if the string parameter is passed, the maximum output
+size is unlimited (instead of 1024 bytes if no parameter is passed).
@end deffn
@node Hardstatus, Mousetrack, Windows, Window Settings
--- ./process.c.orig 2013-09-13 13:39:55.192277845 +0000
+++ ./process.c 2013-09-13 13:53:18.672276423 +0000
@@ -170,6 +170,7 @@ static void ResizeFin __P((char *, int,
static struct action *FindKtab __P((char *, int));
static void SelectFin __P((char *, int, char *));
static void SelectLayoutFin __P((char *, int, char *));
+static void ShowWindowsX __P((char *));
extern struct layer *flayer;
@@ -1838,6 +1839,11 @@ int key;
Activate(-1);
break;
case RC_WINDOWS:
+ if (args[0])
+ {
+ ShowWindowsX(args[0]);
+ break;
+ }
ShowWindows(-1);
break;
case RC_VERSION:
@@ -5637,6 +5643,25 @@ int where;
Msg(0, "%s", ss);
}
+/*
+ * String Escape based windows listing
+ * mls: currently does a Msg() call for each(!) window, dunno why
+ */
+static void
+ShowWindowsX(str)
+char *str;
+{
+ int i;
+ debug1("ShowWindowsX: string [%s]", string);
+ for (i = 0; i < maxwin ; i++)
+ {
+ if (!wtab[i])
+ continue;
+ Msg(0, "%s", MakeWinMsg(str, wtab[i], '%'));
+ }
+}
+
+
static void
ShowInfo()
{

View File

@ -1,88 +0,0 @@
---
comm.c | 1 +
doc/screen.1 | 5 +++++
process.c | 43 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 49 insertions(+)
Index: comm.c
===================================================================
--- comm.c.orig
+++ comm.c
@@ -297,6 +297,7 @@ struct comm comms[RC_LAST + 1] =
{ "sleep", ARGS_1 },
{ "slowpaste", NEED_FORE|ARGS_01 },
{ "sorendition", ARGS_012 },
+ { "sort", ARGS_0 },
{ "source", ARGS_1 },
{ "split", NEED_DISPLAY|ARGS_01 },
{ "startup_message", ARGS_1 },
Index: doc/screen.1
===================================================================
--- doc/screen.1.orig
+++ doc/screen.1
@@ -3015,6 +3015,11 @@ underlying system exposes flow control p
text.
.sp
.ne 3
+.B sort
+.PP
+Sort the windows in alphabetical order of the window tiles.
+.sp
+.ne 3
.BI "source " file
.PP
Read and execute commands from file \fIfile\fP. Source commands may
Index: process.c
===================================================================
--- process.c.orig
+++ process.c
@@ -3024,6 +3024,49 @@ int key;
}
}
break;
+ case RC_SORT:
+ if (fore)
+ {
+ /* Better do not allow this. Not sure what the utmp stuff in number
+ command above is for (you get four entries in e.g. /var/log/wtmp
+ per number switch). But I don't know enough about this.*/
+ Msg(0, "Sorting inside a window is not allowed. Push CTRL-a \" "
+ "and try again\n");
+ break;
+ }
+ /*
+ * Simple sort algorithm: Look out for the smallest, put it
+ * to the first place, look out for the 2nd smallest, ...
+ */
+ for (i = 0; i < maxwin ; i++)
+ {
+ if (wtab[i] == NULL)
+ continue;
+ n = i;
+ for (nr = i + 1; nr < maxwin; nr++)
+ {
+ if (wtab[nr] == NULL)
+ continue;
+ debug2("Testing window %d and %d.\n", nr, n);
+ if (strcmp(wtab[nr]->w_title,wtab[n]->w_title) < 0)
+ n = nr;
+ }
+ if (n != i)
+ {
+ debug2("Exchange window %d and %d.\n", i, n);
+ p = wtab[n];
+ wtab[n] = wtab[i];
+ wtab[i] = p;
+ wtab[n]->w_number = n;
+ wtab[i]->w_number = i;
+#ifdef MULTIUSER
+ /* exchange the acls for these windows. */
+ AclWinSwap(i, n);
+#endif
+ }
+ }
+ WindowChanged((struct win *)0, 0);
+ break;
case RC_SILENCE:
n = fore->w_silence != 0;
i = fore->w_silencewait;

View File

@ -1,43 +0,0 @@
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 <trenn@suse.de>
--- ./doc/screen.1.orig 2013-09-13 13:26:28.055279274 +0000
+++ ./doc/screen.1 2013-09-13 13:26:41.385279250 +0000
@@ -3747,6 +3747,10 @@ window; with '+' qualifier: starting wit
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
--- ./screen.c.orig 2013-09-13 13:26:28.057279274 +0000
+++ ./screen.c 2013-09-13 13:34:30.151278421 +0000
@@ -2693,6 +2693,20 @@ int rec;
}
p += strlen(p) - 1;
break;
+ case 'X': case 'x':
+ *p = 0;
+ for (i = 0; win && win->w_cmdargs[i]; i++)
+ {
+ if (l < strlen(win->w_cmdargs[i]) + 1)
+ break;
+ sprintf(p, i ? "%s" : " %s", win->w_cmdargs[i]);
+ l -= strlen(p);
+ p += strlen(p);
+ if (i == 0 && *s == 'X')
+ break;
+ }
+ p--;
+ break;
case 'l':
#ifdef LOADAV
*p = 0;