mirror of
https://https.git.savannah.gnu.org/git/gnulib.git
synced 2026-09-01 11:16:02 +00:00
New module 'stdlib'.
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
* lib/mkdtemp.h: Remove file.
|
||||
* lib/mkstemp.h: Remove file.
|
||||
* m4/stdlib_h.m4: New file.
|
||||
* MODULES.html.sh (Support for systems lacking ANSI C 89): Add stdlib.
|
||||
|
||||
2007-02-18 Bruno Haible <bruno@clisp.org>
|
||||
|
||||
|
||||
@@ -1490,6 +1490,7 @@ func_all_modules ()
|
||||
func_echo "$element"
|
||||
|
||||
func_begin_table
|
||||
func_module stdlib
|
||||
func_module exit
|
||||
func_module atexit
|
||||
func_module strtod
|
||||
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
/* exit() function.
|
||||
Copyright (C) 1995, 2001 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 _EXIT_H
|
||||
#define _EXIT_H
|
||||
|
||||
/* Get exit() declaration. */
|
||||
#include <stdlib.h>
|
||||
|
||||
/* 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
|
||||
|
||||
#endif /* _EXIT_H */
|
||||
@@ -1,32 +0,0 @@
|
||||
/* Creating a private temporary directory.
|
||||
Copyright (C) 2001-2002 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. */
|
||||
|
||||
#if HAVE_MKDTEMP
|
||||
|
||||
/* Get mkdtemp() declaration. */
|
||||
#include <stdlib.h>
|
||||
|
||||
#else
|
||||
|
||||
/* 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
|
||||
@@ -1,31 +0,0 @@
|
||||
/* Create a unique temporary file.
|
||||
|
||||
Copyright (C) 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
|
||||
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. */
|
||||
|
||||
/* written by Jim Meyering */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef __MKSTEMP_PREFIX
|
||||
# define _GL_CONCAT(x, y) x ## y
|
||||
# define _GL_XCONCAT(x, y) _GL_CONCAT (x, y)
|
||||
# define __MKSTEMP_ID(y) _GL_XCONCAT (__MKSTEMP_PREFIX, y)
|
||||
# undef mkstemp
|
||||
# define mkstemp __MKSTEMP_ID (mkstemp)
|
||||
int mkstemp (char *);
|
||||
#endif
|
||||
@@ -0,0 +1,86 @@
|
||||
/* 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 !@HAVE_MKDTEMP@
|
||||
/* 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
|
||||
@@ -0,0 +1,29 @@
|
||||
# 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])
|
||||
])
|
||||
@@ -0,0 +1,41 @@
|
||||
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 $@-t $@
|
||||
{ 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; \
|
||||
} > $@-t
|
||||
mv $@-t $@
|
||||
MOSTLYCLEANFILES += stdlib.h stdlib.h-t
|
||||
|
||||
Include:
|
||||
#include <stdlib.h>
|
||||
|
||||
License:
|
||||
LGPL
|
||||
|
||||
Maintainer:
|
||||
all
|
||||
Reference in New Issue
Block a user