bug-gnulib
[Top][All Lists]
Advanced

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

new module stdlib


From: Bruno Haible
Subject: new module stdlib
Date: Sun, 18 Feb 2007 16:44:57 +0100
User-agent: KMail/1.5.4

This creates a "complete" <stdlib.h>. The include files exit.h, mkdtemp.h,
mkstemp.h no longer exist - use <stdlib.h> instead.

2007-02-18  Bruno Haible  <address@hidden>

        * modules/mkstemp (Files): Remove lib/mkstemp.h.
        (Depends-on): Add stdlib.
        (configure.ac): Invoke gl_STDLIB_MODULE_INDICATOR.
        (Includes): Use <stdlib.h> instead of mkstemp.h.
        * m4/mkstemp.m4 (gl_FUNC_MKSTEMP): Require gl_STDLIB_H_DEFAULTS. Set
        REPLACE_MKSTEMP. Remove definition of __MKSTEMP_PREFIX.
        * lib/mkstemp.c: Don't include mkstemp.h.
        * lib/mkstemp-safer.c: Include <stdlib.h> instead of mkstemp.h.
        * lib/stdlib--.h: Don't include mkstemp.h.

        * modules/mkdtemp (Files): Remove lib/mkdtemp.h.
        (Depends-on): Add stdlib.
        (configure.ac): Invoke gl_STDLIB_MODULE_INDICATOR.
        (Includes): Use <stdlib.h> instead of mkdtemp.h.
        * m4/mkdtemp.m4 (gt_FUNC_MKDTEMP): Require gl_STDLIB_H_DEFAULTS. Set
        HAVE_MKDTEMP.
        * lib/mkdtemp.c: Don't include mkdtemp.h.
        * lib/clean-temp.c: Don't include mkdtemp.h.

        * modules/exit (Files): Remove lib/exit.h.
        (Depends-on): Add stdlib.
        (Makefile.am): Remove lib_SOURCES.
        (Include): Use <stdlib.h> instead of exit.h.

        * modules/stdlib: New file.
        * lib/stdlib_.h: New file, incorporating exit.h, mkdtemp.h, mkstemp.h
        and extra comments about mkstemp().
        * lib/exit.h: Remove file.
        * lib/mkdtemp.h: Remove file.
        * lib/mkstemp.h: Remove file.
        * m4/stdlib_h.m4: New file.

============================= modules/stdlib ================================
Description:
A GNU-like <stdlib.h>.

Files:
lib/stdlib_.h
m4/stdlib_h.m4

Depends-on:
absolute-header
link-warning

configure.ac:
gl_STDLIB_H

Makefile.am:
BUILT_SOURCES += stdlib.h

# We need the following in order to create <stdlib.h> when the system
# doesn't have one that works with the given compiler.
stdlib.h: stdlib_.h
        rm -f address@hidden $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''ABSOLUTE_STDLIB_H''@|$(ABSOLUTE_STDLIB_H)|g' \
              -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \
              -e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \
              -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
              -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              < $(srcdir)/stdlib_.h; \
        } > address@hidden
        mv address@hidden $@
MOSTLYCLEANFILES += stdlib.h stdlib.h-t

Include:
#include <stdlib.h>

License:
LGPL

Maintainer:
all
============================= lib/stdlib_.h =================================
/* A GNU-like <stdlib.h>.

   Copyright (C) 1995, 2001-2002, 2006-2007 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 2, 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, write to the Free Software Foundation,
   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */

#ifndef _GL_STDLIB_H
#define _GL_STDLIB_H

#include @ABSOLUTE_STDLIB_H@


/* The definition of GL_LINK_WARNING is copied here.  */


/* Some systems do not define EXIT_*, despite otherwise supporting C89.  */
#ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
#endif
#ifndef EXIT_FAILURE
# define EXIT_FAILURE 1
#endif


#ifdef __cplusplus
extern "C" {
#endif


#if @GNULIB_MKDTEMP@
# if address@hidden@
/* Create a unique temporary directory from TEMPLATE.
   The last six characters of TEMPLATE must be "XXXXXX";
   they are replaced with a string that makes the directory name unique.
   Returns TEMPLATE, or a null pointer if it cannot get a unique name.
   The directory is created mode 700.  */
extern char * mkdtemp (char *template);
# endif
#elif defined GNULIB_POSIXCHECK
# undef mkdtemp
# define mkdtemp(t) \
    (GL_LINK_WARNING ("mkdtemp is unportable - "\
                      "use gnulib module mkdtemp for portability"), \
     mkdtemp (t))
#endif

#if @GNULIB_MKSTEMP@
# if @REPLACE_MKSTEMP@
/* Create a unique temporary file from TEMPLATE.
   The last six characters of TEMPLATE must be "XXXXXX";
   they are replaced with a string that makes the file name unique.
   The file is then created, ensuring it didn't exist before.
   The file is created read-write (mask at least 0600 & ~umask), but it may be
   world-readable and world-writable (mask 0666 & ~umask), depending on the
   implementation.
   Returns the open file descriptor if successful, otherwise -1 and errno
   set.  */
#  define mkstemp rpl_mkstemp
extern int mkstemp (char *template);
# endif
#elif defined GNULIB_POSIXCHECK
# undef mkstemp
# define mkstemp(t) \
    (GL_LINK_WARNING ("mkstemp is unportable - "\
                      "use gnulib module mkstemp for portability"), \
     mkstemp (t))
#endif


#ifdef __cplusplus
}
#endif

#endif
============================= m4/stdlib_h.m4 ================================
# stdlib_h.m4 serial 1
dnl Copyright (C) 2007 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_STDLIB_H],
[
  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
  gl_ABSOLUTE_HEADER([stdlib.h])
  ABSOLUTE_STDLIB_H=\"$gl_cv_absolute_stdlib_h\"
  AC_SUBST([ABSOLUTE_STDLIB_H])
])

AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
[
  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
  
GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
])

AC_DEFUN([gl_STDLIB_H_DEFAULTS],
[
  GNULIB_MKDTEMP=0;  AC_SUBST([GNULIB_MKDTEMP])
  GNULIB_MKSTEMP=0;  AC_SUBST([GNULIB_MKSTEMP])
  dnl Assume proper GNU behavior unless another module says otherwise.
  HAVE_MKDTEMP=1;    AC_SUBST([HAVE_MKDTEMP])
  REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP])
])
=============================================================================
*** modules/exit        22 Sep 2004 15:11:04 -0000      1.2
--- modules/exit        18 Feb 2007 15:19:04 -0000
***************
*** 2,18 ****
  exit() function: program termination.
  
  Files:
- lib/exit.h
  
  Depends-on:
  
  configure.ac:
  
  Makefile.am:
- lib_SOURCES += exit.h
  
  Include:
! "exit.h"
  
  License:
  GPL
--- 2,17 ----
  exit() function: program termination.
  
  Files:
  
  Depends-on:
+ stdlib
  
  configure.ac:
  
  Makefile.am:
  
  Include:
! <stdlib.h>
  
  License:
  GPL
*** modules/mkdtemp     1 Nov 2006 03:46:10 -0000       1.7
--- modules/mkdtemp     18 Feb 2007 15:19:04 -0000
***************
*** 2,22 ****
  mkdtemp() function: create a private temporary directory.
  
  Files:
- lib/mkdtemp.h
  lib/mkdtemp.c
  m4/mkdtemp.m4
  
  Depends-on:
  stdint
  tempname
  
  configure.ac:
  gt_FUNC_MKDTEMP
  
  Makefile.am:
  
  Include:
! "mkdtemp.h"
  
  License:
  LGPL
--- 2,23 ----
  mkdtemp() function: create a private temporary directory.
  
  Files:
  lib/mkdtemp.c
  m4/mkdtemp.m4
  
  Depends-on:
  stdint
+ stdlib
  tempname
  
  configure.ac:
  gt_FUNC_MKDTEMP
+ gl_STDLIB_MODULE_INDICATOR([mkdtemp])
  
  Makefile.am:
  
  Include:
! <stdlib.h>
  
  License:
  LGPL
*** m4/mkdtemp.m4       1 Nov 2006 03:46:10 -0000       1.5
--- m4/mkdtemp.m4       18 Feb 2007 15:19:04 -0000
***************
*** 1,13 ****
! # mkdtemp.m4 serial 4
! dnl Copyright (C) 2001-2003, 2006 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([gt_FUNC_MKDTEMP],
  [
    AC_REPLACE_FUNCS(mkdtemp)
    if test $ac_cv_func_mkdtemp = no; then
      gl_PREREQ_MKDTEMP
    fi
  ])
--- 1,15 ----
! # mkdtemp.m4 serial 5
! dnl Copyright (C) 2001-2003, 2006-2007 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([gt_FUNC_MKDTEMP],
  [
+   AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
    AC_REPLACE_FUNCS(mkdtemp)
    if test $ac_cv_func_mkdtemp = no; then
+     HAVE_MKDTEMP=0
      gl_PREREQ_MKDTEMP
    fi
  ])
*** lib/mkdtemp.c       1 Nov 2006 03:46:10 -0000       1.13
--- lib/mkdtemp.c       18 Feb 2007 15:19:03 -0000
***************
*** 1,4 ****
! /* Copyright (C) 1999, 2001-2003, 2006 Free Software Foundation, Inc.
     This file is part of the GNU C Library.
  
     This program is free software; you can redistribute it and/or modify
--- 1,4 ----
! /* Copyright (C) 1999, 2001-2003, 2006-2007 Free Software Foundation, Inc.
     This file is part of the GNU C Library.
  
     This program is free software; you can redistribute it and/or modify
***************
*** 20,29 ****
  #include <config.h>
  
  /* Specification.  */
! #include "mkdtemp.h"
  
  #include "tempname.h"
- #include <stdlib.h>
  
  /* Generate a unique temporary directory from TEMPLATE.
     The last six characters of TEMPLATE must be "XXXXXX";
--- 20,28 ----
  #include <config.h>
  
  /* Specification.  */
! #include <stdlib.h>
  
  #include "tempname.h"
  
  /* Generate a unique temporary directory from TEMPLATE.
     The last six characters of TEMPLATE must be "XXXXXX";
*** lib/clean-temp.c    16 Feb 2007 02:58:04 -0000      1.12
--- lib/clean-temp.c    18 Feb 2007 15:27:21 -0000
***************
*** 39,45 ****
  #include "fatal-signal.h"
  #include "pathmax.h"
  #include "tmpdir.h"
- #include "mkdtemp.h"
  #include "xalloc.h"
  #include "xallocsa.h"
  #include "gl_linkedhash_list.h"
--- 39,44 ----
*** modules/mkstemp     27 Oct 2006 13:51:23 -0000      1.14
--- modules/mkstemp     18 Feb 2007 15:19:04 -0000
***************
*** 2,22 ****
  mkstemp() function: create a private temporary file.
  
  Files:
- lib/mkstemp.h
  lib/mkstemp.c
  m4/mkstemp.m4
  
  Depends-on:
  extensions
  tempname
  
  configure.ac:
  gl_FUNC_MKSTEMP
  
  Makefile.am:
  
  Include:
! "mkstemp.h"
  
  License:
  GPL
--- 2,23 ----
  mkstemp() function: create a private temporary file.
  
  Files:
  lib/mkstemp.c
  m4/mkstemp.m4
  
  Depends-on:
  extensions
+ stdlib
  tempname
  
  configure.ac:
  gl_FUNC_MKSTEMP
+ gl_STDLIB_MODULE_INDICATOR([mkstemp])
  
  Makefile.am:
  
  Include:
! <stdlib.h>
  
  License:
  GPL
*** m4/mkstemp.m4       1 Nov 2006 16:32:50 -0000       1.21
--- m4/mkstemp.m4       18 Feb 2007 15:19:04 -0000
***************
*** 1,6 ****
! #serial 16
  
! # Copyright (C) 2001, 2003, 2004, 2005, 2006 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.
--- 1,6 ----
! #serial 17
  
! # Copyright (C) 2001, 2003, 2004, 2005, 2006, 2007 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.
***************
*** 13,18 ****
--- 13,19 ----
  # On systems like the above, arrange to use the replacement function.
  AC_DEFUN([gl_FUNC_MKSTEMP],
  [
+   AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
    AC_REQUIRE([AC_SYS_LARGEFILE])
  
    AC_CACHE_CHECK([for working mkstemp],
***************
*** 43,50 ****
      ])
  
    if test $gl_cv_func_working_mkstemp != yes; then
!     AC_DEFINE([__MKSTEMP_PREFIX], [[rpl_]],
!       [Define to rpl_ if the mkstemp replacement function should be used.])
      AC_LIBOBJ([mkstemp])
      gl_PREREQ_MKSTEMP
    fi
--- 44,50 ----
      ])
  
    if test $gl_cv_func_working_mkstemp != yes; then
!     REPLACE_MKSTEMP=1
      AC_LIBOBJ([mkstemp])
      gl_PREREQ_MKSTEMP
    fi
*** lib/mkstemp.c       27 Oct 2006 13:51:23 -0000      1.9
--- lib/mkstemp.c       18 Feb 2007 15:19:03 -0000
***************
*** 1,4 ****
! /* Copyright (C) 1998, 1999, 2001, 2005, 2006 Free Software Foundation, Inc.
     This file is derived from the one in the GNU C Library.
  
     This program is free software; you can redistribute it and/or modify
--- 1,4 ----
! /* Copyright (C) 1998, 1999, 2001, 2005, 2006, 2007 Free Software Foundation, 
Inc.
     This file is derived from the one in the GNU C Library.
  
     This program is free software; you can redistribute it and/or modify
***************
*** 17,30 ****
  
  #if !_LIBC
  # include <config.h>
! # include "mkstemp.h"
  # include "tempname.h"
  # define __gen_tempname gen_tempname
  # define __GT_FILE GT_FILE
  #endif
  
  #include <stdio.h>
- #include <stdlib.h>
  
  #ifndef __GT_FILE
  # define __GT_FILE 0
--- 17,33 ----
  
  #if !_LIBC
  # include <config.h>
! #endif
! 
! #include <stdlib.h>
! 
! #if !_LIBC
  # include "tempname.h"
  # define __gen_tempname gen_tempname
  # define __GT_FILE GT_FILE
  #endif
  
  #include <stdio.h>
  
  #ifndef __GT_FILE
  # define __GT_FILE 0
*** lib/mkstemp-safer.c 1 Nov 2006 16:49:06 -0000       1.8
--- lib/mkstemp-safer.c 18 Feb 2007 15:27:20 -0000
***************
*** 1,6 ****
  /* Invoke mkstemp, but avoid some glitches.
  
!    Copyright (C) 2005, 2006 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
--- 1,6 ----
  /* Invoke mkstemp, but avoid some glitches.
  
!    Copyright (C) 2005, 2006, 2007 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
***************
*** 22,28 ****
  
  #include "stdlib-safer.h"
  
! #include "mkstemp.h"
  #include "unistd-safer.h"
  
  /* Like mkstemp, but do not return STDIN_FILENO, STDOUT_FILENO, or
--- 22,28 ----
  
  #include "stdlib-safer.h"
  
! #include <stdlib.h>
  #include "unistd-safer.h"
  
  /* Like mkstemp, but do not return STDIN_FILENO, STDOUT_FILENO, or
*** lib/stdlib--.h      20 Sep 2006 18:44:04 -0000      1.2
--- lib/stdlib--.h      18 Feb 2007 15:27:20 -0000
***************
*** 1,6 ****
  /* Like stdlib.h, but redefine some names to avoid glitches.
  
!    Copyright (C) 2005, 2006 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
--- 1,6 ----
  /* Like stdlib.h, but redefine some names to avoid glitches.
  
!    Copyright (C) 2005, 2006, 2007 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
***************
*** 21,26 ****
  #include <stdlib.h>
  #include "stdlib-safer.h"
  
- #include "mkstemp.h"
  #undef mkstemp
  #define mkstemp mkstemp_safer
--- 21,25 ----





reply via email to

[Prev in Thread] Current Thread [Next in Thread]