head 1.1; access; symbols pkgsrc-2026Q1:1.1.0.10 pkgsrc-2026Q1-base:1.1 pkgsrc-2025Q4:1.1.0.8 pkgsrc-2025Q4-base:1.1 pkgsrc-2025Q3:1.1.0.6 pkgsrc-2025Q3-base:1.1 pkgsrc-2025Q2:1.1.0.4 pkgsrc-2025Q2-base:1.1 pkgsrc-2025Q1:1.1.0.2 pkgsrc-2025Q1-base:1.1; locks; strict; comment @# @; 1.1 date 2025.02.07.03.15.06; author ryoon; state Exp; branches; next ; commitid AmF1up5wywoP9uIF; desc @@ 1.1 log @misc/screen4: import screen-4.9.1 Screen is a full-screen window manager that multiplexes a physical terminal between several processes (typically interactive shells). Each virtual terminal provides the functions of a DEC VT100 terminal and, in addition, several control functions from the ANSI X3.64 (ISO 6429) and ISO 2022 standards (e.g. insert/delete line and support for multiple character sets). There is a scrollback history buffer for each virtual terminal and a copy-and-paste mechanism that allows moving text regions between windows. misc/screen-5.0.0 does not work under xterm. Reversed strings are not displayed properly at least. Import working GNU screen 4 as misc/screen4. And screen-5.0.0 does not have codes for older platforms. @ text @$NetBSD: patch-al,v 1.9 2023/09/06 16:00:15 vins Exp $ Make extra calls to remove utmp entries when utmpx is used. For non-login entries we only update utmpx, as it stores more information, and utilities are reading both. Do not truncate hostnames that have two colons (:) as they are likely IPv6 addresses. Wrap them in brackets ([]) unless already wrapped (e.g. from $DISPLAY). --- utmp.c.orig 2023-08-16 00:29:26.000000000 +0000 +++ utmp.c @@@@ -48,6 +48,12 @@@@ extern char *LoginName; extern int real_uid, eff_uid; +#ifdef NetBSD_UTMP +extern void utmp_login __P((char *)); +extern void utmp_logout __P((char *)); +#endif + + /* * UTNOKEEP: A (ugly) hack for apollo that does two things: * 1) Always close and reopen the utmp file descriptor. (I don't know @@@@ -315,6 +321,9 @@@@ RemoveLoginSlot() ASSERT(display); debug("RemoveLoginSlot: removing your logintty\n"); +#ifdef NetBSD_UTMP + utmp_logout(stripdev(D_usertty)); +#endif D_loginslot = TtyNameSlot(D_usertty); if (D_loginslot == (slot_t)0 || D_loginslot == (slot_t)-1) return; @@@@ -379,6 +388,9 @@@@ RestoreLoginSlot() debug("RestoreLoginSlot()\n"); ASSERT(display); +#ifdef NetBSD_UTMP + utmp_login(stripdev(D_usertty)); +#endif if (utmpok && D_loginslot != (slot_t)0 && D_loginslot != (slot_t)-1) { debug1(" logging you in again (slot %#lx)\n", (long)D_loginslot); @@@@ -410,7 +422,7 @@@@ struct win *wi; struct utmp u; int saved_ut; #ifdef UTHOST - char *p; + char *m, *p; char host[sizeof(D_loginhost) + 15]; #else char *host = 0; @@@@ -449,12 +461,37 @@@@ struct win *wi; * "faui45.informati"......:s.0 * HPUX uses host:0.0, so chop at "." and ":" (Eric Backus) */ - for (p = host; *p; p++) - if ((*p < '0' || *p > '9') && (*p != '.')) + for (m = p = host; *p; p++) + if (*p == ':') break; + if (*p == ':') + for (m = p + 1; *m; m++) + if (*m == ':') + { + if (host[0] != '[') + { + strncpy(host + 1, D_loginhost, sizeof(host) - 15 - 2); + host[0] = '['; + p = host + strlen(host); + *p++ = ']'; + } + break; + } + else + for (p = host; *p; p++) + if ((*p < '0' || *p > '9') && (*p != '.')) + break; if (*p) { - for (p = host; *p; p++) + p = host; + if (host[0] == '[') + for (; *p; p++) + if (*p == ']') + { + p++; + break; + } + for (; *p; p++) if (*p == '.' || (*p == ':' && p != host)) { *p = '\0'; @