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-am,v 1.2 2015/02/13 04:44:40 rodent Exp $ Code to handle the login slot in utmp when utmpx is available. Daemons shipped with NetBSD tend to write to both, while 3rd party software might write to only one. --- utmp-netbsd.c.orig 2015-02-13 04:30:05.000000000 +0000 +++ utmp-netbsd.c @@@@ -0,0 +1,79 @@@@ +#include +#if defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 106050000) + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static struct utmp saved_utmp; +static int saved_utmp_ok = 0; + +int +lineslot(line) +char *line; +{ + int slot; + struct ttyent *ttyp; + + setttyent(); + for (slot = 1; (ttyp = getttyent()) != NULL; ++slot) + if (!strcmp(ttyp->ty_name, line)) { + endttyent(); + return(slot); + } + endttyent(); + return(0); +} + +void +utmp_login(line) +char *line; +{ + int fd; + int tty; + + if (!saved_utmp_ok) + return; + + tty = lineslot(line); + if (tty > 0 && (fd = open(_PATH_UTMP, O_WRONLY|O_CREAT, 0644)) >= 0) { + (void)lseek(fd, (off_t)(tty * sizeof(struct utmp)), SEEK_SET); + (void)write(fd, &saved_utmp, sizeof(struct utmp)); + (void)close(fd); + } +} + +void +utmp_logout(const char *line) +{ + int fd; + struct utmp ut; + + if ((fd = open(_PATH_UTMP, O_RDWR, 0)) < 0) + return; + while (read(fd, &ut, sizeof(ut)) == sizeof(ut)) { + if (!ut.ut_name[0] || strncmp(ut.ut_line, line, UT_LINESIZE)) + continue; + memcpy(&saved_utmp, &ut, sizeof(ut)); + saved_utmp_ok = 1; + memset(ut.ut_name, 0, UT_NAMESIZE); + memset(ut.ut_host, 0, UT_HOSTSIZE); + (void)time(&ut.ut_time); + (void)lseek(fd, -(off_t)sizeof(ut), SEEK_CUR); + (void)write(fd, &ut, sizeof(ut)); + } + (void)close(fd); +} + +#endif @