Re: SKIP_FTRUNCATE_CHECK

2007-02-20 Thread Jim Meyering
Bruno Haible <[EMAIL PROTECTED]> wrote:
> This, I can't tell, as I'm only cross-compiling. I can't do more than "nm"
> on the object files.

At least we know gnulib-based applications that use ftruncate
will continue to link when compiled for mingw.

>> If we're no closer to removing the module, then we should document those
>> things while we're at it, since some of that code is very dusty.
>
> Like this? There's also some background about the other two alternatives at
> http://www.unixguide.net/unix/faq/3.3.shtml .

Dusty, indeed.

> --- lib/ftruncate.c   19 Feb 2007 02:24:42 -  1.12
> +++ lib/ftruncate.c   19 Feb 2007 23:56:54 -
> @@ -66,7 +66,7 @@
>  }
>
>  # else /* not F_CHSIZE nor F_FREESP */
> -#  if HAVE_CHSIZE
> +#  if HAVE_CHSIZE/* native Windows, e.g. mingw */

Thanks.  I applied that.




Re: [PATCH] Add !HAVE_MBRTOWC fallbacks for mbchar, mbiter and mbuiter

2007-02-20 Thread Miloslav Trmac
Hello,
Bruno Haible napsal(a):
> There are probably two uses of the mbchar, mbfile, mbiter, mbuiter modules:
>   (a) Use them only for MB_CUR_MAX > 1, and use simpler datatypes (just
>   'char' and pointers) for MB_CUR_MAX = 1.
>   (b) Use them always.
> 
> Since the speed difference between both approaches can be considerable,
> (a factor of 5 is not unusual), in gnulib we're most often using approach (a).
> Whereas your macros appear to be made for case (b) and not well usable for
> case (a).
Yes, OTOH you can still use them as in (a) without losing anything.

> Also, when MB_CUR_MAX = 1, the 'struct mbchar' can be replaced by a single
> 'char' - there is no need for a 'valid' boolean.
I have left c_valid to allow implementing the mbfile.h fallback, which
needs to distinguish between ELF and other char values.

> What do you think? Can this code be useful for you?
The macro approach is certainly technically optimal, OTOH I'm not sure
what the effect on the info source code would be.  It seems quite a few
functions would move to such include files, making the source code more
difficult to navigate.

Karl, what do you think?
Mirek




Re: fix inadequate Windows implementation of tmpfile

2007-02-20 Thread Bruno Haible
Ben Pfaff asked:
> I have not yet signed papers for gnulib contributions.  Should I?

Yes, please. Not only for tmpfile, but also for your future contributions.

Bruno





new module stdio

2007-02-20 Thread Bruno Haible
This is the semi-"complete" . It replaces the snprintf.h and
vsnprintf.h headers. So, it paves the way for new POSIX-compatible printf,
fprintf etc. replacements that Daniel Jacobowitz and/or Ben Pfaff want to
contribute.

2007-02-20  Bruno Haible  <[EMAIL PROTECTED]>

* modules/vsnprintf (Files): Remove lib/vsnprintf.h.
(Depends-on): Add stdio.
(configure.ac): Invoke gl_STDIO_MODULE_INDICATOR.
(Include): Use  instead of vsnprintf.h.
* m4/vsnprintf.m4 (gl_FUNC_VSNPRINTF): Require gl_STDIO_H_DEFAULTS. Set
HAVE_DECL_VSNPRINTF.
* lib/vsnprintf.c: Include  instead of vsnprintf.h.

* modules/snprintf (Files): Remove lib/snprintf.h.
(Depends-on): Add stdio.
(configure.ac): Invoke gl_STDIO_MODULE_INDICATOR.
(Include): Use  instead of snprintf.h.
* m4/snprintf.m4 (gl_FUNC_SNPRINTF): Require gl_STDIO_H_DEFAULTS. Set
HAVE_DECL_SNPRINTF.
* lib/snprintf.c: Include  instead of snprintf.h.
* lib/getaddrinfo.c: Likewise.

* modules/stdio: New file.
* lib/stdio_.h: New file, incorporating snprintf.h and vsnprintf.h.
* lib/snprintf.h: Remove file.
* lib/vsnprintf.h: Remove file.
* lib/.cppi-disable: Remove snprintf.h.
* m4/stdio_h.m4: New file.
* MODULES.html.sh (Support for systems lacking ISO C 99): Add stdio.

== modules/stdio ===
Description:
A GNU-like .

Files:
lib/stdio_.h
m4/stdio_h.m4

Depends-on:
absolute-header
link-warning

configure.ac:
gl_STDIO_H

Makefile.am:
BUILT_SOURCES += stdio.h

# We need the following in order to create  when the system
# doesn't have one that works with the given compiler.
stdio.h: stdio_.h
rm -f [EMAIL PROTECTED] $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
  sed -e 's|@''ABSOLUTE_STDIO_H''@|$(ABSOLUTE_STDIO_H)|g' \
  -e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \
  -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \
  -e 's|@''HAVE_DECL_SNPRINTF''@|$(HAVE_DECL_SNPRINTF)|g' \
  -e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \
  -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
  < $(srcdir)/stdio_.h; \
} > [EMAIL PROTECTED]
mv [EMAIL PROTECTED] $@
MOSTLYCLEANFILES += stdio.h stdio.h-t

Include:
#include 

License:
LGPL

Maintainer:
all
== lib/stdio_.h 
/* A GNU-like .

   Copyright (C) 2004, 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.  */

#if defined __need_FILE
/* Special invocation convention inside glibc header files.  */

#include @ABSOLUTE_STDIO_H@

#else
/* Normal invocation convention.  */
#ifndef _GL_STDIO_H
#define _GL_STDIO_H

#include @ABSOLUTE_STDIO_H@

#include 


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


#ifdef __cplusplus
extern "C" {
#endif


#if @GNULIB_SNPRINTF@
# if [EMAIL PROTECTED]@
extern int snprintf (char *str, size_t size, const char *format, ...);
# endif
#elif defined GNULIB_POSIXCHECK
# undef snprintf
# define snprintf \
(GL_LINK_WARNING ("snprintf is unportable - " \
  "use gnulib module snprintf for portability"), \
 snprintf)
#endif

#if @GNULIB_VSNPRINTF@
# if [EMAIL PROTECTED]@
extern int vsnprintf (char *str, size_t size, const char *format, va_list args);
# endif
#elif defined GNULIB_POSIXCHECK
# undef vsnprintf
# define vsnprintf(b,s,f,a) \
(GL_LINK_WARNING ("vsnprintf is unportable - " \
  "use gnulib module vsnprintf for portability"), \
 vsnprintf (b, s, f, a))
#endif


#ifdef __cplusplus
}
#endif

#endif /* _GL_STDIO_H */
#endif
== m4/stdio_h.m4 ===
# stdio_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_STDIO_H],
[
  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
  gl_ABSOLUTE_HEADER([stdio.h])
  ABSOLUTE_STDIO_H=\"$gl_cv_absolute_stdio_h\"
  AC_SUBST([ABSOLUTE_STDIO_H])
])

AC_DEFUN([gl_

Re: fix inadequate Windows implementation of tmpfile

2007-02-20 Thread Ben Pfaff
Bruno Haible <[EMAIL PROTECTED]> writes:

> Ben Pfaff asked:
>> I have not yet signed papers for gnulib contributions.  Should I?
>
> Yes, please. Not only for tmpfile, but also for your future contributions.

OK.  I filled out and emailed request-assign.future to
[EMAIL PROTECTED] just now.
-- 
"Then, I came to my senses, and slunk away, hoping no one overheard my
 thinking."
--Steve McAndrewSmith in the Monastery




minor gnulib fixups to help port latest coreutils to Solaris 10

2007-02-20 Thread Paul Eggert
I installed this to work around some porting problems on Solaris 10.
dirfd needs declaring.  And cc complains about rpl_putenv being
redeclared with a different type, since Solaris 10 header files
declare it with a char * arg.

2007-02-20  Paul Eggert  <[EMAIL PROTECTED]>

Minor fixups to port to Solaris 10 with Sun C 5.8.
* lib/getcwd.c [!_LIBC]: Include dirfd.h, since we use dirfd.
* modules/getcwd (Depends-on): Add dirfd.
* lib/putenv.c (putenv): #undef it.
(rpl_putenv): New decl.
(malloc, free): Include  rather than prototyping separately.

Index: lib/getcwd.c
===
RCS file: /cvsroot/gnulib/gnulib/lib/getcwd.c,v
retrieving revision 1.20
diff -u -p -r1.20 getcwd.c
--- lib/getcwd.c19 Feb 2007 20:03:22 -  1.20
+++ lib/getcwd.c21 Feb 2007 07:53:52 -
@@ -19,6 +19,7 @@
 #if !_LIBC
 # include 
 # include 
+# include "dirfd.h"
 #endif

 #include 
Index: lib/putenv.c
===
RCS file: /cvsroot/gnulib/gnulib/lib/putenv.c,v
retrieving revision 1.32
diff -u -p -r1.32 putenv.c
--- lib/putenv.c13 Sep 2006 22:38:14 -  1.32
+++ lib/putenv.c21 Feb 2007 07:53:52 -
@@ -20,6 +20,12 @@

 #include 

+/* undef putenv here, because some (e.g., Solaris 10) declare putenv in
+   with a non-const argument.  That would conflict with the declaration of
+   rpl_putenv below (due to the #define putenv rpl_putenv from config.h).  */
+#undef putenv
+int rpl_putenv (char const *);
+
 #include 

 /* Include errno.h *after* sys/types.h to work around header problems
@@ -29,15 +35,8 @@
 # define __set_errno(ev) ((errno) = (ev))
 #endif

-/* Don't include stdlib.h because some (e.g., Solaris 7) declare putenv
-   with a non-const argument.  That would conflict with the declaration of
-   rpl_putenv below (due to the #define putenv rpl_putenv from config.h).  */
-
-void *malloc ();
-void free ();
-
+#include 
 #include 
-
 #include 

 #if HAVE_GNU_LD
Index: modules/getcwd
===
RCS file: /cvsroot/gnulib/gnulib/modules/getcwd,v
retrieving revision 1.13
diff -u -p -r1.13 getcwd
--- modules/getcwd  19 Feb 2007 02:24:42 -  1.13
+++ modules/getcwd  21 Feb 2007 07:53:52 -
@@ -10,6 +10,7 @@ m4/getcwd.m4
 Depends-on:
 mempcpy
 d-ino
+dirfd
 extensions
 stdbool
 unistd




Re: one last snapshot before test release

2007-02-20 Thread Jim Meyering
Matthew Woehlke <[EMAIL PROTECTED]> wrote:
> Jim Meyering wrote:
>> I've made another snapshot:
>> http://meyering.net/cu/coreutils-6.7-dirty.tar.gz
>> http://meyering.net/cu/coreutils-6.7-dirty.tar.gz.sig
>> Please give it a try and report anything strange.
>> I expect to make a test release tomorrow.
>
> 'make && make check' is clean on AIX 5.1 (I only tested not-root,
> no-chgrp, nfs this round), but I get this on IRIX 6.5:
>
> cc-1153 cc: ERROR File = gettimeofday.c, Line = 105
>   Declaration is incompatible with previous "gettimeofday"
>   (declared at line 203 of "/usr/include/sys/time.h").
>
> extern int gettimeofday (/* unspecified arguments */);

Thanks for the quick feedback.
That's fall-out from some of the recent gnulib changes
in that area.  Here's the fix I've just committed:

* lib/gettimeofday.c (rpl_gettimeofday): Remove declaration
of gettimeofday.  It would conflict with the one now always
provided via sys_time_.h.  Reported by Matthew Woehlke, as
an IRIX 6.5 build failure.

Index: lib/gettimeofday.c
===
RCS file: /sources/gnulib/gnulib/lib/gettimeofday.c,v
retrieving revision 1.13
diff -u -p -r1.13 gettimeofday.c
--- lib/gettimeofday.c  18 Jan 2007 16:15:42 -  1.13
+++ lib/gettimeofday.c  21 Feb 2007 07:56:56 -
@@ -102,8 +102,6 @@ rpl_gettimeofday (struct timeval *restri
 {
 #undef gettimeofday
 #if HAVE_GETTIMEOFDAY
-  extern int gettimeofday (/* unspecified arguments */);
-
 # if GETTIMEOFDAY_CLOBBERS_LOCALTIME
   /* Save and restore the contents of the buffer used for localtime's
  result around the call to gettimeofday.  */