gl_GETADDRINFO won't work on Tru64 UNIX 5.1

2006-06-30 Thread Albert Chin
gl_GETADDRINFO uses the following to test for getaddrinfo:
  AC_SEARCH_LIBS(getaddrinfo, [nsl socket])

This won't work on Tru64 UNIX 5.1. No getaddrinfo() function exists in
libc. Rather, there exists ngetaddrinfo() and ogetaddrinfo():
  $ nm /usr/shlib/libc.so|grep getaddrinfo
  ngetaddrinfo | 0004395900636352 | T | 0008
  ogetaddrinfo | 0004395900637184 | T | 0008

>From :
  #if defined (_SOCKADDR_LEN) || defined (_XOPEN_SOURCE_EXTENDED)
  #define getaddrinfo ngetaddrinfo
  #else
  #define getaddrinfo ogetaddrinfo
  #endif

The best way to test for getaddrinfo() is to compile a small program
using the function and include .

-- 
albert chin ([EMAIL PROTECTED])




Re: [bug-gnulib] proposed simplification rewrite of stdint module

2006-06-30 Thread Bruno Haible
Paul Eggert wrote:
> >  : zero) + 1) << ((bits) ? (bits) - 1 : 0)) - 1) * 2 + 1)
> 
> Hmm, that's not quite right either, surely you meant (bits) - 2.

No, it appears correct as it is. For example, if bits==32, it will be
   ((1U << 31) - 1) * 2 + 1)
 = (0x7fffU * 2 + 1)
 = 0xU

> But I now thought of a simpler definition.  _STDINT_MAX needs only
> two arguments, and can be simplified to:
> 
> /* _STDINT_MAX relies on the signedness of 'zero' to return the
>correct type.  */
> #define _STDINT_MAX(bits, zero) (~ _STDINT_MIN (1, bits, zero))

Are you sure this will work for bits < 32? For example, for bits==16
it will evaluate to 0xU, not 0xU.

> OK, I'll change it to this, which follows the advice you gave:
> 
>#define int_fast8_t long int
>#define uint_fast8_t unsigned int_fast8_t
>#define int_fast16_t long int
>#define uint_fast16_t unsigned int_fast16_t
>#define int_fast32_t long int
>#define uint_fast32_t unsigned int_fast32_t

Thanks. That should be fine on all systems.

Bruno




Re: new module for temporary files in temporary directories

2006-06-30 Thread Ben Pfaff
Bruno Haible <[EMAIL PROTECTED]> writes:

> /* Create a temporary directory.
>PREFIX is used as a prefix for the name of the temporary directory. It
>should be short and still give an indication about the program.
>Return a fresh 'struct temp_dir' on success.  Upon error, an error message
>is shown and NULL is returned.  */
> extern struct temp_dir * create_temp_dir (const char *prefix);

I find the description just a little confusing: PREFIX is a
prefix for the *base name* of the temporary directory.  It
actually goes in the middle of the directory name.

I like the concept otherwise.  I can probably drop some code from
GNU PSPP if this is installed.  (PSPP also uses temporary files
for sorting.)
-- 
"Implementation details are beyond the scope of the Java virtual
 machine specification.  One should not assume that every virtual
 machine implementation contains a giant squid."
--"Mr. Bunny's Big Cup o' Java"





Re: [bug-gnulib] proposed simplification rewrite of stdint module

2006-06-30 Thread Paul Eggert
Bruno Haible <[EMAIL PROTECTED]> writes:

> No, it appears correct as it is. For example, if bits==32, it will be
>((1U << 31) - 1) * 2 + 1)
>  = (0x7fffU * 2 + 1)
>  = 0xU

You're right, of course.  That's what I get for writing without testing.
Sorry about the noise.  I'll change it to your suggestion.  Thanks.




fstat on mingw

2006-06-30 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

This bit me when trying to compile m4 on mingw.  Apparently, fstat always
returns st_ino of 0 on a regular file, but m4 was trying to see if stdout
and a debug file were the same by comparing st_ino, in order to close the
debug file only if it wasn't also stdout.  As a result, debug output ended
up on stdout instead of stderr where it belonged.

OK to document this issue?

doc/ChangeLog:
2006-06-30  Eric Blake  <[EMAIL PROTECTED]>

* functions.texi (Function Portability): Document fstat
limitation on mingw.

- --
Life is short - so eat dessert first!

Eric Blake [EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEpXDK84KuGfSFAYARAkN1AJ9pcLaBCOLxQTUCKzkLEJhkEosDCACgnDIb
kggADloHqUnruXSeeMzATNw=
=n8u0
-END PGP SIGNATURE-
Index: doc/functions.texi
===
RCS file: /sources/gnulib/gnulib/doc/functions.texi,v
retrieving revision 1.4
diff -u -p -r1.4 functions.texi
--- doc/functions.texi  29 Jun 2006 22:15:49 -  1.4
+++ doc/functions.texi  30 Jun 2006 18:40:00 -
@@ -187,6 +187,9 @@ On Cygwin, @code{fstat} applied to the f
 different @code{st_ino} values, even if standard input and standard output
 are not redirected and refer to the same terminal.
 
+On mingw, @code{fstat} sets @code{st_ino} to 0 for all regular files,
+even if the file descriptors are for distinct files.
+
 @item ftime
 This function is marked as ``legacy'' in POSIX.  Better use @code{gettimeofday}
 or @code{clock_gettime} instead, and use @code{ftime} only as a fallback for


Re: fstat on mingw

2006-06-30 Thread Paul Eggert
Eric Blake <[EMAIL PROTECTED]> writes:

>   * functions.texi (Function Portability): Document fstat
>   limitation on mingw.

That's only one of the limitations.  As I understand it, the
limitations include;

st_atime, st_mtime, and st_ctime may not have 1-second resolution.

st_gid and st_uid are always 0.

st_dev and st_rdev are always equal.  It's not clear to me when
they're zero; the Microsoft documentation for _fstat says "If a
device, handle; otherwise 0." whereas for _stat it says "Drive number
of the disk containing the file",

st_ino is "meaningless" (see
).

st_mode's rw bits have some constraints on them (I don't know what),
and its x bits are determined from the file name extension (!).

st_nlink is always 1 on non-NTFS file systems.  (Dunno about NTFS.)

Also, you must include  before .

Also, similar limitations apply to lstat and stat.

Also, I've heard that lstat and stat fail if passed a drive identifier
like "A:".

(There may be some other limitations too, but you're the DOS expert.  :-)

This is starting to get complicated.  Perhaps we should move the
Microsoft-related stuff into a separate file, and simply
cross-reference to it from the main files.  Many GNU developers don't
care much about porting to systems that have these problems.




typo in getaddrinfo.c

2006-06-30 Thread Mark D. Baushke
Fixed in CVS sources.

-- Mark

2006-06-30  Jim Hyslop <[EMAIL PROTECTED]>

* getaddrinfo.c: fixed typo

Index: getaddrinfo.c
===
RCS file: /sources/gnulib/gnulib/lib/getaddrinfo.c,v
retrieving revision 1.10
diff -u -p -u -p -r1.10 getaddrinfo.c
--- getaddrinfo.c   29 Jun 2006 15:16:56 -  1.10
+++ getaddrinfo.c   1 Jul 2006 00:37:49 -
@@ -167,7 +167,7 @@ getaddrinfo (const char *restrict nodena
   if (!se)
{
  char *c;
- if (!(*servname >= '0' && *servname <= '9))
+ if (!(*servname >= '0' && *servname <= '9'))
return EAI_NONAME;
  port = strtoul (servname, &c, 10);
  if (*c || port > 0x)




Re: typo in getaddrinfo.c

2006-06-30 Thread Simon Josefsson
"Mark D. Baushke" <[EMAIL PROTECTED]> writes:

> Fixed in CVS sources.

Installed, thanks!

>
>   -- Mark
>
> 2006-06-30  Jim Hyslop <[EMAIL PROTECTED]>
>
>   * getaddrinfo.c: fixed typo
>
> Index: getaddrinfo.c
> ===
> RCS file: /sources/gnulib/gnulib/lib/getaddrinfo.c,v
> retrieving revision 1.10
> diff -u -p -u -p -r1.10 getaddrinfo.c
> --- getaddrinfo.c 29 Jun 2006 15:16:56 -  1.10
> +++ getaddrinfo.c 1 Jul 2006 00:37:49 -
> @@ -167,7 +167,7 @@ getaddrinfo (const char *restrict nodena
>if (!se)
>   {
> char *c;
> -   if (!(*servname >= '0' && *servname <= '9))
> +   if (!(*servname >= '0' && *servname <= '9'))
>   return EAI_NONAME;
> port = strtoul (servname, &c, 10);
> if (*c || port > 0x)