2010-03-19 Eric Blake <eblake@redhat.com>
+ forkpty, openpty: split functions into new modules
+ * modules/pty (Makefile.am): Substitute new witnesses.
+ (Libraries): Move library detection...
+ * modules/forkpty: ...into new module.
+ * modules/openpty: Another new module.
+ * modules/pty-tests: Rename and split...
+ * modules/forkpty-tests: ...to this...
+ * modules/openpty-tests: ...and this.
+ * tests/test-pty.c: Rename and split...
+ * tests/test-forkpty.c: ...to this...
+ * tests/test-openpty.c: ...and this.
+ * m4/pty_h.m4 (gl_PTY_H_DEFAULTS): Add new witnesses.
+ (gl_PTY): Split library searching...
+ * m4/pty.m4 (gl_PTY_LIB): ...into new file.
+ (gl_FORKPTY, gl_OPENPTY): New macros.
+ * lib/pty.in.h (forkpty, openpty): Honor new witnesses.
+ * NEWS: Mention the split.
+ * MODULES.html.sh (Misc): Document the modules.
+ * doc/glibc-functions/forkpty.texi (forkpty): Likewise.
+ * doc/glibc-functions/openpty.texi (openpty): Likewise.
+
pty: improve replacement header
* lib/pty.in.h: New file.
* modules/pty (Files): Ship it.
func_module exitfail
func_module error
func_module extensions
+ func_module forkpty
func_module getdomainname
func_module xgetdomainname
func_module getloadavg
func_module getusershell
func_module lib-symbol-visibility
func_module nproc
+ func_module openpty
func_module physmem
func_module posixver
func_module progname
+ func_module pty
func_module quotearg
func_module quote
func_module readutmp
Date Modules Changes
+2010-03-18 pty This module now only declares the pty.h header.
+ Use the new modules 'forkpty' or 'openpty' to
+ get the functions that were previously provided.
+
2010-03-05 exit This module is deprecated, use 'stdlib' directly
instead. It will be removed 2011-01-01.
@subsection @code{forkpty}
@findex forkpty
-Gnulib module: pty
+Gnulib module: forkpty
Portability problems fixed by Gnulib:
@itemize
@subsection @code{openpty}
@findex openpty
-Gnulib module: pty
+Gnulib module: openpty
Portability problems fixed by Gnulib:
@itemize
/* Declare overridden functions. */
-#if 1 /* FIXME - split forkpty into separate module */
+#if @GNULIB_FORKPTY@
#elif defined GNULIB_POSIXCHECK
# undef forkpty
# if HAVE_RAW_DECL_FORKPTY
_GL_WARN_ON_USE (forkpty, "forkpty is not declared consistently - "
- "use gnulib module pty for portability");
+ "use gnulib module forkpty for portability");
# endif
#endif
-#if 1 /* FIXME - split openpty into separate module */
+#if @GNULIB_OPENPTY@
#elif defined GNULIB_POSIXCHECK
# undef openpty
# if HAVE_RAW_DECL_OPENPTY
_GL_WARN_ON_USE (openpty, "openpty is not declared consistently - "
- "use gnulib module pty for portability");
+ "use gnulib module openpty for portability");
# endif
#endif
--- /dev/null
+# pty.m4 serial 1
+dnl Copyright (C) 2010 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.
+
+# gl_PTY_LIB
+# ----------
+# Define automake variable PTY_LIB to the library needed (if any).
+AC_DEFUN([gl_PTY_LIB],
+[
+ # Check for the library required for forkpty.
+ PTY_LIB=
+ save_LIBS="$LIBS"
+ AC_SEARCH_LIBS([forkpty], [util],
+ [if test "$ac_cv_search_forkpty" != "none required"; then
+ PTY_LIB="$ac_cv_search_forkpty"
+ fi])
+ LIBS="$save_LIBS"
+ AC_SUBST([PTY_LIB])
+])
+
+AC_DEFUN([gl_FORKPTY],
+[
+ AC_REQUIRE([gl_PTY_LIB])
+])
+
+AC_DEFUN([gl_OPENPTY],
+[
+ AC_REQUIRE([gl_PTY_LIB])
+])
-# pty_h.m4 serial 2
+# pty_h.m4 serial 3
dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
# gl_PTY
# ------
# Make sure that pty.h provides forkpty, or sets up a replacement header.
-# Also define automake variable PTY_LIB to the library needed (if any).
AC_DEFUN_ONCE([gl_PTY],
[
AC_REQUIRE([gl_PTY_H_DEFAULTS])
- PTY_LIB=''
- # First make sure that pty.h provides forkpty, or setup the replacement.
+ # Make sure that pty.h provides forkpty, or setup the replacement.
AC_CHECK_HEADERS_ONCE([pty.h])
if test $ac_cv_header_pty_h != yes; then
HAVE_PTY_H=0
if test $ac_cv_header_libutil_h = yes; then
HAVE_LIBUTIL_H=1
fi
+ dnl FIXME - move this into forkpty module, when replacement is provided
AC_CHECK_DECLS([forkpty],,, [[
#if HAVE_UTIL_H
# include <util.h>
dnl <pty.h> is always overridden, because of GNULIB_POSIXCHECK.
gl_CHECK_NEXT_HEADERS([pty.h])
- # Second check for the library required for forkpty.
- save_LIBS="$LIBS"
- AC_SEARCH_LIBS([forkpty], [util],
- [if test "$ac_cv_search_forkpty" != "none required"; then
- PTY_LIB="$ac_cv_search_forkpty"
- fi])
- LIBS="$save_LIBS"
- AC_SUBST([PTY_LIB])
-
dnl Check for declarations of anything we want to poison if the
dnl corresponding gnulib module is not in use.
gl_WARN_ON_USE_PREPARE([[
AC_DEFUN([gl_PTY_H_DEFAULTS],
[
+ GNULIB_FORKPTY=0; AC_SUBST([GNULIB_FORKPTY])
+ GNULIB_OPENPTY=0; AC_SUBST([GNULIB_OPENPTY])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_UTIL_H=0; AC_SUBST([HAVE_UTIL_H])
HAVE_LIBUTIL_H=0; AC_SUBST([HAVE_LIBUTIL_H])
--- /dev/null
+Description:
+Provide the forkpty() function.
+
+Files:
+m4/pty.m4
+
+Depends-on:
+pty
+
+configure.ac:
+gl_FORKPTY
+gl_PTY_MODULE_INDICATOR([forkpty])
+
+Makefile.am:
+
+Include:
+<pty.h>
+
+Link:
+$(PTY_LIB)
+
+License:
+LGPL
+
+Maintainer:
+Simon Josefsson
--- /dev/null
+Files:
+tests/signature.h
+tests/test-forkpty.c
+
+Makefile.am:
+TESTS += test-forkpty
+check_PROGRAMS += test-forkpty
+test_forkpty_LDADD = $(LDADD) $(PTY_LIB)
--- /dev/null
+Description:
+Provide the openpty() function.
+
+Files:
+m4/pty.m4
+
+Depends-on:
+pty
+
+configure.ac:
+gl_OPENPTY
+gl_PTY_MODULE_INDICATOR([openpty])
+
+Makefile.am:
+
+Include:
+<pty.h>
+
+Link:
+$(PTY_LIB)
+
+License:
+LGPL
+
+Maintainer:
+Simon Josefsson
--- /dev/null
+Files:
+tests/signature.h
+tests/test-openpty.c
+
+Makefile.am:
+TESTS += test-openpty
+check_PROGRAMS += test-openpty
+test_openpty_LDADD = $(LDADD) $(PTY_LIB)
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''NEXT_PTY_H''@|$(NEXT_PTY_H)|g' \
+ -e 's|@''GNULIB_FORKPTY''@|$(GNULIB_FORKPTY)|g' \
+ -e 's|@''GNULIB_OPENPTY''@|$(GNULIB_OPENPTY)|g' \
-e 's|@''HAVE_UTIL_H''@|$(HAVE_UTIL_H)|g' \
-e 's|@''HAVE_LIBUTIL_H''@|$(HAVE_LIBUTIL_H)|g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
+++ /dev/null
-Files:
-tests/signature.h
-tests/test-pty.c
-
-Makefile.am:
-TESTS += test-pty
-check_PROGRAMS += test-pty
-test_pty_LDADD = $(LDADD) $(PTY_LIB)
--- /dev/null
+/* Test of pty.h and forkpty function.
+ Copyright (C) 2009, 2010 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 <http://www.gnu.org/licenses/>. */
+
+/* Written by Simon Josefsson <simon@josefsson.org>, 2009. */
+
+#include <config.h>
+
+#include <pty.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (forkpty, int, (int *, char *, struct termios *,
+ struct winsize *));
+
+#include <stdio.h>
+
+int
+main ()
+{
+ int res;
+ int amaster;
+
+ res = forkpty (&amaster, NULL, NULL, NULL);
+ if (res == 0)
+ {
+ /* child process */
+ }
+ else if (res > 0)
+ {
+ /* parent */
+ }
+ else
+ {
+ printf ("forkpty returned %d\n", res);
+ return 1;
+ }
+
+ return 0;
+}
--- /dev/null
+/* Test of pty.h and openpty function.
+ Copyright (C) 2009, 2010 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 <http://www.gnu.org/licenses/>. */
+
+/* Written by Simon Josefsson <simon@josefsson.org>, 2009. */
+
+#include <config.h>
+
+#include <pty.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (openpty, int, (int *, int *, char *, struct termios *,
+ struct winsize *));
+
+#include <stdio.h>
+
+int
+main ()
+{
+ int res;
+ int amaster;
+ int aslave;
+
+ res = openpty (&amaster, &aslave, NULL, NULL, NULL);
+ if (res != 0)
+ {
+ printf ("openpty returned %d\n", res);
+ return 1;
+ }
+
+ return 0;
+}
+++ /dev/null
-/* Test of pty.h and openpty/forkpty functions.
- Copyright (C) 2009, 2010 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 <http://www.gnu.org/licenses/>. */
-
-/* Written by Simon Josefsson <simon@josefsson.org>, 2009. */
-
-#include <config.h>
-
-#include <pty.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (forkpty, int, (int *, char *, struct termios *,
- struct winsize *));
-SIGNATURE_CHECK (openpty, int, (int *, int *, char *, struct termios *,
- struct winsize *));
-
-#include <stdio.h>
-
-int
-main ()
-{
- int res;
- int amaster;
- int aslave;
-
- res = openpty (&amaster, &aslave, NULL, NULL, NULL);
- if (res != 0)
- {
- printf ("openpty returned %d\n", res);
- return 1;
- }
-
- res = forkpty (&amaster, NULL, NULL, NULL);
- if (res == 0)
- {
- /* child process */
- }
- else if (res > 0)
- {
- /* parent */
- }
- else
- {
- printf ("forkpty returned %d\n", res);
- return 1;
- }
-
- return 0;
-}