pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/misc/screen



Module Name:    pkgsrc
Committed By:   ktnb
Date:           Thu Jan  9 20:07:04 UTC 2025

Modified Files:
        pkgsrc/misc/screen: Makefile PLIST distinfo
        pkgsrc/misc/screen/patches: patch-doc_screen.texinfo patch-socket.c
            patch-window.h
Added Files:
        pkgsrc/misc/screen/patches: patch-Makefile.in patch-doc_screen.1
            patch-etc_etcscreenrc patch-termcap.c patch-utmp-netbsd.c
Removed Files:
        pkgsrc/misc/screen/patches: patch-aa patch-ab patch-ae patch-ai
            patch-aj patch-al patch-am patch-an patch-ao patch-ap
            patch-screen.c patch-tty.sh

Log Message:
screen: update to 5.0.0

- Rewriten autentication mechanism
- Add escape %T to show current tty for window
- Add escape %O to show number of currently open windows
- Use wcwdith() instead of UTF-8 hard-coded tables
  - New commands:
  - auth [on|off]
    Provides password protection
  - status [top|up|down|bottom] [left|right]
    The status window by default is in bottom-left corner
    This command can move status messages to any corner of the screen.
  - truecolor [on|off]
  - multiinput
    Input to multiple windows at the same time
- Removed commands:
  - time
  - debug
  - password
  - maxwin
  - nethack
- Fixes:
  - Screen buffers ESC keypresses indefinitely
  - Crashes after passing through a zmodem transfer
  - Fix double -U issue


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 pkgsrc/misc/screen/Makefile
cvs rdiff -u -r1.14 -r1.15 pkgsrc/misc/screen/PLIST
cvs rdiff -u -r1.64 -r1.65 pkgsrc/misc/screen/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/misc/screen/patches/patch-Makefile.in \
    pkgsrc/misc/screen/patches/patch-doc_screen.1 \
    pkgsrc/misc/screen/patches/patch-etc_etcscreenrc \
    pkgsrc/misc/screen/patches/patch-termcap.c \
    pkgsrc/misc/screen/patches/patch-utmp-netbsd.c
cvs rdiff -u -r1.14 -r0 pkgsrc/misc/screen/patches/patch-aa \
    pkgsrc/misc/screen/patches/patch-ab
cvs rdiff -u -r1.8 -r0 pkgsrc/misc/screen/patches/patch-ae \
    pkgsrc/misc/screen/patches/patch-ai
cvs rdiff -u -r1.11 -r0 pkgsrc/misc/screen/patches/patch-aj
cvs rdiff -u -r1.9 -r0 pkgsrc/misc/screen/patches/patch-al
cvs rdiff -u -r1.2 -r0 pkgsrc/misc/screen/patches/patch-am
cvs rdiff -u -r1.6 -r0 pkgsrc/misc/screen/patches/patch-an \
    pkgsrc/misc/screen/patches/patch-tty.sh
cvs rdiff -u -r1.7 -r0 pkgsrc/misc/screen/patches/patch-ao
cvs rdiff -u -r1.10 -r0 pkgsrc/misc/screen/patches/patch-ap
cvs rdiff -u -r1.3 -r1.4 pkgsrc/misc/screen/patches/patch-doc_screen.texinfo \
    pkgsrc/misc/screen/patches/patch-window.h
cvs rdiff -u -r1.5 -r0 pkgsrc/misc/screen/patches/patch-screen.c
cvs rdiff -u -r1.4 -r1.5 pkgsrc/misc/screen/patches/patch-socket.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/misc/screen/Makefile
diff -u pkgsrc/misc/screen/Makefile:1.123 pkgsrc/misc/screen/Makefile:1.124
--- pkgsrc/misc/screen/Makefile:1.123   Wed Sep  6 16:00:15 2023
+++ pkgsrc/misc/screen/Makefile Thu Jan  9 20:07:03 2025
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.123 2023/09/06 16:00:15 vins Exp $
+# $NetBSD: Makefile,v 1.124 2025/01/09 20:07:03 ktnb Exp $
 
-DISTNAME=      screen-4.9.1
+DISTNAME=      screen-5.0.0
 CATEGORIES=    misc shells
 MASTER_SITES=  ${MASTER_SITE_GNU:=screen/}
 
@@ -20,24 +20,22 @@ EXTRACT_USING=      bsdtar
 
 NOT_FOR_PLATFORM=      Interix-*-* # user auth and username size fixes needed
 
-PLIST_SUBST+=          DISTNAME=${DISTNAME:Q}
+PLIST_SUBST+=          DISTNAME=${DISTNAME}
 
 GNU_CONFIGURE=         yes
-CONFIGURE_ARGS+=       --with-sys-screenrc=${PKG_SYSCONFDIR}/screenrc
+CONFIGURE_ARGS+=       --with-sys_screenrc=${PKG_SYSCONFDIR}/screenrc
 CONFIGURE_ARGS+=       --enable-telnet
-CONFIGURE_ARGS+=       --enable-colors256
 
 PKG_SHELL=             bin/screen
 
-USE_TOOLS+=            automake autoconf autoreconf makeinfo
+USE_TOOLS+=            automake autoconf autoreconf makeinfo gmake
 INFO_FILES=            YES
 
 .include "../../mk/bsd.prefs.mk"
 
 SUBST_CLASSES+=                paths
 SUBST_FILES.paths=     etc/etcscreenrc doc/screen.1
-SUBST_VARS.paths=      PKG_SYSCONFDIR
-SUBST_SED.paths+=      -e 's,@EXAMPLES@,${PREFIX}/share/examples/screen,g'
+SUBST_VARS.paths=      PKG_SYSCONFDIR PREFIX
 SUBST_STAGE.paths=     pre-configure
 
 PLIST_VARS+=           terminfo

Index: pkgsrc/misc/screen/PLIST
diff -u pkgsrc/misc/screen/PLIST:1.14 pkgsrc/misc/screen/PLIST:1.15
--- pkgsrc/misc/screen/PLIST:1.14       Fri Sep 19 13:17:22 2014
+++ pkgsrc/misc/screen/PLIST    Thu Jan  9 20:07:03 2025
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST,v 1.14 2014/09/19 13:17:22 jperkin Exp $
+@comment $NetBSD: PLIST,v 1.15 2025/01/09 20:07:03 ktnb Exp $
 bin/screen
 bin/${DISTNAME}
 info/screen.info
@@ -16,6 +16,7 @@ share/screen/utf8encodings/04
 share/screen/utf8encodings/18
 share/screen/utf8encodings/19
 share/screen/utf8encodings/a1
+share/screen/utf8encodings/a3
 share/screen/utf8encodings/bf
 share/screen/utf8encodings/c2
 share/screen/utf8encodings/c3

Index: pkgsrc/misc/screen/distinfo
diff -u pkgsrc/misc/screen/distinfo:1.64 pkgsrc/misc/screen/distinfo:1.65
--- pkgsrc/misc/screen/distinfo:1.64    Wed Sep  6 16:00:15 2023
+++ pkgsrc/misc/screen/distinfo Thu Jan  9 20:07:03 2025
@@ -1,20 +1,13 @@
-$NetBSD: distinfo,v 1.64 2023/09/06 16:00:15 vins Exp $
+$NetBSD: distinfo,v 1.65 2025/01/09 20:07:03 ktnb Exp $
 
-BLAKE2s (screen-4.9.1.tar.gz) = 5632587a76908410b4b1af70c729e01521970c72693fa78ec9b62d907fefbc8c
-SHA512 (screen-4.9.1.tar.gz) = 1f278313528815f4246bb162ced611c5d77321d11055e8d853168dc804c75d5f78568056a23e46db0640e1605e5cad4a5ce05e95e50cf02bb322cb6f57e5a126
-Size (screen-4.9.1.tar.gz) = 1040785 bytes
-SHA1 (patch-aa) = ea0c43e54d8764e4896f45677eb0a6070bd7b54b
-SHA1 (patch-ab) = 36474dfd780c0d0188eda998fb2d936fa4893b9c
-SHA1 (patch-ae) = c952a7e52df0f33c2853c348e89650009c0d8696
-SHA1 (patch-ai) = edefc44e47066dc89bda22a94d417511f46f0190
-SHA1 (patch-aj) = 1260f55afb98536d0da081fbd95fafa9b5b513f7
-SHA1 (patch-al) = ef32a642ddb12f0bf13149c406f4dde7926ae678
-SHA1 (patch-am) = a721e311e7dde7938de0e9546a7892bfd104ebd1
-SHA1 (patch-an) = bda6c65148410a6c9a13afd8ad34f93e33731552
-SHA1 (patch-ao) = a45ae3186cd9bddeb915bad890f1be5abc315dd3
-SHA1 (patch-ap) = 4aab542045a0abe55e82d91851b94c3cb569139f
-SHA1 (patch-doc_screen.texinfo) = 18d959580fd03731c7e7dbc683970f80b4245840
-SHA1 (patch-screen.c) = de5d8468100ab88cbdb842e21b04b00221e798b8
-SHA1 (patch-socket.c) = 290a6a1113a9100bea0748406374ec3d835f5ba7
-SHA1 (patch-tty.sh) = 6a818b7a4d70e55878ee69605e53300eabcb525f
-SHA1 (patch-window.h) = 84dc5a2c24ff77147b416c05f897536c0cfddf31
+BLAKE2s (screen-5.0.0.tar.gz) = b2d41befdfd7b641bddef5d1eb4a919bcb76f971e79a145ea4a2e3ba55db28d1
+SHA512 (screen-5.0.0.tar.gz) = 18a163313025c58950ec65fa83037ba1df0fa8e2346925593217fb0a6596f2f51914a4f0aec7f0e1c280d3d3ef964e7a886521f41f4b96f4ff08935be7f62117
+Size (screen-5.0.0.tar.gz) = 895882 bytes
+SHA1 (patch-Makefile.in) = c2cc82b4f3b3968053d5e778ad39cf02217807e3
+SHA1 (patch-doc_screen.1) = 858df8ed65c8fa8044075f4066832f79ba77b3a2
+SHA1 (patch-doc_screen.texinfo) = e35f936f307fc6162824c3090221745ba38f6aba
+SHA1 (patch-etc_etcscreenrc) = a45ae3186cd9bddeb915bad890f1be5abc315dd3
+SHA1 (patch-socket.c) = 4f14a790a0d5048b6638457ad42a63df004d04b7
+SHA1 (patch-termcap.c) = f06432d06405daac0064296d2cfa3246a2621e4f
+SHA1 (patch-utmp-netbsd.c) = a721e311e7dde7938de0e9546a7892bfd104ebd1
+SHA1 (patch-window.h) = b0fe8f7105a906c6d9a8908ade8d34e5f7da0dd1

Index: pkgsrc/misc/screen/patches/patch-doc_screen.texinfo
diff -u pkgsrc/misc/screen/patches/patch-doc_screen.texinfo:1.3 pkgsrc/misc/screen/patches/patch-doc_screen.texinfo:1.4
--- pkgsrc/misc/screen/patches/patch-doc_screen.texinfo:1.3     Wed Sep  6 16:00:15 2023
+++ pkgsrc/misc/screen/patches/patch-doc_screen.texinfo Thu Jan  9 20:07:03 2025
@@ -1,10 +1,10 @@
-$NetBSD: patch-doc_screen.texinfo,v 1.3 2023/09/06 16:00:15 vins Exp $
+$NetBSD: patch-doc_screen.texinfo,v 1.4 2025/01/09 20:07:03 ktnb Exp $
 
 Fix: Node `Window Settings' lacks menu item for `Mousetrack'
 
---- doc/screen.texinfo.orig    2023-08-16 00:29:26.000000000 +0000
+--- doc/screen.texinfo.orig    2024-08-28 19:55:03.000000000 +0000
 +++ doc/screen.texinfo
-@@ -2414,6 +2414,7 @@ terminal emulation itself.
+@@ -2417,6 +2417,7 @@ terminal emulation itself.
  * Login::                       Control @file{/etc/utmp} logging
  * Mode::                        Control the file mode of the pty
  * Monitor::                     Watch for activity or inactivity in a window
@@ -12,3 +12,56 @@ Fix: Node `Window Settings' lacks menu i
  * Windows::                   List the active windows
  * Hardstatus::                        Set a window's hardstatus line
  @end menu
+@@ -5248,7 +5249,7 @@ Exchanges windows positions on window li
+ Changes windows numbers, so there is no gaps between them.
+ @end deffn
+ 
+-@node License, Collapse, Miscellaneous
++@node License, Nonblock, Collapse, Miscellaneous
+ @section License
+ @kindex ,
+ @deffn Command license
+@@ -5257,7 +5258,7 @@ Display the disclaimer page. This is don
+ started without options, which should be often enough.
+ @end deffn
+ 
+-@node Nonblock, Number, Miscellaneous
++@node Nonblock, Number, License, Miscellaneous
+ @section Nonblock
+ @deffn Command nonblock [@var{state}|@var{numsecs}]
+ Tell screen how to deal with user interfaces (displays) that cease to
+@@ -5277,7 +5278,7 @@ Same as the @code{nonblock} command exce
+ displays is changed. Initial setting is @code{off}.
+ @end deffn
+ 
+-@node Number, Nonblock, Miscellaneous
++@node Number, Verbose, Nonblock, Miscellaneous
+ @section Number
+ @kindex N
+ @deffn Command number [[+|-]@var{n}]
+@@ -5289,7 +5290,7 @@ plus (`+') or minus (`-') will change th
+ amount specified.
+ @end deffn
+ 
+-@node Verbose, Version, Miscellaneous
++@node Verbose, Version, Number, Miscellaneous
+ @section Verbose
+ @deffn Command verbose [on|off]
+ If verbose is switched on, the command name is echoed, whenever a window
+@@ -5412,14 +5413,14 @@ The default is @code{on}, of course. Thi
+ only in rare circumstances.
+ @end deffn
+ 
+-@node Eval, , Setsid, Miscellaneous
++@node Eval, Backtick, Setsid, Miscellaneous
+ @section Eval
+ @deffn Command eval @var{command1} [@var{command2} ...]
+ (none)@*
+ Parses and executes each argument as separate command.
+ @end deffn
+ 
+-@node Backtick, Screen Saver, , Miscellaneous
++@node Backtick, Screen Saver, Eval, Miscellaneous
+ @section Backtick
+ @deffn Command backtick @var{id} @var{lifespan} @var{autorefresh} @var{command} [@var{args}]
+ @deffnx Command backtick @var{id}
Index: pkgsrc/misc/screen/patches/patch-window.h
diff -u pkgsrc/misc/screen/patches/patch-window.h:1.3 pkgsrc/misc/screen/patches/patch-window.h:1.4
--- pkgsrc/misc/screen/patches/patch-window.h:1.3       Fri Feb 12 22:53:14 2021
+++ pkgsrc/misc/screen/patches/patch-window.h   Thu Jan  9 20:07:04 2025
@@ -1,17 +1,16 @@
-$NetBSD: patch-window.h,v 1.3 2021/02/12 22:53:14 cjep Exp $
+$NetBSD: patch-window.h,v 1.4 2025/01/09 20:07:04 ktnb Exp $
 
 OpenBSD grumbles without the socket definitions
 
---- window.h.orig      Wed Feb  5 20:09:38 2020
-+++ window.h   Thu Feb 11 21:27:43 2021
-@@ -33,6 +33,10 @@
+--- window.h.orig      2025-01-09 02:59:07.553319622 +0000
++++ window.h
+@@ -33,6 +33,9 @@
  #ifndef SCREEN_WINDOW_H
  #define SCREEN_WINDOW_H
  
 +#ifdef __OpenBSD__
 +#include <sys/socket.h>
 +#endif
-+
- /* keep this in sync with the initialisations in window.c */
- struct NewWindow
- {
+ #include "config.h"
+ 
+ #include "sched.h"

Index: pkgsrc/misc/screen/patches/patch-socket.c
diff -u pkgsrc/misc/screen/patches/patch-socket.c:1.4 pkgsrc/misc/screen/patches/patch-socket.c:1.5
--- pkgsrc/misc/screen/patches/patch-socket.c:1.4       Wed Sep  6 16:00:15 2023
+++ pkgsrc/misc/screen/patches/patch-socket.c   Thu Jan  9 20:07:04 2025
@@ -1,17 +1,16 @@
-$NetBSD: patch-socket.c,v 1.4 2023/09/06 16:00:15 vins Exp $
+$NetBSD: patch-socket.c,v 1.5 2025/01/09 20:07:04 ktnb Exp $
 
 Include <uio.h> for iovec. 
 
---- socket.c.orig      2017-07-10 19:26:25.000000000 +0000
-+++ socket.c   2017-07-18 22:35:40.000000000 +0000
-@@ -34,9 +34,7 @@
+--- socket.c.orig      2025-01-09 02:58:51.269455114 +0000
++++ socket.c
+@@ -35,9 +35,7 @@
  #include <sys/stat.h>
  #include <fcntl.h>
- # include <sys/socket.h>
--# ifdef _OpenBSD_
--#  include <sys/uio.h>
--# endif
-+# include <sys/uio.h>
- # include <sys/un.h>
- 
- #ifndef SIGINT
+ #include <sys/socket.h>
+-#ifdef _OpenBSD_
+ #include <sys/uio.h>
+-#endif
+ #include <sys/un.h>
+ #include <utime.h>
+ #include <stdint.h>

Added files:

Index: pkgsrc/misc/screen/patches/patch-Makefile.in
diff -u /dev/null pkgsrc/misc/screen/patches/patch-Makefile.in:1.1
--- /dev/null   Thu Jan  9 20:07:04 2025
+++ pkgsrc/misc/screen/patches/patch-Makefile.in        Thu Jan  9 20:07:03 2025
@@ -0,0 +1,21 @@
+$NetBSD: patch-Makefile.in,v 1.1 2025/01/09 20:07:03 ktnb Exp $
+
+Remove GNU Make conditional.  @ETCSCREENRC@ appears to get
+replaced always. If it doesn't in some cases, please fix
+configure.ac instead (and regen patch for configure as well).
+
+Add utmp-netbsd.c (created in patch-am) and utmp-netbsd.o.
+Setting the setuid bit is handled by the package Makefile.
+Don't try to leave "screen.old" behind on install.
+
+--- Makefile.in.orig   2025-01-09 19:50:00.054935679 +0000
++++ Makefile.in
+@@ -54,7 +54,7 @@ CFILES=      screen.c \
+       layout.c list_display.c list_generic.c list_license.o list_window.c logfile.c mark.c \
+       misc.c process.c pty.c resize.c sched.c search.c socket.c telnet.c \
+       term.c termcap.c tty.c utmp.c viewport.c window.c winmsg.c \
+-      winmsgbuf.c winmsgcond.c
++      winmsgbuf.c winmsgcond.c utmp-netbsd.c
+ OFILES=$(CFILES:c=o)
+ 
+ TESTCFILES := $(wildcard tests/test-*.c)
Index: pkgsrc/misc/screen/patches/patch-doc_screen.1
diff -u /dev/null pkgsrc/misc/screen/patches/patch-doc_screen.1:1.1
--- /dev/null   Thu Jan  9 20:07:04 2025
+++ pkgsrc/misc/screen/patches/patch-doc_screen.1       Thu Jan  9 20:07:03 2025
@@ -0,0 +1,48 @@
+$NetBSD: patch-doc_screen.1,v 1.1 2025/01/09 20:07:03 ktnb Exp $
+
+Update the man page with pkgsrc paths
+
+--- doc/screen.1.orig  2025-01-09 02:42:26.792251218 +0000
++++ doc/screen.1
+@@ -767,7 +767,7 @@ _
+ 
+ .SH CUSTOMIZATION
+ The \*Qsocket directory\*U defaults either to $HOME/.screen or simply to
+-/tmp/screens or preferably to /usr/local/screens chosen at compile-time. If
++/tmp/screens. This is chosen at compile-time. If
+ .I screen
+ is installed setuid-root, then the administrator
+ should compile
+@@ -780,7 +780,7 @@ in the environment variable $SCREENDIR.
+ When
+ .I screen
+ is invoked, it executes initialization commands from the files
+-\*Q/usr/local/etc/screenrc\*U and
++\*Q@PKG_SYSCONFDIR@/screenrc\*U and
+ \*Q.screenrc\*U in the user's home directory. These are the \*Qprogrammer's
+ defaults\*U that can be overridden in the following ways: for the
+ global screenrc file 
+@@ -5194,12 +5194,12 @@ Examples in the 
+ .I screen
+ distribution package for private and global initialization files.
+ .IP $SYSSCREENRC
+-.IP /usr/local/etc/screenrc
++.IP @PKG_SYSCONFDIR@/screenrc
+ .I screen
+ initialization commands
+ .IP $SCREENRC
+ .IP $HOME/.screenrc
+-Read in after /usr/local/etc/screenrc
++Read in after @PKG_SYSCONFDIR@/screenrc
+ .IP $SCREENDIR/S\-<login>
+ .IP $HOME/.screen
+ Socket directories (default)
+@@ -5216,7 +5216,7 @@ or
+ Screen images created by the hardcopy function
+ .IP screenlog.[0-9]
+ Output log files created by the log function
+-.IP /usr/lib/terminfo/?/*
++.IP @PREFIX@/lib/terminfo/?/*
+ or
+ .IP /etc/termcap
+ Terminal capability databases
Index: pkgsrc/misc/screen/patches/patch-etc_etcscreenrc
diff -u /dev/null pkgsrc/misc/screen/patches/patch-etc_etcscreenrc:1.1
--- /dev/null   Thu Jan  9 20:07:04 2025
+++ pkgsrc/misc/screen/patches/patch-etc_etcscreenrc    Thu Jan  9 20:07:03 2025
@@ -0,0 +1,14 @@
+$NetBSD: patch-etc_etcscreenrc,v 1.1 2025/01/09 20:07:03 ktnb Exp $
+
+Replace configurable paths with tags.
+
+--- etc/etcscreenrc.orig       2015-09-05 19:28:22.000000000 +0000
++++ etc/etcscreenrc
+@@ -1,6 +1,6 @@
+ #
+ # This is an example for the global screenrc file.
+-# You may want to install this file as /usr/local/etc/screenrc.
++# You may want to install this file as @PKG_SYSCONFDIR@/screenrc.
+ # Check config.h for the exact location.
+ #
+ # Flaws of termcap and standard settings are done here.
Index: pkgsrc/misc/screen/patches/patch-termcap.c
diff -u /dev/null pkgsrc/misc/screen/patches/patch-termcap.c:1.1
--- /dev/null   Thu Jan  9 20:07:04 2025
+++ pkgsrc/misc/screen/patches/patch-termcap.c  Thu Jan  9 20:07:04 2025
@@ -0,0 +1,18 @@
+$NetBSD: patch-termcap.c,v 1.1 2025/01/09 20:07:04 ktnb Exp $
+
+Don't pollute G1 to allow 8-bit encondings.
+
+The original code made the TERMCAP env var longer than 1023 bytes,
+which causes problems.  This is a quick hack but works with our termcap.
+
+--- termcap.c.orig     2025-01-09 02:57:57.777207358 +0000
++++ termcap.c
+@@ -65,7 +65,7 @@ char *extra_incap, *extra_outcap;
+ static const char TermcapConst[] = "DO=\\E[%dB:LE=\\E[%dD:RI=\\E[%dC:\
+ UP=\\E[%dA:bs:bt=\\E[Z:cd=\\E[J:ce=\\E[K:cl=\\E[H\\E[J:cm=\\E[%i%d;%dH:\
+ ct=\\E[3g:do=^J:nd=\\E[C:pt:rc=\\E8:rs=\\Ec:sc=\\E7:st=\\EH:up=\\EM:\
+-le=^H:bl=^G:cr=^M:it#8:ho=\\E[H:nw=\\EE:ta=^I:is=\\E)0:";
++le=^H:bl=^G:cr=^M:it#8:ho=\\E[H:nw=\\EE:ta=^I:is=\\E(B:";
+ 
+ char *gettermcapstring(char *s)
+ {
Index: pkgsrc/misc/screen/patches/patch-utmp-netbsd.c
diff -u /dev/null pkgsrc/misc/screen/patches/patch-utmp-netbsd.c:1.1
--- /dev/null   Thu Jan  9 20:07:04 2025
+++ pkgsrc/misc/screen/patches/patch-utmp-netbsd.c      Thu Jan  9 20:07:04 2025
@@ -0,0 +1,88 @@
+$NetBSD: patch-utmp-netbsd.c,v 1.1 2025/01/09 20:07:04 ktnb 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 <sys/param.h>
++#if defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 106050000)
++
++#include <sys/types.h>
++#include <sys/time.h>
++#include <sys/wait.h>
++
++#include <errno.h>
++#include <fcntl.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#include <time.h>
++#include <ttyent.h>
++#include <unistd.h>
++#include <util.h>
++#include <utmp.h>
++
++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



Home | Main Index | Thread Index | Old Index