summaryrefslogtreecommitdiff
path: root/sysutils/screen49/files/patch-socket.c
diff options
context:
space:
mode:
authorCy Schubert <cy@FreeBSD.org>2024-08-28 19:33:47 -0700
committerCy Schubert <cy@FreeBSD.org>2024-08-28 20:35:49 -0700
commit43808d10e2359ee97c2a37d851bbb78e72eeabe3 (patch)
tree605052d61d9e0dff7b1d08c72fd6b0a22bbd940e /sysutils/screen49/files/patch-socket.c
parentirc/soju: Update to 0.8.2 (diff)
sysutils/screen*: Rename screen and introduce a meta port
This is in preparation for the import of screen 5.0.0. I've tried screen-devel (5.0.0 prelrelease). There were some bugs and inconsistencies with screen 4.9.1. So we move screen to screen49 to maintain a version of screen that is known to work. This implements the concept of a master screen port by renaming it to screen49 and creating a slave port called screen. The idea of this is similar in concept used with the cfengine or krb5 family of ports. Users should never need to change port origins when a new stable version of screen is committed. People can install the screen port or package as before. However if they choose to use the other screen port/package they may remove screen and install the versioned "master" port/package directly. This is in preparation for import of screen 5.0.0 into the ports collection. Unfortunately my initial testing of screen 5.0.0 using the screen-devel port uncovered an annoying (to me) bug, which I have opened an issue with our upstream. I have not found the time to test their patches enough to feel comfortalbe replacing the existing screen 4.9.1 with 5.0.0. When 5.0.0 will be imported as sysutils/screen50, it will not become the default master port until we believe it won't become a source of many bugzilla bugs.
Diffstat (limited to 'sysutils/screen49/files/patch-socket.c')
-rw-r--r--sysutils/screen49/files/patch-socket.c84
1 files changed, 84 insertions, 0 deletions
diff --git a/sysutils/screen49/files/patch-socket.c b/sysutils/screen49/files/patch-socket.c
new file mode 100644
index 000000000000..cfa52856c2e7
--- /dev/null
+++ b/sysutils/screen49/files/patch-socket.c
@@ -0,0 +1,84 @@
+--- socket.c.orig 2022-01-28 14:06:02 UTC
++++ socket.c
+@@ -141,12 +141,14 @@
+ char *firstn = NULL;
+ int nfound = 0, ngood = 0, ndead = 0, nwipe = 0, npriv = 0;
+ int nperfect = 0;
++ char timestr[64];
+ struct sent
+ {
+ struct sent *next;
+ int mode;
+ char *name;
+- } *slist, **slisttail, *sent, *nsent;
++ time_t time_created;
++ } *slist, **slisttail, *sent, *nsent, *schosen;
+
+ if (match)
+ {
+@@ -258,8 +260,13 @@
+ sent->next = 0;
+ sent->name = SaveStr(name);
+ sent->mode = mode;
++ sent->time_created = SessionCreationTime(name);
++ for (slisttail = &slist; *slisttail; slisttail = &((*slisttail)->next))
++ {
++ if ((*slisttail)->time_created < sent->time_created) break;
++ }
++ sent->next = *slisttail;
+ *slisttail = sent;
+- slisttail = &sent->next;
+ nfound++;
+ sockfd = MakeClientSocket(0, *is_sock);
+ #ifdef USE_SETEUID
+@@ -359,34 +366,42 @@
+ }
+ for (sent = slist; sent; sent = sent->next)
+ {
++ if (sent->time_created == 0)
++ {
++ sprintf(timestr, "??" "?");
++ }
++ else
++ {
++ strftime(timestr, 64, "%x %X", localtime(&sent->time_created));
++ }
+ switch (sent->mode)
+ {
+ case 0700:
+- printf("\t%s\t(Attached)\n", sent->name);
++ printf("\t%s\t(%s)\t(Attached)\n", sent->name, timestr);
+ break;
+ case 0600:
+- printf("\t%s\t(Detached)\n", sent->name);
++ printf("\t%s\t(%s)\t(Detached)\n", sent->name, timestr);
+ break;
+ #ifdef MULTIUSER
+ case 0701:
+- printf("\t%s\t(Multi, attached)\n", sent->name);
++ printf("\t%s\t(%s)\t(Multi, attached)\n", sent->name, timestr);
+ break;
+ case 0601:
+- printf("\t%s\t(Multi, detached)\n", sent->name);
++ printf("\t%s\t(%s)\t(Multi, detached)\n", sent->name, timestr);
+ break;
+ #endif
+ case -1:
+ /* No trigraphs here! */
+- printf("\t%s\t(Dead ?%c?)\n", sent->name, '?');
++ printf("\t%s\t(%s)\t(Dead ?%c?)\n", sent->name, timestr, '?');
+ break;
+ case -2:
+- printf("\t%s\t(Removed)\n", sent->name);
++ printf("\t%s\t(%s)\t(Removed)\n", sent->name, timestr);
+ break;
+ case -3:
+- printf("\t%s\t(Remote or dead)\n", sent->name);
++ printf("\t%s\t(%s)\t(Remote or dead)\n", sent->name, timestr);
+ break;
+ case -4:
+- printf("\t%s\t(Private)\n", sent->name);
++ printf("\t%s\t(%s)\t(Private)\n", sent->name, timestr);
+ break;
+ }
+ }