From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 91AB91F47C for ; Sat, 21 Jan 2023 20:20:01 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=clisp.org header.i=@clisp.org header.a=rsa-sha256 header.s=strato-dkim-0002 header.b=osUBFBA8; dkim-atps=neutral Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJKLC-0006cm-Ia; Sat, 21 Jan 2023 15:19:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pJKLB-0006ca-4W for bug-gnulib@gnu.org; Sat, 21 Jan 2023 15:19:53 -0500 Received: from mo4-p00-ob.smtp.rzone.de ([85.215.255.25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pJKL7-0003zf-Eh for bug-gnulib@gnu.org; Sat, 21 Jan 2023 15:19:52 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1674332386; cv=none; d=strato.com; s=strato-dkim-0002; b=ggjLwKD3u20nNo6+FXA1yuP4+YYLY/0PnPDnVAEOZxi5SXOEW8sSK9AQ12E+/SElZf 4u/4lIzzkOyhsP8A2xvn47+QkhfKYnhLjMZzlx/Qv1RjGuz02PDYXF7ZYBjd6g9FNUgP A2B4SUWIAV3vmb3tBWsVqhZ2dMc5Pt3EdvalggVeT9uguvmoZ9gSKFtDWgbVq9uJge7w wD6bb9p95NN7AYDyMth5Ag5Dvd6dlzD+GPZQoSV1m2p7RhCsFxhSb8orS+DkHjv+FeMT 0mcHBIW0kNOjyFJo/lKpb9aBmCSk/PzZPmFJI/UO1YUNE1ejENqN//HleakgYL9TTXAf bRbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1674332386; s=strato-dkim-0002; d=strato.com; h=Message-ID:Date:Subject:To:From:Cc:Date:From:Subject:Sender; bh=fOoBz1gUimVPlGbEQu9QZHJPGsHNcSfT7IXIcVQ5dcE=; b=mSNzbQKBXQ1ihjTQpGJ4hVYCUk9dNQYSM+PJb1+hhX/U80kaHNF28Gh4uMRrfbp1fR vRFqxFXxSp8042hS6L2gt0bKgrGMOosRbQhOU/LGvhYOgfkf7Nd/8A5/3ZWSQoE/+lzF HnIGHiy8CT/U2BKbGjlwBDa4gvuEssIEoozYuNF+dDkwgxzSeB3g12HOt7xIxfUuiMyV IsmTy6L5M1d5/fz7Thz5snuEdsDycJqCzi53Hq5Plrtm9BhqNXy9ImZbd4hgINfojQxT n89pkkUH+27g+qmixeY2/By5Yp3sTnzy2h5Kgz2pMnBTvR0IZBICLGrm1BsNxzMi7P1V ff5g== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1674332386; s=strato-dkim-0002; d=clisp.org; h=Message-ID:Date:Subject:To:From:Cc:Date:From:Subject:Sender; bh=fOoBz1gUimVPlGbEQu9QZHJPGsHNcSfT7IXIcVQ5dcE=; b=osUBFBA80Qoj2+AisaS1L62GIV/40sVGiMpVFZwW3Q/eRuDCRYejLwUkBzP6Pv1SJP /cOgeWrx21rfWXl4Ljt6hn0Wc1hHiNP19ZRlkP/95i9MfZVxPk/IHvATy+5C6SMRzZN2 jeV9Z8BvOGYbcbKbo/amEzDO1/cxzryTyZwlaaWOeMSd3HyyDk0tTBB6aRwCBVkEA6wN vsQcXeVKDvJ2dJpltAPwI4qn3Ekp127ci5k364ypvgvvTfSDd6EVvfnG4Qu+RGAFbW7V Sc2O3f+FIkJmo0oKDE5ZHIXnsyTWGk2wgKmPUW7B4Bflt6euwT0VghcWX2rm/VUqS4+6 SkHA== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH0WWb0LN8XZoH94zq68+3cfpPC2aS1bIwRG2tcswHQhJjAoX9mAQ==" Received: from nimes.localnet by smtp.strato.de (RZmta 49.1.0 AUTH) with ESMTPSA id w8066ez0LKJj8RR (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Sat, 21 Jan 2023 21:19:45 +0100 (CET) From: Bruno Haible To: bug-gnulib@gnu.org Subject: login_tty: Ensure declaration in Date: Sat, 21 Jan 2023 21:19:45 +0100 Message-ID: <2163753.nneeDZaL83@nimes> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Received-SPF: none client-ip=85.215.255.25; envelope-from=bruno@clisp.org; helo=mo4-p00-ob.smtp.rzone.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org The login_tty module does not provide the function's declaration in a consistent way. The simple recipe Include: extern int login_tty (int); breaks down as soon as Gnulib may want to override the login_tty function. Which we'll want to do soon on Android. What Gnulib should do is to provide the declaration in the same header file as glibc, that is, in . For this, it is irrelevant that is not standardized POSIX, and it is also irrelevant that BSD systems have the declaration in or . This patch does it. In particular, it adds a module 'utmp' (for ), as well as utmp-tests and utmp-c++-tests. 2023-01-21 Bruno Haible login_tty: Ensure declaration in . * tests/test-utmp-c++.cc: New file. * modules/utmp-c++-tests: New file. * tests/test-utmp.c: New file. * modules/utmp-tests: New file. * lib/login_tty.c: Include . * m4/login_tty.m4: New file. (gl_FUNC_LOGIN_TTY): Moved here from m4/pty.m4. Set HAVE_LOGIN_TTY. * m4/pty.m4 (gl_FUNC_LOGIN_TTY): Moved to m4/login_tty.m4. * modules/login_tty (Files): Add m4/login_tty.m4. (Depends-on): Add utmp. Remove pty. Update condition. (configure.ac): Update condition. Invoke gl_UTMP_MODULE_INDICATOR instead of gl_PTY_MODULE_INDICATOR. (Include): List . * doc/glibc-functions/login_tty.texi: Mark the include file diversity as fixed. * tests/test-login_tty.c: Include . Don't declare login_tty here. * lib/utmp.in.h: New file. * m4/utmp_h.m4: New file. * modules/utmp: New file. * doc/glibc-headers/utmp.texi: New file. * doc/gnulib.texi (Glibc Header File Substitutes): Include it. diff --git a/doc/glibc-functions/login_tty.texi b/doc/glibc-functions/login_tty.texi index b1adf8cd0b..3e743b1527 100644 --- a/doc/glibc-functions/login_tty.texi +++ b/doc/glibc-functions/login_tty.texi @@ -23,6 +23,13 @@ Portability problems fixed by Gnulib: This function is missing on some platforms: Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 11.3, Android 5.1. @item +This function is declared in @code{} on glibc, Cygwin, Android, +in @code{} on macOS 11.1, NetBSD 5.0, OpenBSD 3.8, +and in @code{} on FreeBSD 13.0, Haiku. +@c Also note that @code{} is +@c a prerequisite of @code{} on FreeBSD 8.0, OpenBSD 4.6 and +@c of @code{} on FreeBSD 8.0. +@item This function requires linking with @code{-lutil} on some platforms: glibc 2.3.6, FreeBSD 13.0, NetBSD 5.0, OpenBSD 3.8. It is available without link options on other platforms: @@ -34,11 +41,4 @@ Portability problems not fixed by Gnulib: @item This function is missing on some platforms: mingw, MSVC 14. -@item -This function is declared in @code{} on glibc, Cygwin, -in @code{} on macOS 11.1, NetBSD 5.0, OpenBSD 3.8, -and in @code{} on FreeBSD 13.0, Haiku. -Also note that @code{} is -a prerequisite of @code{} on FreeBSD 8.0, OpenBSD 4.6 and -of @code{} on FreeBSD 8.0. @end itemize diff --git a/doc/glibc-headers/utmp.texi b/doc/glibc-headers/utmp.texi new file mode 100644 index 0000000000..d7d1091e14 --- /dev/null +++ b/doc/glibc-headers/utmp.texi @@ -0,0 +1,34 @@ +@node utmp.h +@section @file{utmp.h} + +Defines functions for login and logout (to a tty session) and for examining the +history of logins and logouts. + +Documentation: +@itemize +@item +@ifinfo +@ref{Manipulating the Database,,Manipulating the User Accounting Database,libc}, +@end ifinfo +@ifnotinfo +@url{https://www.gnu.org/software/libc/manual/html_node/Manipulating-the-Database.html}, +@end ifnotinfo +@item +@uref{https://www.kernel.org/doc/man-pages/online/pages/man5/utmp.5.html,,man utmp}. +@end itemize + +Gnulib module: utmp + +Portability problems fixed by Gnulib: +@itemize +@item +This header file is missing on some platforms: +FreeBSD 13.0, mingw, MSVC 14. +@item +@code{} is a prerequisite of @code{} on some platforms: +FreeBSD 8.0, OpenBSD 7.2. +@end itemize + +Portability problems not fixed by Gnulib: +@itemize +@end itemize diff --git a/doc/gnulib.texi b/doc/gnulib.texi index 7388fb0b45..e9a4ace67f 100644 --- a/doc/gnulib.texi +++ b/doc/gnulib.texi @@ -3845,6 +3845,7 @@ not worked around by Gnulib. * sys/random.h:: * sysexits.h:: * ttyent.h:: +* utmp.h:: @end menu @include glibc-headers/a.out.texi @@ -3883,6 +3884,7 @@ not worked around by Gnulib. @include glibc-headers/sys_random.texi @include glibc-headers/sysexits.texi @include glibc-headers/ttyent.texi +@include glibc-headers/utmp.texi @node Glibc Function Substitutes @chapter Glibc Function Substitutes diff --git a/lib/login_tty.c b/lib/login_tty.c index fb20195b5f..4b291362a3 100644 --- a/lib/login_tty.c +++ b/lib/login_tty.c @@ -17,7 +17,8 @@ #include -/* Currently no specification header. */ +/* Specification. */ +#include #include #include diff --git a/lib/utmp.in.h b/lib/utmp.in.h new file mode 100644 index 0000000000..58318e7ffb --- /dev/null +++ b/lib/utmp.in.h @@ -0,0 +1,76 @@ +/* A GNU-like . + + Copyright (C) 2023 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +#ifndef _@GUARD_PREFIX@_UTMP_H + +#include + +/* The include_next requires a split double-inclusion guard. */ +#if @HAVE_UTMP_H@ +# @INCLUDE_NEXT@ @NEXT_UTMP_H@ +#endif + +#ifndef _@GUARD_PREFIX@_UTMP_H +#define _@GUARD_PREFIX@_UTMP_H + +/* FreeBSD, NetBSD, OpenBSD, macOS, Minix, Haiku declare login_tty in + or , not in . */ +/* But in any case avoid namespace pollution on glibc systems. */ +#if (@GNULIB_LOGIN_TTY@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ +# if HAVE_UTIL_H /* macOS, NetBSD, OpenBSD, Minix */ +# include +# elif HAVE_LIBUTIL_H /* FreeBSD, Haiku */ +# include +# endif +#endif + +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ + + +#if @GNULIB_LOGIN_TTY@ +# if @REPLACE_LOGIN_TTY@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef login_tty +# define login_tty rpl_login_tty +# endif +_GL_FUNCDECL_RPL (login_tty, int, (int fd)); +_GL_CXXALIAS_RPL (login_tty, int, (int fd)); +# else +# if !@HAVE_LOGIN_TTY@ +_GL_FUNCDECL_SYS (login_tty, int, (int fd)); +# endif +_GL_CXXALIAS_SYS (login_tty, int, (int fd)); +# endif +_GL_CXXALIASWARN (login_tty); +#elif defined GNULIB_POSIXCHECK +# undef login_tty +# if HAVE_RAW_DECL_LOGIN_TTY +_GL_WARN_ON_USE (login_tty, "login_tty is unportable - " + "use gnulib module login_tty for portability"); +# endif +#endif + + +#endif /* _@GUARD_PREFIX@_UTMP_H */ +#endif /* _@GUARD_PREFIX@_UTMP_H */ diff --git a/m4/login_tty.m4 b/m4/login_tty.m4 new file mode 100644 index 0000000000..0d504050f1 --- /dev/null +++ b/m4/login_tty.m4 @@ -0,0 +1,30 @@ +# login_tty.m4 serial 1 +dnl Copyright (C) 2010-2023 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_LOGIN_TTY], +[ + AC_REQUIRE([gl_PTY_LIB]) + + AC_CHECK_HEADERS_ONCE([utmp.h util.h libutil.h]) + gl_saved_libs="$LIBS" + LIBS="$LIBS $PTY_LIB" + gl_CHECK_FUNCS_ANDROID([login_tty], [[ + #include + #if HAVE_UTMP_H + # include + #endif + #if HAVE_UTIL_H + # include + #elif HAVE_LIBUTIL_H + # include + #endif + ]]) + LIBS="$gl_saved_LIBS" + + if test $ac_cv_func_login_tty = no; then + HAVE_LOGIN_TTY=0 + fi +]) diff --git a/m4/pty.m4 b/m4/pty.m4 index f6b5bb3115..ccf2ba8b1b 100644 --- a/m4/pty.m4 +++ b/m4/pty.m4 @@ -1,4 +1,4 @@ -# pty.m4 serial 17 +# pty.m4 serial 18 dnl Copyright (C) 2010-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -149,24 +149,3 @@ AC_DEFUN([gl_FUNC_OPENPTY], gl_CHECK_FUNCS_ANDROID([posix_openpt], [[#include ]]) fi ]) - -AC_DEFUN([gl_FUNC_LOGIN_TTY], -[ - AC_REQUIRE([gl_PTY_LIB]) - - AC_CHECK_HEADERS_ONCE([utmp.h util.h libutil.h]) - gl_saved_libs="$LIBS" - LIBS="$LIBS $PTY_LIB" - gl_CHECK_FUNCS_ANDROID([login_tty], [[ - #include - #if HAVE_UTMP_H - # include - #endif - #if HAVE_UTIL_H - # include - #elif HAVE_LIBUTIL_H - # include - #endif - ]]) - LIBS="$gl_saved_LIBS" -]) diff --git a/m4/utmp_h.m4 b/m4/utmp_h.m4 new file mode 100644 index 0000000000..fff6dbdfe7 --- /dev/null +++ b/m4/utmp_h.m4 @@ -0,0 +1,64 @@ +# Configure a GNU-like replacement for . + +# Copyright (C) 2023 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 1 + +AC_DEFUN_ONCE([gl_UTMP_H], +[ + dnl Ensure to expand the default settings once only, before all statements + dnl that occur in other macros. + AC_REQUIRE([gl_UTMP_H_DEFAULTS]) + + gl_CHECK_NEXT_HEADERS([utmp.h]) + if test $ac_cv_header_utmp_h = yes; then + HAVE_UTMP_H=1 + else + HAVE_UTMP_H=0 + fi + AC_SUBST([HAVE_UTMP_H]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use, and which is not + dnl guaranteed by C89. + gl_WARN_ON_USE_PREPARE([[ + #include + #include + ]], + [login_tty]) +]) + +# gl_UTMP_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. +AC_DEFUN([gl_UTMP_MODULE_INDICATOR], +[ + dnl Ensure to expand the default settings once only. + gl_UTMP_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_UTMP_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_UTMP_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGIN_TTY]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_UTMP_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_UTMP_H_DEFAULTS]) +]) + +AC_DEFUN([gl_UTMP_H_DEFAULTS], +[ + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_LOGIN_TTY=1; AC_SUBST([HAVE_LOGIN_TTY]) + REPLACE_LOGIN_TTY=0; AC_SUBST([REPLACE_LOGIN_TTY]) +]) diff --git a/modules/login_tty b/modules/login_tty index aa46b7f8b0..7b09ec1bd2 100644 --- a/modules/login_tty +++ b/modules/login_tty @@ -4,17 +4,18 @@ standard input, standard output, standard error of the current process. Files: lib/login_tty.c +m4/login_tty.m4 m4/pty.m4 Depends-on: -pty +utmp sys_ioctl -open [test $ac_cv_func_login_tty = no] +open [test $HAVE_LOGIN_TTY = 0] configure.ac: gl_FUNC_LOGIN_TTY -gl_CONDITIONAL([GL_COND_OBJ_LOGIN_TTY], [test $ac_cv_func_login_tty = no]) -gl_PTY_MODULE_INDICATOR([login_tty]) +gl_CONDITIONAL([GL_COND_OBJ_LOGIN_TTY], [test $HAVE_LOGIN_TTY = 0]) +gl_UTMP_MODULE_INDICATOR([login_tty]) Makefile.am: if GL_COND_OBJ_LOGIN_TTY @@ -22,7 +23,7 @@ lib_SOURCES += login_tty.c endif Include: -extern int login_tty (int); + Link: $(PTY_LIB) diff --git a/modules/utmp b/modules/utmp new file mode 100644 index 0000000000..3a02f01364 --- /dev/null +++ b/modules/utmp @@ -0,0 +1,49 @@ +Description: +A GNU-like . + +Files: +lib/utmp.in.h +m4/utmp_h.m4 + +Depends-on: +gen-header +include_next +snippet/c++defs +snippet/warn-on-use + +configure.ac: +gl_UTMP_H +gl_UTMP_H_REQUIRE_DEFAULTS +AC_PROG_MKDIR_P + +Makefile.am: +BUILT_SOURCES += utmp.h + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +utmp.h: utmp.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) +@NMD@ $(AM_V_GEN)$(MKDIR_P) '%reldir%' + $(gl_V_at)$(SED_HEADER_STDOUT) \ + -e 's|@''GUARD_PREFIX''@|${gl_include_guard_prefix}|g' \ + -e 's/@''HAVE_UTMP_H''@/$(HAVE_UTMP_H)/g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_UTMP_H''@|$(NEXT_UTMP_H)|g' \ + -e 's/@''GNULIB_LOGIN_TTY''@/$(GNULIB_LOGIN_TTY)/g' \ + -e 's|@''HAVE_LOGIN_TTY''@|$(HAVE_LOGIN_TTY)|g' \ + -e 's|@''REPLACE_LOGIN_TTY''@|$(REPLACE_LOGIN_TTY)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ + $(srcdir)/utmp.in.h > $@-t + $(AM_V_at)mv $@-t $@ +MOSTLYCLEANFILES += utmp.h utmp.h-t + +Include: + + +License: +LGPLv2+ + +Maintainer: +all diff --git a/modules/utmp-c++-tests b/modules/utmp-c++-tests new file mode 100644 index 0000000000..814dfc36db --- /dev/null +++ b/modules/utmp-c++-tests @@ -0,0 +1,19 @@ +Files: +tests/test-utmp-c++.cc +tests/signature.h + +Status: +c++-test + +Depends-on: +ansi-c++-opt + +configure.ac: + +Makefile.am: +if ANSICXX +TESTS += test-utmp-c++ +check_PROGRAMS += test-utmp-c++ +test_utmp_c___SOURCES = test-utmp-c++.cc +test_utmp_c___LDADD = $(LDADD) $(PTY_LIB) +endif diff --git a/modules/utmp-tests b/modules/utmp-tests new file mode 100644 index 0000000000..4fa3d62aa8 --- /dev/null +++ b/modules/utmp-tests @@ -0,0 +1,11 @@ +Files: +tests/test-utmp.c + +Depends-on: +utmp-c++-tests + +configure.ac: + +Makefile.am: +TESTS += test-utmp +check_PROGRAMS += test-utmp diff --git a/tests/test-login_tty.c b/tests/test-login_tty.c index 294b46d63c..0aa693147a 100644 --- a/tests/test-login_tty.c +++ b/tests/test-login_tty.c @@ -17,7 +17,7 @@ #include /* Specification. */ -extern int login_tty (int); +#include #include #include diff --git a/tests/test-utmp-c++.cc b/tests/test-utmp-c++.cc new file mode 100644 index 0000000000..76a2a88aa8 --- /dev/null +++ b/tests/test-utmp-c++.cc @@ -0,0 +1,35 @@ +/* Test of substitute in C++ mode. + Copyright (C) 2023 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* Written by Bruno Haible , 2023. */ + +#define GNULIB_NAMESPACE gnulib +#include + +#include + +#include "signature.h" + + +#if GNULIB_TEST_LOGIN_TTY +SIGNATURE_CHECK (GNULIB_NAMESPACE::login_tty, int, (int)); +#endif + + +int +main () +{ +} diff --git a/tests/test-utmp.c b/tests/test-utmp.c new file mode 100644 index 0000000000..04c598e57e --- /dev/null +++ b/tests/test-utmp.c @@ -0,0 +1,27 @@ +/* Test of substitute. + Copyright (C) 2023 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* Written by Bruno Haible , 2023. */ + +#include + +#include + +int +main (void) +{ + return 0; +}