Re: [bug-gnulib] time64: 64-bit variants of gmtime, mktime, localtime etc?
Bruno Haible <[EMAIL PROTECTED]> writes: > Paul Eggert wrote: >> Clearly you don't write financial applications dealing with 30-year >> bonds. :-) > > So you want that 'time64_t' type to be useful specifically for financial > applications? I was kidding! (But I'm afraid others are not: I have heard stories of people who converted to 64-bit just for this reason. Obviously their view of the world was oversimplified...) The main reason I want 64-bit time_t is so that my apps can stat any file without getting EOVERFLOW. gnulib can't easily work around that problem on 32-bit platforms, though. (I can think of a way to do it, but it'd be pretty horrible)
Re: check for C99-compliant snprintf - call for volunteers
Albert Chin wrote: > 1 2 3 4 5 6 7 > OpenBSD 4.0: . # . . . . . > HP-UX 10.20: # # . . . . # Thanks, I added this to printf.m4. > HP-UX 10.20's libc has snprintf() but there is _no_ function prototype > for it. This is already handled in lib/stdio_.h. Bruno
restoring 1500 lines of missing ChangeLog entries
FYI, this change removed 1500 lines of ChangeLog content: Author: Bruno Haible <[EMAIL PROTECTED]> Date: Sun Feb 18 15:10:28 2007 + New module 'math'. replaces mathl.h. I presume that was accidental and have restored those lines. Using git, you can see the diff like this: git-diff -p e77794ac4^..e77794ac4 or, on the web: http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=e77794ac4 Also, I've added parted to users.txt: partedhttp://git.debian.org/?p=parted/parted.git;a=summary
Re: time64: 64-bit variants of gmtime, mktime, localtime etc?
Paul Eggert wrote: Perhaps we can nudge this process forward a bit by designing an Autoconf macro that causes configure/make to default to 64-bit builds on platforms that can support either 32 or 64. ...just provide a way to turn it off. :-) I build on one box for an entire platform (e.g. "x86/Linux" is a "platform"). Except for Linux, I think it is safe to switch to 64-bit builds for all of them (where applicable). For Linux, I build on a 32-bit-only box that can't produce 64-bit binaries anyway. But someone else might need to build 32-bit packages on a 64-bit box. Otherwise I would be in favor of this, not just for time-related stuff but any time building 32-bit is a needless limitation. For example, programs that might be memory-hungry (sort comes to mind). Also because, despite the pundits, 64-bit does seem to be slightly faster (at least compared to a 32-bit build of the same program on the same machine). -- Matthew "There's nothing in the universe so permanent as a temporary government agency." -- Phil Geusz
Re: restoring 1500 lines of missing ChangeLog entries
Jim Meyering wrote: > FYI, this change removed 1500 lines of ChangeLog content: > I presume that was accidental and have restored those lines. Thanks and sorry about it. This apparently happens when I don't wait long enough after saving the ChangeLog and before doing the "cvs commit". Bruno
new module 'fseterr'
Hi, For an fprintf emulation, one needs the ability to set the "error indicator" bit in a FILE stream. Surprisingly, this is not possible in a portable and efficient way. Like __fpending, this is one of those functionalities that the ANSI/ISO C people forgot to standardize. 2007-03-08 Bruno Haible <[EMAIL PROTECTED]> * modules/fseterr: New file. * lib/fseterr.h: New file. * lib/fseterr.c: New file. == modules/fseterr == Description: Set the error indicator of a stream. Files: lib/fseterr.h lib/fseterr.c Depends-on: configure.ac: Makefile.am: lib_SOURCES += fseterr.c Include: "fseterr.h" License: LGPL Maintainer: Bruno Haible === lib/fseterr.h === /* Set the error indicator of a stream. Copyright (C) 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 _FSETERR_H #define _FSETERR_H #include #ifdef __cplusplus extern "C" { #endif /* Set the error indicator of the stream FP. The "error indicator" is set when an I/O operation on the stream fails, and is cleared (together with the "end-of-file" indicator) by clearerr (FP). */ extern void fseterr (FILE *fp); #ifdef __cplusplus } #endif #endif /* _FSETERR_H */ === lib/fseterr.c === /* Set the error indicator of a stream. Copyright (C) 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. */ #include /* Specification. */ #include "fseterr.h" void fseterr (FILE *fp) { /* Most systems provide FILE as a struct and the necessary bitmask in , because they need it for implementing getc() and putc() as fast macros. */ #if defined _IO_ferror_unlocked /* GNU libc, BeOS */ fp->_flags |= _IO_ERR_SEEN; #elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ fp->_flags |= __SERR; #elif defined _IOERR/* AIX, HP-UX, IRIX, OSF/1, Solaris, mingw */ fp->_flag |= _IOERR; #else /* unknown */ /* Portable fallback, based on an idea by Rich Felker. Wow! 6 system calls for something that is just a bit operation! */ int fd; int fd2; fflush (fp); fd = fileno (fp); fd2 = dup (fd); if (fd2 >= 0) { close (fd); fputc ('\0', fp); /* This should set the error indicator. */ fflush (fp); /* Or this. */ if (dup2 (fd2, fd) < 0) /* Whee... we botched the stream and now cannot restore it! */ abort (); close (fd2); } #endif }
Re: new module 'vsnprintf-posix'
Albert Chin asked: > Does gl_cv_func_vsnprintf_posix=yes on AIX 5.1, and Solaris 6-9/SPARC? No. According to the table at the end of m4/printf.m4, the first and second test will fail on these platforms. Bruno
Re: new module 'vasnprintf-posix'
Paul Eggert wrote: > >- or the bash maintainers to make 'expr' and 'sed' shell built-ins, > > like 'test' and 'printf' are? > > I think it unlikely that either would happen; neither sounds all that > practical. Why not? 'expr' and 'sed' could ship its code in the form of shared libraries that bash could dlopen(). > It's that expr is so buggy on many > platforms. Sometimes we have to use expr, but it's better to avoid it > when possible. OK. > How about something like this instead? Perhaps it's not quite as > pretty, but it's equally easy to understand (at least for me). > > case $gl_cv_func_printf_sizes_c99 in *yes) > case $gl_cv_func_printf_directive_a in *yes) > case $gl_cv_func_printf_directive_n in *yes) > case $gl_cv_func_printf_positions in *yes) > case $gl_cv_func_snprintf_truncation_c99 in *yes) > case $gl_cv_func_snprintf_retval_c99 in *yes) > case $gl_cv_func_snprintf_directive_n in *yes) > # snprintf exists and is already POSIX compliant. > gl_cv_func_snprintf_posix=yes;; > esac;; > esac;; > esac;; > esac;; > esac;; > esac;; > esac I agree, this is easy to understand as well. I've committed this: 2007-03-08 Bruno Haible <[EMAIL PROTECTED]> * m4/snprintf-posix.m4 (gl_FUNC_SNPRINTF_POSIX): Use 'case' statements instead of 'expr' invocations. * m4/sprintf-posix.m4 (gl_FUNC_SPRINTF_POSIX): Likewise. * m4/vasnprintf-posix.m4 (gl_FUNC_VASNPRINTF_POSIX): Likewise. * m4/vasprintf-posix.m4 (gl_FUNC_VASPRINTF_POSIX): Likewise. * m4/vsnprintf-posix.m4 (gl_FUNC_VSNPRINTF_POSIX): Likewise. * m4/vsprintf-posix.m4 (gl_FUNC_VSPRINTF_POSIX): Likewise. Suggested by Paul Eggert. *** m4/snprintf-posix.m47 Mar 2007 01:59:05 - 1.1 --- m4/snprintf-posix.m49 Mar 2007 01:19:48 - *** *** 17,32 gl_SNPRINTF_TRUNCATION_C99 gl_SNPRINTF_RETVAL_C99 gl_SNPRINTF_DIRECTIVE_N ! if expr "$gl_cv_func_printf_sizes_c99" : ".*yes" > /dev/null \ !&& expr "$gl_cv_func_printf_directive_a" : ".*yes" > /dev/null \ !&& expr "$gl_cv_func_printf_directive_n" : ".*yes" > /dev/null \ !&& expr "$gl_cv_func_printf_positions" : ".*yes" > /dev/null \ !&& expr "$gl_cv_func_snprintf_truncation_c99" : ".*yes" > /dev/null \ !&& expr "$gl_cv_func_snprintf_retval_c99" : ".*yes" > /dev/null \ !&& expr "$gl_cv_func_snprintf_directive_n" : ".*yes" > /dev/null; then ! # snprintf exists and is already POSIX compliant. ! gl_cv_func_snprintf_posix=yes ! fi fi if test $gl_cv_func_snprintf_posix = no; then if ! expr "$gl_cv_func_printf_directive_a" : ".*yes" > /dev/null; then --- 17,53 gl_SNPRINTF_TRUNCATION_C99 gl_SNPRINTF_RETVAL_C99 gl_SNPRINTF_DIRECTIVE_N ! case "$gl_cv_func_printf_sizes_c99" in ! *yes) ! case "$gl_cv_func_printf_directive_a" in ! *yes) ! case "$gl_cv_func_printf_directive_n" in ! *yes) ! case "$gl_cv_func_printf_positions" in ! *yes) ! case "$gl_cv_func_snprintf_truncation_c99" in ! *yes) ! case "$gl_cv_func_snprintf_retval_c99" in ! *yes) ! case "$gl_cv_func_snprintf_directive_n" in ! *yes) ! # snprintf exists and is already POSIX ! # compliant. ! gl_cv_func_snprintf_posix=yes ! ;; ! esac ! ;; ! esac ! ;; ! esac ! ;; ! esac ! ;; ! esac ! ;; ! esac ! ;; ! esac fi if test $gl_cv_func_snprintf_posix = no; then if ! expr "$gl_cv_func_printf_directive_a" : ".*yes" > /dev/null; then *** m4/sprintf-posix.m4 7 Mar 2007 03:47:50 - 1.1 --- m4/sprintf-posix.m4 9 Mar 2007 01:19:48 - *** *** 11,22 AC_REQUIRE([gl_PRINTF_DIRECTIVE_A]) AC_REQUIRE([gl_PRINTF_DIRECTIVE_N]) AC_REQUIRE([gl_PRINTF_POSITIONS]) ! if expr "$gl_cv_func_printf_sizes_c99" : ".*yes" > /dev/null \ ! && expr "$gl_cv_func_printf_directive_a" : ".*yes" > /dev/null \ ! && expr "$gl_cv_func_printf_directive_n" : ".*yes" > /dev/null \ ! && expr "$gl_cv_func_printf_positions" : ".*yes" > /dev/null; then ! : # sprintf exists and is already POSIX compliant. ! else if ! expr "$gl_cv_func_printf_directive_a" : ".*yes" > /dev/null; then AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], 1, [Define if the vasnpr
Re: [bug-gnulib] time64: 64-bit variants of gmtime, mktime, localtime etc?
Paul Eggert wrote: > The main reason I want 64-bit time_t is so that my apps can stat any > file without getting EOVERFLOW. ... on 32-bit platforms If the time_t type is smaller than the type used for timestamps in the particular filesystem, you can get EOVERFLOW during stat(). If, on the other hand, the time_t type is larger than the one used in the filesystem, you can get EOVERFLOW during utime(). And you cannot set time_t to be the same size as on all filesystems, since filesystems differ. So, either way, you have an opportunity for EOVERFLOW. If a system makes the opposite choice than all other systems, it creates many possible bugs and security problems in various applications. Bruno
stdio fix
This is needed at least on glibc-2.3.6 systems, to avoid weird compilation errors. 2007-03-08 Bruno Haible <[EMAIL PROTECTED]> * lib/stdio_.h: Treat __need___FILE like __need_FILE. *** lib/stdio_.h7 Mar 2007 03:47:50 - 1.6 --- lib/stdio_.h9 Mar 2007 02:25:51 - *** *** 16,22 along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ! #if defined __need_FILE /* Special invocation convention inside glibc header files. */ #include @ABSOLUTE_STDIO_H@ --- 16,22 along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ! #if defined __need_FILE || defined __need___FILE /* Special invocation convention inside glibc header files. */ #include @ABSOLUTE_STDIO_H@
new module 'vfprintf-posix'
Here comes the full POSIX variant of vfprintf. 2007-03-08 Bruno Haible <[EMAIL PROTECTED]> * modules/vfprintf-posix: New file. * lib/vfprintf.c: New file. * m4/vfprintf-posix.m4: New file. * m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): Set also GNULIB_VFPRINTF_POSIX, REPLACE_VFPRINTF. * lib/stdio_.h (vfprintf): New declaration. * modules/stdio (Makefile.am): Substitute also GNULIB_VFPRINTF_POSIX, REPLACE_VFPRINTF. === modules/vfprintf-posix Description: POSIX compatible vfprintf() function: print formatted output to a stream Files: lib/vfprintf.c m4/vfprintf-posix.m4 m4/printf.m4 Depends-on: stdio fseterr vasnprintf isnan-nolibm isnanl-nolibm printf-frexp printf-frexpl configure.ac: gl_FUNC_VFPRINTF_POSIX gl_STDIO_MODULE_INDICATOR([vfprintf-posix]) Makefile.am: Include: License: LGPL Maintainer: Bruno Haible lib/vfprintf.c === /* Formatted output to a stream. Copyright (C) 2004, 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. */ #ifdef HAVE_CONFIG_H # include #endif /* Specification. */ #include #include #include #include #include #include "fseterr.h" #include "vasnprintf.h" /* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */ #ifndef EOVERFLOW # define EOVERFLOW E2BIG #endif /* Print formatted output to the stream FP. Return string length of formatted string. On error, return a negative value. */ int vfprintf (FILE *fp, const char *format, va_list args) { char buf[2000]; char *output; size_t len; size_t lenbuf = sizeof (buf); output = vasnprintf (buf, &lenbuf, format, args); len = lenbuf; if (!output) { fseterr (fp); return -1; } if (fwrite (output, 1, len, fp) < len) { if (output != buf) { int saved_errno = errno; free (output); errno = saved_errno; } return -1; } if (len > INT_MAX) { errno = EOVERFLOW; fseterr (fp); return -1; } return len; } m4/vfprintf-posix.m4 = # vfprintf-posix.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_FUNC_VFPRINTF_POSIX], [ AC_REQUIRE([gl_EOVERFLOW]) AC_REQUIRE([gl_PRINTF_SIZES_C99]) AC_REQUIRE([gl_PRINTF_DIRECTIVE_A]) AC_REQUIRE([gl_PRINTF_DIRECTIVE_N]) AC_REQUIRE([gl_PRINTF_POSITIONS]) gl_cv_func_vfprintf_posix=no case "$gl_cv_func_printf_sizes_c99" in *yes) case "$gl_cv_func_printf_directive_a" in *yes) case "$gl_cv_func_printf_directive_n" in *yes) case "$gl_cv_func_printf_positions" in *yes) # vfprintf exists and is already POSIX compliant. gl_cv_func_vfprintf_posix=yes ;; esac ;; esac ;; esac ;; esac if test $gl_cv_func_vfprintf_posix = no; then if ! expr "$gl_cv_func_printf_directive_a" : ".*yes" > /dev/null; then AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], 1, [Define if the vasnprintf implementation needs special code for the 'a' and 'A' directives.]) fi gl_REPLACE_VASNPRINTF gl_REPLACE_VFPRINTF fi ]) AC_DEFUN([gl_REPLACE_VFPRINTF], [ AC_REQUIRE([gl_STDIO_H_DEFAULTS]) AC_LIBOBJ([vfprintf]) REPLACE_VFPRINTF=1 gl_PREREQ_VFPRINTF ]) AC_DEFUN([gl_PREREQ_VFPRINTF], [:]) === *** lib/stdio_.h9 Mar 2007 02:27:19 - 1.7 --- lib/stdio_.h9 Mar 2007 02:33:12 - *** *** 40,45 --- 40,59 #endif + #if @GNULIB_VFPRINTF_POSIX@ + # if @REPLACE_VFPRINTF@ + # define vfprintf rpl_vfprintf + extern int vfprintf (FILE *fp, const char *format, va_list args); + # endif + #elif defined GNULIB_POSIXCHECK + # undef vfprintf + # define vfprintf(s,f,a) \ + (GL_LINK_WARNING ("vfprintf is not always POSIX comp
new module 'fprintf-posix'
And here's the full POSIX compliant fprintf() module. 2007-03-08 Bruno Haible <[EMAIL PROTECTED]> * modules/fprintf-posix: New file. * lib/fprintf.c: New file. * m4/fprintf-posix.m4: New file. * m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): Set also GNULIB_FPRINTF_POSIX, REPLACE_FPRINTF. * lib/stdio_.h (fprintf): New declaration. * modules/stdio (Makefile.am): Substitute also GNULIB_FPRINTF_POSIX, REPLACE_FPRINTF. modules/fprintf-posix = Description: POSIX compatible fprintf() function: print formatted output to a stream Files: lib/fprintf.c m4/fprintf-posix.m4 m4/printf.m4 Depends-on: stdio fseterr vasnprintf isnan-nolibm isnanl-nolibm printf-frexp printf-frexpl configure.ac: gl_FUNC_FPRINTF_POSIX gl_STDIO_MODULE_INDICATOR([fprintf-posix]) Makefile.am: Include: License: LGPL Maintainer: Bruno Haible == lib/fprintf.c === /* Formatted output to a stream. Copyright (C) 2004, 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. */ #ifdef HAVE_CONFIG_H # include #endif /* Specification. */ #include #include #include #include #include #include "fseterr.h" #include "vasnprintf.h" /* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */ #ifndef EOVERFLOW # define EOVERFLOW E2BIG #endif /* Print formatted output to the stream FP. Return string length of formatted string. On error, return a negative value. */ int fprintf (FILE *fp, const char *format, ...) { char buf[2000]; char *output; size_t len; size_t lenbuf = sizeof (buf); va_list args; va_start (args, format); output = vasnprintf (buf, &lenbuf, format, args); len = lenbuf; va_end (args); if (!output) { fseterr (fp); return -1; } if (fwrite (output, 1, len, fp) < len) { if (output != buf) { int saved_errno = errno; free (output); errno = saved_errno; } return -1; } if (len > INT_MAX) { errno = EOVERFLOW; fseterr (fp); return -1; } return len; } m4/fprintf-posix.m4 === # fprintf-posix.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_FUNC_FPRINTF_POSIX], [ AC_REQUIRE([gl_EOVERFLOW]) AC_REQUIRE([gl_PRINTF_SIZES_C99]) AC_REQUIRE([gl_PRINTF_DIRECTIVE_A]) AC_REQUIRE([gl_PRINTF_DIRECTIVE_N]) AC_REQUIRE([gl_PRINTF_POSITIONS]) gl_cv_func_fprintf_posix=no case "$gl_cv_func_printf_sizes_c99" in *yes) case "$gl_cv_func_printf_directive_a" in *yes) case "$gl_cv_func_printf_directive_n" in *yes) case "$gl_cv_func_printf_positions" in *yes) # fprintf exists and is already POSIX compliant. gl_cv_func_fprintf_posix=yes ;; esac ;; esac ;; esac ;; esac if test $gl_cv_func_fprintf_posix = no; then if ! expr "$gl_cv_func_printf_directive_a" : ".*yes" > /dev/null; then AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], 1, [Define if the vasnprintf implementation needs special code for the 'a' and 'A' directives.]) fi gl_REPLACE_VASNPRINTF gl_REPLACE_FPRINTF fi ]) AC_DEFUN([gl_REPLACE_FPRINTF], [ AC_REQUIRE([gl_STDIO_H_DEFAULTS]) AC_LIBOBJ([fprintf]) REPLACE_FPRINTF=1 gl_PREREQ_FPRINTF ]) AC_DEFUN([gl_PREREQ_FPRINTF], [:]) *** m4/stdio_h.m4 9 Mar 2007 02:40:14 - 1.6 --- m4/stdio_h.m4 9 Mar 2007 02:56:17 - *** *** 21,32 --- 21,34 AC_DEFUN([gl_STDIO_H_DEFAULTS], [ + GNULIB_FPRINTF_POSIX=0; AC_SUBST([GNULIB_FPRINTF_POSIX]) GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF]) GNULIB_SPRINTF_POSIX=0; AC_SUBST([GNULIB_SPRINTF_POSIX]) GNULIB_VFPRINTF_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX])
new module 'vprintf-posix'
Here comes the POSIX compatible vprintf() substitute. 2007-03-08 Bruno Haible <[EMAIL PROTECTED]> * modules/vprintf-posix: New file. * lib/vprintf.c: New file. * m4/vprintf-posix.m4: New file. * m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): Set also GNULIB_VPRINTF_POSIX, REPLACE_VPRINTF. * lib/stdio_.h (vprintf): New declaration. * modules/stdio (Makefile.am): Substitute also GNULIB_VPRINTF_POSIX, REPLACE_VPRINTF. modules/vprintf-posix Description: POSIX compatible vprintf() function: print formatted output to standard output Files: lib/vprintf.c m4/vprintf-posix.m4 m4/printf.m4 Depends-on: stdio vfprintf-posix configure.ac: gl_FUNC_VPRINTF_POSIX gl_STDIO_MODULE_INDICATOR([vprintf-posix]) Makefile.am: Include: License: LGPL Maintainer: Bruno Haible === lib/vprintf.c = /* Formatted output to a stream. Copyright (C) 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. */ #ifdef HAVE_CONFIG_H # include #endif /* Specification. */ #include #include /* Print formatted output to standard output. Return string length of formatted string. On error, return a negative value. */ int vprintf (const char *format, va_list args) { return vfprintf (stdout, format, args); } = m4/vprintf-posix.m4 = # vprintf-posix.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_FUNC_VPRINTF_POSIX], [ AC_REQUIRE([gl_FUNC_VFPRINTF_POSIX]) if test $gl_cv_func_vfprintf_posix = no; then gl_REPLACE_VPRINTF fi ]) AC_DEFUN([gl_REPLACE_VPRINTF], [ AC_REQUIRE([gl_STDIO_H_DEFAULTS]) AC_LIBOBJ([vprintf]) REPLACE_VPRINTF=1 gl_PREREQ_VPRINTF ]) AC_DEFUN([gl_PREREQ_VPRINTF], [:]) === *** m4/stdio_h.m4 9 Mar 2007 02:59:39 - 1.7 --- m4/stdio_h.m4 9 Mar 2007 03:38:18 - *** *** 25,35 --- 25,37 GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF]) GNULIB_SPRINTF_POSIX=0; AC_SUBST([GNULIB_SPRINTF_POSIX]) GNULIB_VFPRINTF_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX]) + GNULIB_VPRINTF_POSIX=0; AC_SUBST([GNULIB_VPRINTF_POSIX]) GNULIB_VSNPRINTF=0; AC_SUBST([GNULIB_VSNPRINTF]) GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX]) dnl Assume proper GNU behavior unless another module says otherwise. REPLACE_FPRINTF=0; AC_SUBST([REPLACE_FPRINTF]) REPLACE_VFPRINTF=0; AC_SUBST([REPLACE_VFPRINTF]) + REPLACE_VPRINTF=0; AC_SUBST([REPLACE_VPRINTF]) REPLACE_SNPRINTF=0; AC_SUBST([REPLACE_SNPRINTF]) HAVE_DECL_SNPRINTF=1;AC_SUBST([HAVE_DECL_SNPRINTF]) REPLACE_VSNPRINTF=0; AC_SUBST([REPLACE_VSNPRINTF]) *** lib/stdio_.h9 Mar 2007 02:59:39 - 1.9 --- lib/stdio_.h9 Mar 2007 03:38:18 - *** *** 68,73 --- 68,87 vfprintf (s, f, a)) #endif + #if @GNULIB_VPRINTF_POSIX@ + # if @REPLACE_VPRINTF@ + # define vprintf rpl_vprintf + extern int vprintf (const char *format, va_list args); + # endif + #elif defined GNULIB_POSIXCHECK + # undef vprintf + # define vprintf(f,a) \ + (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \ + "use gnulib module vprintf-posix for portable " \ + "POSIX compliance"), \ + vprintf (f, a)) + #endif + #if @GNULIB_SNPRINTF@ # if @REPLACE_SNPRINTF@ # define snprintf rpl_snprintf *** modules/stdio 9 Mar 2007 02:59:39 - 1.7 --- modules/stdio 9 Mar 2007 03:38:18 - *** *** 25,34 --- 25,36 -e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \ -e 's|@''GNULIB_SPRINTF_POSIX''@|$(GNULIB_SPRINTF_POSIX)|g' \ -e 's|@''GNULIB_VFPRINTF_POSIX''@|$(GNULIB_VFPRINTF_POSIX)|g' \ + -e 's|@''GNULIB_VPRINTF_POSIX''@|$(GNULIB_VPRINTF_POSIX)|g' \ -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VS
Re: GNU M4 1.4.8b released (beta release)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Matthew Woehlke on 3/8/2007 10:59 AM: > Matthew Woehlke wrote: >> Well, it seems to have gotten past lib/ anyway. Will report back with >> how the test suite goes... > > Ok, 'make check results'... I got this: > > Checking ./012.macro_argu > @ ../doc/m4.texinfo:1358: Origin of test > ./012.macro_argu: status was 255, expected 1 Does your platform #define EXIT_FAILURE to 255 in ? If so, what exit status does /bin/false give? Should gnulib override EXIT_FAILURE to be 1 for consistency, or honor weird platforms that choose some other value (as is their right, according to POSIX) in which case I should teach the M4 testsuite to allow the system's notion of EXIT_FAILURE? One of the problems with setting EXIT_FAILURE to 255 is that it interferes with the POSIX rules for how xargs behaves, if that is an argument for replacing your unusual value with the more typical 1. > > 84-89 were skipped ("no changeword support") You have to configure with --enable-changeword if you want this feature; partly because it is obsolete and will not be supported in the eventual M4 2.0. - -- Don't work too hard, make some time for fun as well! Eric Blake [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFF8PUr84KuGfSFAYARAiPsAJ9bVg8EMrzXKN/97vuSimX6m3th9wCgtKSN 77OYN+PMR2Wl0ZpqFq8lMDA= =qoBv -END PGP SIGNATURE-
Re: new module 'fseterr'
Bruno Haible <[EMAIL PROTECTED]> writes: > if (dup2 (fd2, fd) < 0) > /* Whee... we botched the stream and now cannot restore it! */ > abort (); Hi! Consider making it possible to not use this workaround, but rather fail with a compilation error. I wouldn't want code that invoke abort in a library, for example. Thanks, Simon