d2e0872d74d61d8e58f5f16b5d524a17341b6609
[gnulib.git] / lib / ChangeLog
1 2006-01-25  Bruno Haible  <bruno@clisp.org>
2
3         * stdbool_.h (_Bool) [IRIX cc]: Define as 'signed char', to avoid
4         warnings.
5         Reported by Paul Eggert.
6
7 2006-01-25  Jim Meyering  <jim@meyering.net>
8
9         * fileblocks.c: Remove more useless parentheses.
10         * readutmp.h: Likewise.
11
12 2006-01-24  Bruno Haible  <bruno@clisp.org>
13
14         * stdbool_.h (_Bool) [__cplusplus]: Don't define if the compiler already
15         has it.
16         Report and patch by Albert Chin-A-Young  <china@thewrittenword.com> on
17         2005-11-26.
18
19         * stdbool_.h (_Bool) [HP-UX cc, AIX cc,xlc]: Define as 'signed char'
20         to avoid problems with the built-in _Bool type.
21         Reported by Paul Eggert on 2005-11-26.
22
23 2006-01-24  Jim Meyering  <jim@meyering.net>
24
25         * socket_.h: Remove useless parentheses in uses of cpp `defined'.
26
27 2006-01-24  Simon Josefsson  <jas@extundo.com>
28
29         * socket_.h (SHUT_WR, SHUT_RDWR): Don't hardcode, suggested by
30         Bruno.
31
32 2006-01-23  Paul Eggert  <eggert@cs.ucla.edu>
33
34         Work around porting bugs reported by Dieter in
35         <http://lists.gnu.org/archive/html/bug-bison/2006-01/msg00049.html>.
36         * getopt.c (_NOPROTO): Remove; no longer needed.
37         Include <stdlib.h> and <unistd.h> in all environments; it's safe now.
38         Include "getopt.h" first, to check interface.
39         (getenv): Declare only if defined HAVE_DECL_GETENV &&
40         !HAVE_DECL_GETENV.
41         * strndup.c [!_LIBC]: Include "strndup.h" to get prototype.
42         (__strndup): Revert to K&R-style function dfns, the glibc style.
43         * strnlen.c: Don't claim it's taken from glibc; it's not.
44         (strnlen, __strnlen): Remove #defines and #undefs; not needed.
45         Include strnlen.h first, to get prototype properly.
46         (strnlen): Renamed from __strnlen.
47         Remove weak alias.
48
49 2006-01-23  Ulrich Drepper  <drepper@redhat.com>
50
51         These changes imported from libc.
52         * getopt.c: Use __fxprintf instead of inline stream orientation
53         test and two separate function calls.
54         * strndup.c (__strndup): Add libc_hidden_def.
55
56 2006-01-22  Bruno Haible  <bruno@clisp.org>
57
58         * vasnprintf.c (VASNPRINTF): In the computation of the size of the
59         temporary buffer for sprintf, take into account the precision also
60         for 'd', 'i', 'u', 'o', 'x', 'X'.
61
62 2006-01-22  Paul Eggert  <eggert@cs.ucla.edu>
63
64         * quotearg.c (quotearg_buffer_restyled): Add "default: break;"
65         to pacify gcc -Wswitch-default.
66
67 2006-01-21  Sergey Poznyakoff  <gray@gnu.org.ua>
68
69         * argp-help.c (usage_long_opt): Do not print DOC options.
70         (__argp_base_name): Removed
71         * argp-namefrob.h (__argp_basename): Removed definition. Was a
72         typo.
73         (__argp_base_name): Provide macro definition or extern declaration
74         depending on the configuration
75
76 2006-01-20  Simon Josefsson  <jas@extundo.com>
77
78         * inet_ntop.h: Unconditionally include sys/socket.h.
79
80 2006-01-19  Simon Josefsson  <jas@extundo.com>
81
82         * socket_.h: Map SHUT_RD, SHUT_WR, SHUT_RDWR correctly.
83
84 2006-01-12  Simon Josefsson  <jas@extundo.com>
85
86         * base64.c: Fix warning, reported by Bruno Haible
87         <bruno@clisp.org> and patch by Paul Eggert <eggert@CS.UCLA.EDU>.
88
89 2006-01-11  Paul Eggert  <eggert@cs.ucla.edu>
90
91         Sync from coreutils.
92         * md5.c: Fix commentary typos.
93         (alignof, UNALIGNED_P): No need for a GCC-specific version.
94         * md5.h (__attribute__): Remove; unused.
95         * sha1.c: Fix commentary to match md5 better.
96         * sha1.h (struct sha1_ctx): Use a word buffer, not a byte buffer,
97         so that we don't need to worry about alignment.  All uses changed.
98         This merges the 2005-10-28 md5 change into sha1.
99
100 2006-01-11  Jim Meyering  <jim@meyering.net>
101
102         Sync from coreutils.
103         * md5.c (OP): Fix spacing.
104
105 2006-01-11  Simon Josefsson  <jas@extundo.com>
106
107         * stdint_.h (SIZE_MAX): Add missing (.
108
109 2006-01-10  Bruno Haible  <bruno@clisp.org>
110
111         * argp.h (__const): Remove macro. Use const instead.
112         * argp-fmtstream.h (__const): Likewise.
113         * glob_.h (__const): Remove macro.
114         * glob-libc.h: Use const instead of __const.
115
116 2006-01-10  Jim Meyering  <jim@meyering.net>
117
118         Avoid the double-free (first in fts_read, second in fts_close) that
119         would occur when an `active' directory is made inaccessible (e.g.,
120         via chmod a-x) during a traversal.
121         * fts.c (fts_read): After a failed fchdir, update sp->fts_cur
122         before returning.  Reproduce this failure by
123         mkdir -p a/b; cd a; chmod a-x . b
124         Reported by Stavros Passas.
125
126         Sync from coreutils.
127         * sha1.c: Tweak grammar in a comment.
128
129 2006-01-10  Paul Eggert  <eggert@cs.ucla.edu>
130
131         * regex_internal.h (BITSET_WORD_BITS):
132         Work around a bug in 64-bit PGC (before version 6.1-2), where the
133         preprocessor mishandles large unsigned values as if they were signed.
134         Problem reported by Claudio Fontana in
135         <http://lists.gnu.org/archive/html/bug-gnulib/2005-12/msg00061.html>.
136
137 2006-01-10  Simon Josefsson  <jas@extundo.com>
138
139         * socket_.h: New file.
140
141 2006-01-10  Bruno Haible  <bruno@clisp.org>
142
143         * localcharset.c: Update from GNU gettext.
144
145 2006-01-09  Paul Eggert  <eggert@cs.ucla.edu>
146
147         Sync from coreutils.
148         * chdir-long.c (cdb_free): Don't bother trying to open directory
149         for write access: POSIX says that must fail.
150         * fts.c (diropen): Likewise.
151         * save-cwd.c (save_cwd): Likewise.
152         * chdir-long.c (cdb_free): Open with O_NOCTTY | O_NONBLOCK as
153         well, for minor improvements on hosts that lack O_DIRECTORY.
154         * chown.c (rpl_chown) [CHOWN_MODIFIES_SYMLINK]:
155         Don't try O_WRONLY unless O_RDONLY failed wth EACCES.
156         Fall back on chown if open failed with EACCES.
157
158         * gettime.c (gettime) [!defined OK_TO_USE_1S_CLOCK]:
159         Report an error at compile-time if only a 1-second nominal clock
160         resolution is found.
161
162         * lchmod.h: New file.
163         * mkdir-p.c: Include lchmod.h, lchown.h.
164         (make_dir_parents): Use lchown rather than chown, and
165         lchmod rather than chmod.
166
167         * mountlist.c (ME_DUMMY): "none" and "proc" file systems are dummies
168         too.  Problem with "none" reported by Bob Proulx.  Problem with
169         "proc" reported by n0dalus.
170
171         * mountlist.c: Include <limits.h>.
172         (dev_from_mount_options)
173         [defined MOUNTED_GETMNTENT1 || defined MOUNTED_GETMNTENT2]:
174         New function.  It no longer assumes "dev=" has the System V meaning
175         on Linux (since it doesn't).  It also parses "dev=" more carefully.
176         (read_file_system_list)
177         [defined MOUNTED_GETMNTENT1 || defined MOUNTED_GETMNTENT2]: Use it.
178         MOUNTED_GETMNTENT2 is new here; the code didn't used to look for
179         dev= in that case.
180
181         * posixtm.h (PDS_PRE_2000): New macro.
182         * posixtm.c (year): Arg is now syntax_bits rather than allow_century.
183         All usages changed.  Reject dates outside the range 1969-1999 if
184         PDS_PRE_2000 is used.
185
186 2006-01-09  Jim Meyering  <jim@meyering.net>
187
188         Sync from coreutils.
189
190         * version-etc.c (COPYRIGHT_YEAR): Update to 2006.
191
192         * chdir-safer.h, chdir-safer.c: New files.
193
194         * modechange.c (mode_compile): Reject an invalid mode string
195         that starts with an octal digit.  From Andreas Gruenbacher.
196
197         * openat.c: Include "fcntl--.h" and "unistd--.h", to map open
198         and dup to open_safer and dup_safer, respectively.
199         (openat_permissive): Fix typo in comment.
200
201         * openat.c: Don't include <stdlib.h>, <unistd.h>, <fcntl.h>,
202         "gettext.h"; either no longer needed or are guaranteed by openat.h.
203         (_): Remove; no longer needed.
204         (openat): Renamed from rpl_openat; no need for rpl_openat
205         since openat.h renames openat for us.
206         Replace most of the body with a call to openat_permissive,
207         to avoid duplicate code.
208         Port to (probably hypothetical) environments were mode_t is
209         wider than int.
210         (openat_permissive): Require mode arg, so that we can check
211         types better.  Put it just after flags.  Change cwd failure
212         indicator from pointer-to-bool to pointer-to-errno-value.
213         All callers changed.
214         Invoke openat_save_fail and/or openat_restore_fail if
215         cwd_errno is null, so that openat can call us.
216         (openat_permissive, fdopendir, fstatat, unlinkat):
217         Simplify errno handling to avoid some duplicate code,
218         as it's OK to set errno on success.
219         * openat.h: Revamp code so that function macros depend on
220         __OPENAT_PREFIX only, not also on AT_FDCWD.
221         (openat_ro): Remove.  Caller changed to use openat_permissive.
222         (openat_permissive): Now a macro, if not a function.
223         (openat_restore_fail, openat_save_fail): Now always functions,
224         since mkdirat needs them even if __OPENAT_PREFIX is defined.
225
226         * openat-priv.h: New file, defining macros used by mkdirat.c
227         and openat.c.
228         * mkdirat.c: Include openat-priv.h.
229         Remove definitions of macros defined therein.
230         * openat.c: Likewise.
231
232         * mkdirat.c (mkdirat): New file and function.
233         * openat.h (mkdirat): Declare.
234
235         * openat.c (fdopendir): Don't change errno when returning non-NULL.
236
237         * openat.h (openat_permissive): Declare.
238         (openat_ro): Define.
239
240         * openat.c (EXPECTED_ERRNO): New macro.
241         (openat_permissive): New function -- used in remove.c rewrite.
242         (all functions): Set errno just before returning, only if there
243         was an actual failure.
244         Use EXPECTED_ERRNO rather than comparing against only ENOTDIR.
245
246         Emulate openat-family functions using Linux's procfs, if possible.
247         Idea and some code based on Ulrich Drepper's glibc changes.
248
249         * openat.c: (BUILD_PROC_NAME): New macro.
250         Include <stdio.h>, <string.h>, "alloca.h" and "intprops.h".
251         (rpl_openat): Emulate by trying to open /proc/self/fd/%d/%s,
252         before falling back on save_cwd and restore_cwd.
253         (fdopendir, fstatat, unlinkat): Likewise.
254
255         * openat.c (fstatat, unlinkat): Perform the syscall directly,
256         skipping the save_cwd...restore_cwd overhead, if FILE is absolute.
257
258         * openat.c (rpl_openat): Use the promoted type (int), not mode_t,
259         as second argument to va_arg.  Otherwise, some versions of gcc
260         warn that `if this code is reached, the program will abort'.
261
262 2006-01-09  Andreas Gruenbacher  <agruen@suse.de>
263
264         Sync from coreutils.
265
266         Add POSIX ACL support
267         * acl.h (copy_acl, set_acl): Add declarations.
268         * acl.c (acl_entries): Add fallback implementation for POSIX ACL
269         systems other than Linux.
270         (chmod_or_fchmod): New function: use fchmod when possible,
271         and chmod otherwise.
272         (file_has_acl): Add a POSIX ACL implementation, with a
273         Linux-specific subcase.
274         (copy_acl): Add: copy an acl and S_ISUID, S_ISGID, and
275         S_ISVTX from one file to another.  Fall back to fchmod/chmod when
276         acls are unsupported.
277         (set_acl): Add: set a file's acl and S_ISUID, S_ISGID, and
278         S_ISVTX to a defined value.  Fall back to fchmod/chmod when acls
279         are unsupported.
280
281 2006-01-09  Bruno Haible  <bruno@clisp.org>
282
283         * sysexit_.h (EX_OK): New macro.
284         Suggested by Martin Lambers <marlam@marlam.de>.
285
286 2006-01-09  Bruno Haible  <bruno@clisp.org>
287
288         * javacomp.sh.in: Move to ../build-aux/javacomp.sh.in.
289         * javaexec.sh.in: Move to ../build-aux/javaexec.sh.in.
290         * csharpcomp.sh.in: Move to ../build-aux/csharpcomp.sh.in.
291         * csharpexec.sh.in: Move to ../build-aux/csharpexec.sh.in.
292
293 2006-01-09  Bruno Haible  <bruno@clisp.org>
294
295         * stdint_.h (SIZE_MAX): Write the value without involving negative
296         numbers.
297
298 2005-10-16  Bruno Haible  <bruno@clisp.org>
299
300         * stdint_.h: On Linux libc4 and libc5, include <sys/bitypes.h> and
301         don't define _STDINT_H_NEED_SIGNED_INT_TYPES.
302
303 2006-01-04  Paul Eggert  <eggert@cs.ucla.edu>
304
305         * strftime.c (tzname): Don't declare if it is already #defined.
306         Problem reported for Mingw by Mark Junker.
307
308 2006-01-03  Paul Eggert  <eggert@cs.ucla.edu>
309
310         * xtime.h (xtime_make, xtime_nonnegative_nsec, xtime_nsec): Use
311         long int, not int, for nanosecond counts, so that people who are
312         used to POSIX struct timespec won't be surprised.  Reported by Jim
313         Meyering.
314
315 2005-12-16  Jim Meyering  <jim@meyering.net>
316
317         * fprintftime.c, fprintftime.h: New files.
318
319 2005-12-10  Sergey Poznyakoff  <gray@gnu.org.ua>
320
321         * argp-fmtstream.c (__argp_fmtstream_update): Fix coredump
322         * argp-help.c (fill_in_uparams): Check if the constructed
323         struct uparams is valid. Fall back to the default values if it is
324         not.
325
326 2005-12-09  Sergey Poznyakoff  <gray@gnu.org.ua>
327
328         * argp-help.c (__argp_base_name): New function
329         (__argp_short_program_name): Rewrite using __argp_base_name
330         * argp-namefrob.h: Define program_invocation_name and
331         program_invocation_short_name if requested
332         (__argp_base_name): Add prototype
333         * argp-parse.c (argp_def): Use gettext wrappers
334         (argp_default_parser): Use __argp_base_name
335         * argp-pin.c: New file. Defines program_invocation_name and
336         program_invocation_short_name on systems that lack them.
337
338 2005-12-07  Paul Eggert  <eggert@cs.ucla.edu>
339
340         * stat-time.h (STATE_TIMESPEC, STAT_TIMESPEC_NS): Add check for
341         TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC, to fix IRIX 5.3
342         porting problem reported by Georg Schwarz in
343         <http://lists.gnu.org/archive/html/bug-coreutils/2005-12/msg00083.html>.
344
345 2005-07-09  Bruno Haible  <bruno@clisp.org>
346
347         * csharpcomp.sh.in (options_csc): For -l option, add a .dll suffix.
348         * csharpcomp.c (compile_csharp_using_sscli): Likewise.
349         Reported by Mark Junker <mjscod@gmx.de>.
350
351 2005-11-29  Paul Eggert  <eggert@cs.ucla.edu>
352
353         * stdint_.h (intmax_t) [defined intmax_t]: Do not declare.
354         (uintmax_t) [defined uintmax_t]: Do not declare.
355         (SIZE_MAX) [defined SIZE_MAX]: Do not define.
356         This works around a problem if intmax_t.m4 and/or uintmax_t.m4
357         and/or size_max.m4 are also used.  Problem reported by Mark D. Baushke.
358         (SIZE_MAX): Define to ((size_t) -1), not (~(size_t)0), for the
359         sake of portability to weird hosts that C allows (though we don't
360         know of any practical examples).
361
362         * savedir.h (fdsavedir): New decl.
363         * savedir.c (fdsavedir, savedirstream): New functions; the latter
364         contains most of the former guts of savedir.
365         (savedir): Use savedirstream.
366         Include "openat.h".
367
368 2005-11-15  Paul Eggert  <eggert@cs.ucla.edu>
369
370         * xstrtod.c: Don't bother with #pragma STDC FENV_ACCESS ON, as
371         coreutils no longer futzes with rounding modes.
372
373 2005-11-14  Jim Meyering  <jim@meyering.net>
374
375         * mkstemp-safer.c: Include <config.h>, required for possible
376         replacement of mkstemp.
377
378 2005-11-10  Paul Eggert  <eggert@cs.ucla.edu>
379
380         * gethrxtime.c: Include "timespec.h" rather than the sys/time / time
381         business.
382         (gethrxtime) [! (HAVE_NANOUPTIME
383         || (defined CLOCK_MONOTONIC && HAVE_CLOCK_GETTIME)
384         || HAVE_MICROUPTIME)]: Fall back on gettime rather than rolling
385         our own approximation.
386
387 2005-11-10  Simon Josefsson  <jas@extundo.com>
388
389         * readline.c: Remove EOL.
390
391 2005-11-08  Eric Blake  <ebb9@byu.net>
392
393         * inet_ntop.h: Use #if !, not #ifndef, for AC_CHECK_DECLS.
394
395 2005-11-08  Eric Blake  <ebb9@byu.net>
396
397         * getaddrinfo.h: Use #if !, not #ifndef, for AC_CHECK_DECLS.
398
399 2005-10-30  Paul Eggert  <eggert@cs.ucla.edu>
400
401         Fix porting problem reported by Theodoros V. Kalamatianos.
402         * utimens.c (futimens) [HAVE_WORKING_UTIMES && HAVE_FUTIMES]:
403         Don't assume that futimes failing means we must fail.
404
405 2005-10-29  Paul Eggert  <eggert@cs.ucla.edu>
406
407         * getcwd.c (__getcwd): Don't assume that system calls after readdir
408         leave errno alone.  Problem reported by Dmitry V. Levin.
409
410 2005-10-28  Paul Eggert  <eggert@cs.ucla.edu>
411
412         * savedir.c (savedir): Don't assume that xrealloc etc. leave
413         errno alone.  Problem reported by Frederic Jolliton.
414
415 2005-10-28  Simon Josefsson  <jas@extundo.com>
416
417         * inet_ntop.h, inet_ntop.c: Make it work under mingw32: Add
418         "restrict" keywords, as per POSIX.  Protect the function
419         declaration around HAVE_DECL_INET_NTOP rather than HAVE_INET_NTOP.
420         Don't use K&R prototypes.  Check the sprintf return values.
421         Re-define EAFNOSUPPORT if not present.  Indent.
422
423         * md5.h, md5.c: Simplify buffer handling visavi alignment,
424         suggested by Bruno Haible <bruno@clisp.org>.
425
426         * gc-gnulib.c, gc-libgcrypt.c: Check calloc return value.
427
428         * gc.h: Add MD2 and RMD160 length defines.  Add prototypes.
429
430         * gc-libgcrypt.c: Add MD2 (which is not available through
431         libgcrypt).
432
433         * gc-gnulib.c: Add MD2.  Implement gc_hash_* API.
434
435         * md2.h, md2.c: New files.
436
437 2005-10-24  Simon Josefsson  <jas@extundo.com>
438
439         * md4.h: Shrink buffer size, now that we changed the type.
440
441 2005-10-22  Simon Josefsson  <jas@extundo.com>
442
443         * arcfour.h, arcfour.c: Use fixed size indices in the
444         arcfour_context struct (simplify test vector testing in GNU
445         Shishi).
446
447 2005-10-22  Simon Josefsson  <jas@extundo.com>
448
449         * md4.h, md4.c: Simplify buffer handling visavi alignment,
450         suggested by Bruno Haible <bruno@clisp.org>.
451
452 2005-10-22  Simon Josefsson  <jas@extundo.com>
453
454         * crc.h: Include stddef.h, for size_t.
455
456 2005-10-21  Simon Josefsson  <jas@extundo.com>
457
458         * arctwo.h (arctwo_setkey): Protect variable in CPP macro,
459         suggested by Ralf Wildenhues <Ralf.Wildenhues@gmx.de>.
460
461 2005-10-21  Simon Josefsson  <jas@extundo.com>
462
463         * rijndael-api-fst.c: Fix bugs in CBC mode for more than one
464         block.
465
466 2005-10-21  Simon Josefsson  <jas@extundo.com>
467
468         * gc-gnulib.c: Support ARCTWO in CBC mode.
469
470 2005-10-21  Simon Josefsson  <jas@extundo.com>
471
472         * hmac-md5.c (hmac_md5): Add comments, suggested by Bruno Haible
473         <bruno@clisp.org>.
474
475         * hmac-sha1.c (hmac_sha1): Likewise.
476
477         * crc.c (crc32_update): Actually use crc parameter, suggested by
478         Bruno Haible <bruno@clisp.org>.
479
480         * crc.h: Include stdint.h directly, suggested by Bruno Haible
481         <bruno@clisp.org>.
482
483 2005-10-21  Simon Josefsson  <jas@extundo.com>
484
485         * des.h, des.c: New files.
486
487         * gc-gnulib.c: Support DES.c
488
489 2005-10-21  Simon Josefsson  <jas@extundo.com>
490
491         * arctwo.h, arctwo.c: New files.
492
493         * gc-gnulib.c: Support ARCTWO.
494
495 2005-10-21  Simon Josefsson  <jas@extundo.com>
496
497         * gc-libgcrypt.c (gc_cipher_open): Handle ECB.
498
499 2005-10-19  Simon Josefsson  <jas@extundo.com>
500
501         * gc-gnulib.c: Support ARCFOUR.
502
503 2005-10-19  Simon Josefsson  <jas@extundo.com>
504
505         * gc-gnulib.c: Implement gc_cipher_* API, currently only with AES
506         support.
507
508         * gc.h: Add ECB enum type.
509
510         * hmac-md5.c, hmac-sha1.c: Include memxor.h.
511
512 2005-10-19  Simon Josefsson  <jas@extundo.com>
513
514         * gc.h, gc-gnulib.c, gc-libgcrypt.c: Support MD4.
515
516 2005-10-18  Simon Josefsson  <jas@extundo.com>
517
518         * md4.h, md4.c: New files, based on md5.?.
519
520 2005-10-17  Simon Josefsson  <jas@extundo.com>
521
522         * gc-libgcrypt.c (gc_hmac_sha1): Fix assert.
523
524         * gc.h (gc_nonce, gc_pseudo_random, gc_random): Add prototypes.
525
526 2005-10-17  Simon Josefsson  <jas@extundo.com>
527
528         * gc.h, gc-libgcrypt.c: Add more hash types/functions.
529
530 2005-10-17  Simon Josefsson  <jas@extundo.com>
531
532         * gc.h, gc-libgcrypt.c: Add ciphers.
533
534 2005-10-17  Simon Josefsson  <jas@extundo.com>
535
536         * sha1.c: Use uint32_t instead of md5_uint32.t
537
538         * sha1.h: Use stdint.h and uint32_t instead of md5_uint32 from
539         md5.h.
540
541         * md5.c: Use uin32_t.  Fix non-gcc UNALIGNED_P macro.
542
543         * md5.h: Use stdint.h and uint32_t.  Doc fix.
544
545 2005-10-15  Simon Josefsson  <jas@extundo.com>
546
547         * rijndael-api-fst.h, rijndael-api-fst.c: New files.
548
549         * rijndael-alg-fst.h, rijndael-alg-fst.c: New files.
550
551 2005-10-14  Simon Josefsson  <jas@extundo.com>
552
553         * arcfour.h, arcfour.c: New files.
554
555 2005-10-14  Paul Eggert  <eggert@cs.ucla.edu>
556
557         * obstack.c [defined _LIBC && defined USE_IN_LIBIO]: Don't
558         include <wchar.h>; no longer needed.
559
560 2005-10-14  Jakub Jelinek  <jakub@redhat.com>
561        and  Ulrich Drepper  <drepper@redhat.com>
562
563         Import from libc.
564         * obstack.c (print_and_abort) [defined _LIBC]: Use __fxprintf
565         instead of inline stream orientation test and two separate
566         function calls.  Pay no attention to USE_IN_LIBIO.
567
568 2005-10-14  Roland McGrath  <roland@redhat.com>
569
570         Import from libc.  [BZ #1331]
571         * obstack.h [!__STDC__] (obstack_int_grow_fast): Fix misnamed
572         macro argument.
573         Reported by Matej Vela <vela@debian.org>.
574
575 2005-10-13  Paul Eggert  <eggert@cs.ucla.edu>
576
577         * mkdir-p.c (make_dir_parents): Don't report an error if an
578         intermediate directory is in a read-only file system.  Problem
579         reported by Eric Blake.
580
581 2005-10-13  Simon Josefsson  <jas@extundo.com>
582
583         * gc-pbkdf2-sha1.c (gc_pbkdf2_sha1): Optimize CEIL computation.
584         Move memory allocation outside of loop.
585
586 2005-10-12  Simon Josefsson  <jas@extundo.com>
587
588         * gc-pbkdf2-sha1.c: New file.
589
590         * gc.h: Add gc_pbkdf2_sha1 prototype.
591
592 2005-10-12  Simon Josefsson  <jas@extundo.com>
593
594         * gc.h, gc-gnulib.c, gc-libgcrypt.c: Use Gc_rc for return types,
595         suggested by Bruno Haible <bruno@clisp.org>.
596
597 2005-10-12  Simon Josefsson  <jas@extundo.com>
598
599         * gc-libgcrypt.c (gc_hmac_sha1): New function.
600
601         * gc-gnulib.c (gc_hmac_sha1): New function.
602
603 2005-10-12  Simon Josefsson  <jas@extundo.com>
604
605         * gc.h, gc-gnulib.c, gc-libgcrypt.c: Support SHA-1.
606
607 2005-10-12  Simon Josefsson  <jas@extundo.com>
608
609         * gc-gnulib.c: Condition MD5 and HMAC-MD5 use on GC_USE_MD5 and
610         GC_USE_HMAC_MD5, respectively.
611
612         * gc-libgcrypt.c (gc_md5): Fix assert call.
613         (gc_md5): Fix typo.
614
615         * gc.h (gc_hash_buffer): Use gc_hash in prototype.
616
617         * gc-libgcrypt.c (gc_hash_buffer): Ditto.
618
619         * gc-gnulib.c (gc_hash_buffer): Ditto.
620
621 2005-10-11  Bruno Haible  <bruno@clisp.org>
622
623         * c-strcasestr.h: New file, from GNU gettext.
624         * c-strcasestr.c: New file, from GNU gettext.
625
626 2005-10-11  Bruno Haible  <bruno@clisp.org>
627
628         * c-strcase.h: New file, from GNU gettext.
629         * c-strcasecmp.c: New file, from GNU gettext.
630         * c-strncasecmp.c: New file, from GNU gettext.
631
632 2005-10-11  Simon Josefsson  <jas@extundo.com>
633
634         * crc.h, crc.c: New files.
635
636         * gc.h (gc_hash_buffer): Add doc.
637
638 2005-10-08  Simon Josefsson  <jas@extundo.com>
639
640         * gc.h: Add gc_hash and gc_hash_buffer.
641
642         * gc-gnulib.c (gc_hash_buffer): Add.  Reorder #include's.
643
644         * gc-libgcrypt.c (gc_hash_buffer): Add.
645
646 2005-10-11  Bruno Haible  <bruno@clisp.org>
647
648         * strcasecmp.c: Include limits.h.
649         (strcasecmp): Avoid integer overflow on exotic platforms.
650         * strncasecmp.c: Include limits.h.
651         (strncasecmp): Avoid integer overflow on exotic platforms.
652         Reported by Paul Eggert.
653
654 2005-10-06  Simon Josefsson  <jas@extundo.com>
655
656         * hmac-md5.c: New file.
657
658         * hmac.h: New file.
659
660 2005-10-06  Simon Josefsson  <jas@extundo.com>
661
662         * memxor.c (memxor): Avoid casts and warnings.
663
664 2005-10-05  Derek Price  <derek@ximbiot.com>
665
666         * getdelim.c (SIZE_MAX): New macro, if not already defined.
667
668 2005-10-05  Simon Josefsson  <jas@extundo.com>
669
670         * memxor.c (memxor): Fix compiler error.
671
672         * md5.h (MD5_DIGEST_SIZE, MD5_BLOCK_SIZE): Add, see also
673         <http://sourceware.org/bugzilla/show_bug.cgi?id=1423>.
674
675         * memxor.h, memxor.c: New files.
676
677         * getaddrinfo.h: Don't protect sys/types.h with HAVE_SYS_TYPES_H,
678         we assume all systems have it, suggested by Jim Meyering
679         <jim@meyering.net>.  Remove HAVE_SYS_SOCKET_H test too, to see if
680         any systems lack sys/socket.h; mingw32 is known to lack it, but we
681         don't support it yet anyway.  Also remove HAVE_NETDB_H test, for
682         same reasons.
683
684 2005-10-04  Bruno Haible  <bruno@clisp.org>
685
686         * verify.h (verify_true): Provide alternative definition for C++.
687
688 2005-10-04  Simon Josefsson  <jas@extundo.com>
689
690         * getaddrinfo.h: Move sys/types.h include first, reported by "Mark
691         D. Baushke" <mdb@gnu.org>.
692
693 2005-10-03  Paul Eggert  <eggert@cs.ucla.edu>
694
695         * getdelim.c: Include getdelim.h first.  Include <limits.h>.
696         (SSIZE_MAX): New macro, if not already defined.
697         (getdelim): Fix buffer overrun on 64-bit hosts with lines longer
698         than 2 GiB.
699
700 2005-10-02  Paul Eggert  <eggert@cs.ucla.edu>
701
702         * exclude.c: Include verify.h.
703         (verify): Remove.  All callers changed to use verify.h's version.
704         * strtoimax.c: Likewise.
705         * utimecmp.c: Likewis.e
706
707         Sync from coreutils.
708         * .cppi-disable: Add getaddrinfo.h, getdelim.h, getline.h, getpass.c
709         mbchar.h, mbuiter.h, strcase.h, strnlen.h, strnlen1.h.
710         * .cvsignore: Add fts.h, search.h, t-fpending.
711         * settime.c (settime): Fix { typo in previous patch.  Also, don't
712         bother returning ENOSYS if settimeofday or stime fails; just let
713         them return whatever errno they want to return.
714         * utimens.c: Include unistd.h, for dup2.
715         (futimens): Fix typo: HAVE_FUTIMESAT was misspelled in an #if.
716         (futimens) [! HAVE_FUTIMESAT]: If !file, set errno before returning -1.
717
718 2005-10-02  Jim Meyering  <jim@meyering.net>
719
720         Sync from coreutils.
721         * fts-cycle.c [HAVE_CONFIG_H]: Include <config.h>.
722         * openat-die.c: Use `#ifdef HAVE_CONFIG_H', not `#if HAVE_CONFIG_H'.
723         * openat.c (fdopendir): Do not define if HAVE_FDOPENDIR.
724         Remove AT_FDCWD test.
725         Do not consume the fd unless successful.
726         * openat.h (fdopendir): Do not define if HAVE_FDOPENDIR.
727         * settime.c (settime): Move the HAVE_STIME block `up' into an #elif
728         block, so that we don't even try to compile it if settimeofday is
729         available.  This works around a compilation failure on OSF1 V5.1,
730         due to stime requiring a `long int*' while tv_sec is `int'.
731
732 2005-09-30  Eric Blake  <ebb9@byu.net>  (tiny change)
733
734         * getdelim.c (getdelim): Remove unused variables.
735
736 2005-10-01  Simon Josefsson  <jas@extundo.com>
737
738         * getaddrinfo.h: Protect #include's of sys/socket.h and netdb.h.
739         Only define struct addrinfo if !HAVE_STRUCT_ADDRINFO.  Protect
740         AI_* and EAI_* definitions.  Protect function declarations.
741
742 2005-09-29  Paul Eggert  <eggert@cs.ucla.edu>
743
744         * xtime.h (XTIME_PRECISION): Now of type int, not long long int,
745         so that the code works even with ancient cpp.  Portability problem
746         with GCC 2.7.2.1 reported by Thomas M.Ott.
747
748 2005-09-27  Jim Meyering  <jim@meyering.net>
749
750         * getcwd.c: Change #ifdef<TAB>HAVE_CONFIG_H to #ifdef HAVE_CONFIG_H.
751
752         * intprops.h (signed_type_or_expr__): Define.
753         (INT_STRLEN_BOUND) [__GNUC__]: Use a slightly tighter bound
754         for unsigned types.
755
756 2005-09-26  Paul Eggert  <eggert@cs.ucla.edu>
757
758         * verify.h (verify_expr): Remove, replacing with:
759         (verify_true): New macro that returns true instead of void.
760         (verify_type__): Remove.
761         (verify): Use verify_true rather than verify_type__.
762
763 2005-09-24  Paul Eggert  <eggert@cs.ucla.edu>
764
765         * utimens.c (ENOSYS): Define if not already defined.
766         (futimens): Support having a null PATH if the file descriptor
767         is nonnegative.
768
769         * regex_internal.h (__GNUC_PREREQ, always_inline, inline, pure):
770         Remove.
771         (__attribute): Define to empty unless GCC 3.1 or later.
772         This works around a core dump on OpenBSD 3.4, which has GCC
773         2.95.3, which dumps core when given __attribute__(()).  It also
774         simplifies other tests, since we really don't want to bother with
775         worrying about which ancient version of GCC supported what.
776         Original problem reported by Yoann Vandoorselaere, with part of
777         the fix suggested by Derek Price.
778
779 2005-09-24  Jim Meyering  <jim@meyering.net>
780
781         * verify.h (verify_type__): Use `unsigned int' as the bitfield type
782         so we can once again use a positive bitfield width of 1 -- now we
783         don't have to explain why we were using a bitfield width of 2.
784
785 2005-09-23  Paul Eggert  <eggert@cs.ucla.edu>
786
787         * getaddrinfo.c [HAVE_NETINET_IN_H]: Include <netinet/in.h>.
788         Problem reported by Eric Blake.
789         (getaddrinfo): Initialize se so that it's not garbage.
790         Redo internal storage allocation so that it doesn't make unportable
791         assumptions about alignment.
792         Fix a memory leak.
793
794         * utimens.c (futimens): Use futimesat if available.
795         Prefer it to futimes since it doesn't have the futimes bug.
796
797         * verify.h (GL_CONCAT0, GL_CONCAT): Remove.
798         (verify): Don't use the __LINE__ trick, as it doesn't work in general.
799         Instead, declare a function that returns a pointer to an array,
800         and use verify_type__ to declare the size of the array.
801         Problem and germ of a solution reported by Bruno Haible.
802         (verify_type__): Use 2, not 1, for bitfield size, to avoid
803         a warning with Irix 6.5 cc.  Problem reported by Bruno Haible.
804
805 2005-09-22  Paul Eggert  <eggert@cs.ucla.edu>
806
807         Sync from coreutils.
808
809         * .cppi-disable: Add regcomp.c, regex_internal.c, regex_internal.h,
810         stat-time.h.
811         * argmatch.h: Include verify.h
812         (ARGMATCH_VERIFY): Use verify rather than rolling our own.
813         (ARGMATCH_ASSERT): Remove; unused.
814         * canonicalize.c: Assume STDC_HEADERS.
815         * exclude.c: Include "strcase.h".
816         * regex_internal.h [!defined _LIBC]: Likewise.
817         * getusershell.c: Include stdio--.h rather than stdio.h
818         and stdio-safer.h.
819         (getusershell): Call fopen, not fopen_safer.
820         * save-cwd.c: Include fcntl--.h rather than fcntl.h.
821         Do not include unistd-safer.h.
822         (save_cwd): Don't call fd_safer; no longer needed
823         now that we include fcntl--.h.
824
825         * getdate.y (relative_time): New type.
826         (RELATIVE_TIME_0): New constant.
827         (parser_control): Use relative_time instead of doing it ourselves.
828         (%union): Add new relative_time rel member.
829         (tYEAR_UNIT, tMONTH_UNIT, tHOUR_UNIT, tMINUTE_UNIT, tSEC_UNIT):
830         Now typeless.
831         (relunit, relunit_snumber): Now of type rel.
832         (zone, rel, relunit, get_date): Adjust to above changes.
833
834         * getloadavg.c: Include fcntl--.h rather than fcntl.h.
835         Do not include unistd-safer.h.
836         (getloadavg): Don't call fd_safer; no longer needed
837         now that we include fcntl--.h.
838
839         * mkdir-p.c (ENOSYS): Define to EEXIST if not defined.
840         (make_dir_parents): Treat ENOSYS like EEXIST.
841
842         Improve quality of diagnostics on restore_cwd failure.
843         * mkdir-p.h (make_dir): Remove.  All uses replaced by mkdir.
844         (make_dir_parents): Last arg is now int * (for errno), not bool *.
845         * mkdir-p.c (make_dir, make_dir_parents): Likewise.
846         Rewrite "mkdir -p" algorithm to avoid the need for "stat"
847         each time through the loop.  Do not diagnose restore_cwd failure;
848         that is the caller's job (and perhaps the caller does not care).
849
850         * mkdir-p.c (CLEANUP_CWD, CLEANUP): Remove.
851         (make_dir_parents): Revamp to avoid need for CLEANUP_CWD, CLEANUP.
852         If the file already exists but is not a directory, don't bother
853         to try to make its parents.
854         Close potential file descriptor leak if we can't chdir("/") (!).
855         Don't always return true if chdir($PWD) fails; return true only
856         if the requested action was done successfully (except for the
857         chdir($PWD)).
858         Don't log final directory unless we actually made it.
859         Refactor to avoid duplicate code to fix up permissions.
860         Don't attempt to fix up parent permissions if chdir($PWD) fails.
861
862         * strftime.c (my_strftime): Rewrite the previous change slightly,
863         to make it a bit faster and (I hope) clearer.
864         * strftime.c (my_strftime): Add support for %:z, %::z, %:::z.
865         Fix bug in formats like %2N.
866
867         * verify.h: New file.
868
869 2005-09-22  Jim Meyering  <jim@meyering.net>
870
871         Sync from coreutils.
872
873         * backupfile.c: Use ARGMATCH_VERIFY, just in case.
874
875         * posixtm.c (posixtime) [lint]: Initialize *all* of tm0, not just
876         the .tm_year member, since otherwise gcc-4.0 would now warn about
877         tm_zone, tm_gmtoff, tm_isdst, tm_yday, tm_wday.
878
879         * quotearg.c (quotearg_n_options): Change code to be suboptimal, in
880         order to avoid an unsuppressible warning from gcc on 64-bit systems.
881
882         * getdate.y (get_date): Undo part of the 2005-04-04 change, so that
883         the command "date -d'2005-03-27 +1 day'" succeeds once again, even
884         when run in a time zone for which daylight savings time is in effect
885         for the starting date.
886
887         * mkdir-p.c (make_dir_parents): Don't let a failed chdir($PWD)
888         stop us from restricting permissions of just-created absolute-named
889         directories.
890         * mkdir-p.c (CLEANUP_CWD): Return *true*, not false when failing
891         to restore initial working directory.
892         * mkdir-p.c (make_dir_parents): New parameter: different_working_dir,
893         to tell caller if/when we change the working directory and are
894         unable to return to the initial one.
895         * mkdir-p.h (make_dir_parents): Update prototype.
896         * mkdir-p.c (CLEANUP_CWD): Change one more `return 1' to
897         `return false'.  This fixes a bug introduced on 2004-07-30.
898
899         * openat.c (fdopendir): Be sure to close the supplied
900         file descriptor before returning.  This makes our replacement
901         implementation a little closer to Solaris's, where fdopendir
902         ties the file descriptor to the returned DIR* pointer.
903         * openat.c (unlinkat): New function.
904         * openat.h (unlinkat): Add prototype.
905         * openat-die.c (openat_save_fail): Rename from openat_save_die.
906         (openat_restore_fail): Rename from openat_restore_die.
907         * openat.c, openat.h: Reflect s/_die/_fail/ renaming.
908
909         Provide an alternative to exiting immediately upon save_cwd or
910         restore_cwd failure.  Now, an application can arrange e.g.,
911         to perform a longjump in that case.
912         * openat.c: Include dirname.h.
913         Use IS_ABSOLUTE_FILE_NAME rather than testing for leading slash.
914         (rpl_openat, fdopendir, fstatat): Call openat_save_die
915         and openat_restore_die rather than calling error directly.
916         Don't include "error.h" or "exitfail.h"; they're no longer needed.
917
918         * openat-die.c (openat_save_die, openat_restore_die): New file.
919         * openat.h (openat_save_die, openat_restore_die): Declare and define.
920
921         * strftime.c [FPRINTFTIME] (fprintftime): Provide a new interface:
922         size_t fprintftime (FILE *fp, char const *fmt, struct tm const *tm,
923                             int utc, int nanoseconds);
924         Background:
925         date should not have to allocate a megabyte of virtual memory to
926         handle a format argument like +%1048575T.  When implemented with
927         strftime, it must allocate such a buffer, use strftime to fill it
928         in, print it, then free it.
929         With fprintftime, it simply prints everything and exits.
930         With no need for memory allocation, that's one fewer way to fail.
931         * strftime.c (my_strftime): Parse the colons of %:::z *after* the
932         optional field width, not before, so we accept %9:z, not %:9z.
933         (my_strftime): Be sure to use L_('x') for literals.
934
935         * backupfile.c, canon-host.c, canonicalize.c, chown.c, cloexec.c:
936         * dup-safer.c, dup2.c, euidaccess.c, fd-safer.c, fileblocks.c:
937         * fopen-safer.c, fsusage.c, ftruncate.c, getcwd.c, getcwd.h:
938         * getloadavg.c, getopt_.h, getpagesize.h, getugroups.c, group-member.c:
939         * human.h, idcache.c, mkdir-p.c, mountlist.c, nanosleep.c, pathmax.h:
940         * physmem.c, posixver.c, putenv.c, raise.c, safe-read.c, same.c:
941         * save-cwd.c, setenv.c, settime.c, tempname.c, unlinkdir.c:
942         * unsetenv.c, userspec.c, xgethostname.c, xreadlink.c:
943         Assume HAVE_UNISTD_H, i.e., include <unistd.h> unconditionally.
944
945         * chown.c, cloexec.c, dup-safer.c, dup2.c, fsusage.c, getcwd.c:
946         * getloadavg.c, mountlist.c, openat.h, save-cwd.c, tempname.c:
947         Assume HAVE_FCNTL_H (i.e., include <fcntl.h> unconditionally,
948         and don't include <sys/file.h>).
949
950 2005-09-22  Eric Blake  <ebb9@byu.net>  (tiny change)
951
952         Sync from coreutils.
953
954         * getloadavg.c (getloadavg) [__CYGWIN__]: Port to cygwin.
955         [__linux__]: Allocate a big enough buffer for /proc/loadavg.
956         [!LDAV_DONE]: Avoid unused variable warning.
957
958 2005-09-21  Bruno Haible  <bruno@clisp.org>
959
960         * unicodeio.h (unicode_to_mb): New declaration.
961
962 2005-09-20  Derek Price  <derek@ximbiot.com>
963
964         * getaddrinfo.c: Don't include <netdb.h> included from getaddrinfo.h.
965
966 2005-09-19  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
967
968         Use a consistent style for including <config.h>.
969         * __fpending.c, acl.c, argmatch.c,
970         argp-help.c, argp-parse.c,
971         argp-pvh.c, backupfile.c, basename.c, c-stack.c,
972         calloc.c, check-version.c, cloexec.c, closeout.c, copy-file.c,
973         creat-safer.c, cycle-check.c, dirfd.c, dirname.c, dup-safer.c,
974         dup2.c, euidaccess.c, exclude.c, exitfail.c, fatal-signal.c,
975         fd-safer.c, file-type.c, fileblocks.c, filemode.c,
976         filenamecat.c, findprog.c, fnmatch.c, fopen-safer.c, free.c,
977         fsusage.c, ftruncate.c, full-write.c, fwriteerror.c,
978         getaddrinfo.c, getcwd.c, getdelim.c, getline.c, getlogin_r.c,
979         getndelim2.c, getnline.c, getopt1.c, getpass.c, group-member.c,
980         hard-locale.c, hash-pjw.c, hash.c, human.c, idcache.c,
981         inet_ntop.c, isdir.c, long-options.c, malloc.c, memcasecmp.c,
982         memcmp.c, memcoll.c, memcpy.c, memmove.c, mkdir-p.c,
983         modechange.c, mountlist.c, open-safer.c, physmem.c,
984         pipe-safer.c, pipe.c, poll.c, posixver.c, progname.c,
985         progreloc.c, putenv.c, quote.c, quotearg.c, readline.c,
986         readlink.c, realloc.c, regex.c, rename.c, rmdir.c, rpmatch.c,
987         safe-read.c, same.c, save-cwd.c, savedir.c, sig2str.c,
988         strcspn.c, strerror.c, stripslash.c, strncasecmp.c, strndup.c,
989         strnlen.c, strnlen1.c, strsep.c, strstr.c, strtod.c,
990         strtoimax.c, strtol.c, strverscmp.c, tempname.c, time_r.c,
991         userspec.c, utimecmp.c, version-etc-fsf.c,
992         version-etc.c, wait-process.c, xalloc-die.c, xgetcwd.c,
993         xmalloc.c, xmemcoll.c, xnanosleep.c, xreadlink.c, xsetenv.c,
994         xstrndup.c, xstrtoimax.c, xstrtol.c, xstrtoumax.c, yesno.c:
995         Standardize inclusion of config.h.
996         * __fpending.h, dirfd.h, getdate.h, human.h,
997         inttostr.h:  Removed inclusion of config.h from header files.
998         * inttostr.c:  Adjusted in-tree users.
999         * timespec.h: Remove superfluous warning to include config.h.
1000         * atexit.c, chdir-long.c chown.c, fchown-stub.c, getgroups.c,
1001         gettimeofday.c, lchown.c, lstat.c, mkdir.c, mkstemp.c,
1002         nanosleep.c, openat.c, raise.c, readtokens0.c, readutmp.c,
1003         unlinkdir.c: Guard inclusion of config.h with HAVE_CONFIG_H.
1004
1005 2005-09-16  Paul Eggert  <eggert@cs.ucla.edu>
1006
1007         * stat-time.h: New file.
1008         * timespec.h (ST_TIME_CMP_NS, ST_TIME_CMP, ATIME_CMP, CTIME_CMP):
1009         (MTIME_CMP, TIMESPEC_NS): Remove.  Now done by stat-time.h,
1010         in a different way.
1011         (timespec_cmp): New function.
1012         * utimecmp.c: Include stat-time.h.
1013         (SYSCALL_RESOLUTION): Depend on whether various struct stat
1014         members exist, not on the obsolescent ST_MTIM_NSEC.
1015         (utimecmp): Use the new stat-time functions rater than TIMESPEC_NS.
1016
1017 2005-09-15  Derek Price  <derek@ximbiot.com>
1018             Paul Eggert  <eggert@cs.ucla.edu>
1019
1020         * regcomp.c, regexec.c, regex_internal.c: Back out previous
1021         changes, consolidating in...
1022         * regex_internal.h: ...this file.
1023
1024 2005-09-15  Derek Price  <derek@ximbiot.com>
1025
1026         * regex_internal.h: Blank `pure' for GNUC < 3.
1027         * regex_internal.c: Ditto, using this...
1028         (__GNUC_PREREQ): ...new macro.
1029         * regcomp.c, regexec.c: Blank `always_inline' for GNUC < 3.1 using...
1030         (__GNUC_PREREQ): ...this new macro.
1031
1032         * strstr.h: Include string.h. Define strstr as a macro here.
1033
1034 2005-09-13  Derek Price  <derek@ximbiot.com>
1035
1036         * canon-host.c (canon_host_r): Set *cherror on memory allocation
1037         failure.
1038         Reported by Jim Meyering  <jim@meyering.net>.
1039
1040 2005-09-13  Jim Meyering  <jim@meyering.net>
1041
1042         * canon-host.c: Filter through gnu indent and reword comments slightly.
1043         * canon-host.h (ch_strerror_r): Tweak cpp indentation and spacing.
1044
1045 2005-09-12  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>  (tiny change)
1046
1047         * lib/base64.c: Typo.
1048         (base64_encode): Put b64str in initialized data section.
1049
1050 2005-09-12  Derek Price  <derek@ximbiot.com>
1051
1052         Return usable errors from canon-host.
1053         * canon-host.h: New file.
1054         * canon-host.c (canon_host): Wrap...
1055         (canon_host_r): ...this new function, which now relies exclusively on
1056         getaddrinfo.
1057         (ch_strerror): New function.
1058         (last_cherror): New global.
1059         * getaddrinfo.c: Move include of getaddrinfo.h first to test interface.
1060         (getaddrinfo): Add AI_CANONNAME functionality.  Don't do arithmetic on
1061         void *.
1062         (freeaddrinfo): Free ai->ai_canonname when set.
1063
1064 2005-09-12  Derek Price  <derek@ximbiot.com>
1065             Paul Eggert  <eggert@cs.ucla.edu>
1066
1067         * glob-libc.h: Renamed from glob_.h.  The new version is
1068         taken from libc's glob.h, except with '#ifdef __GLOB_GNULIB'
1069         protecting things that should be done only in gnulib contexts.
1070         * glob_.h: New file, containing only the glob things needed for
1071         gnulib.
1072         (GLOB_PREFIX): Remove.  All uses changed to look for __GLOB_GNULIB.
1073         (__GLOB_CONCAT, __GLOB_XCONCAT, __GLOB_ID): Remove; no longer needed.
1074         (glob, globfree, glob_pattern_p): Now defined simply in terms of
1075         rpl_glob, rpl_globfree, rpl_glob_pattern_p.
1076         (__GLOB_GNULIB): New macro, to keep the glob.h changes clearer
1077         and to respect the namespace rules better.
1078
1079 2005-09-12  Paul Eggert  <eggert@cs.ucla.edu>
1080
1081         Merge glibc and coreutils changes into gnulib, plus a few
1082         extra fixes.
1083         * md5.c: Use #error rather than a string.
1084         (CYCLIC): New macro, from glibc source.  Use it instead of rol.
1085         * md5.h (__GNUC_PREREQ, __THROW): Define if not defined already.
1086         (__attribute__): Define to empty for non recent-GCC.
1087         (__md5_buffer, __md5_finish_ctx, __md5_init_ctx, __md5_process_block):
1088         (__md5_process_bytes, __md5_read_ctx, __md5_stream):
1089         Renamed from their non-__ counterparts, with new macros replacing
1090         them if not _LIBC.  Add __THROW attribute.
1091         (rol): Remove.
1092         (struct md5_ctx): Align buffer if using GCC.
1093         * sha1.h (struct sha1_ctx): Likewise.
1094         * sha1.c (SWAP): Renamed from the NOTSWAP.  All uses changed.
1095         The old name was backwards.
1096         (NOTSWAP): Remove; not used.
1097         (rol): New macro, moved here from md5.h.
1098         (sha1_process_block): Remove a FIXME that doesn't make sense.
1099
1100 2005-09-12  Derek Price  <derek@ximbiot.com>
1101
1102         * gai_strerror.c: Include config.h when available.  Include
1103         getaddrinfo.h before other headers to test interface.
1104         Reported by Larry Jones <lawrence.jones@ugs.com>.
1105
1106 2005-09-08  Paul Eggert  <eggert@cs.ucla.edu>
1107
1108         * glob.c (glob, globfree, __glob_pattern_p): Use old-style function
1109         definitions, since that's the preferred style in glibc.
1110         Fix a minor spacing issue, and update copyright notice to match glibc's.
1111
1112 2005-09-06  Paul Eggert  <eggert@cs.ucla.edu>
1113
1114         * regex_internal.h (bitset_not): Add parens to avoid gcc -Wall warning.
1115
1116 2005-09-06  Simon Josefsson  <jas@extundo.com>
1117
1118         * getpass.c (getpass): Fix typo, test for HAVE_TCSETATTR and not
1119         TCSETATTR.  Reported by Derek Price <derek@ximbiot.com>.
1120
1121 2005-09-05  Paul Eggert  <eggert@cs.ucla.edu>
1122
1123         Change bitset word type from unsigned int to unsigned long int,
1124         as this has better performance on typical 64-bit hosts.
1125         Port bitset code to hosts with unusual word sizes.
1126         * regcomp.c (build_equiv_class, build_charclass, build_range_exp):
1127         (build_collating_symbol):
1128         Prefer bitset to re_bitset_ptr_t in prototypes, when the actual
1129         argument is a bitset.  This is merely a style issue, but it makes
1130         it clearer that an entire array is expected.
1131         (re_compile_fastmap_iter, init_dfa, init_word_char, optimize_subexps):
1132         * regcomp.c (lower_subexp, parse_bracket_exp, built_charclass_op):
1133         Port to the case where bitset_word is not the same as unsigned int.
1134         * regex_internal.h (bitset_set, bitset_clear, bitset_contain):
1135         (bitset_not, bitset_merge, bitset_set_all, bitset_mask):
1136         Likewise.
1137         * regexec.c (check_dst_limits_calc_pos_1, check_subexp_matching_top):
1138         (build_trtable, group_nodes_into_DFAstates):
1139         Likewise.
1140         * regcomp.c (re_compile_fastmap_iter, utf8_sb_map, optimize_utf8):
1141         Don't assume that SBC_MAX is a multiple of BITSET_WORD_BITS.
1142         * regex_internal.h (bitset_set_all, bitset_not): Likewise.
1143         * regexec.c (group_nodes_into_DFAstates): Likewise.
1144         * regcomp.c (utf8_sb_map): Don't assume UINT_MAX == 0xffffffff.
1145         * regcomp.c (optimize_subexps, lower_subexp):
1146         Work even if bitset_word has holes in its bitwise representation.
1147         * regex_internal.h (BITSET_WORD_BITS): Likewise.
1148         * regexec.c (check_dst_limits_calc_pos_1, check_subexp_matching_top):
1149         Likewise.
1150         * regex_internal.c (re_string_reconstruct):
1151         Don't assume UCHAR_MAX == 255.
1152         * regex_internal.h (bitset_set_all): Likewise.
1153         * regex_internal.h (BITSET_WORD_BITS): Renamed from UINT_BITS.
1154         All uses changed.
1155         (BITSET_WORDS): Renamed from BITSET_UINTS.  All uses changed.
1156         (bitset_word): New type, replacing 'unsigned int' for bitset uses.
1157         All uses changed.
1158         (BITSET_WORD_MAX): New macro.
1159         (bitset_set, bitset_clear, bitset_contain, bitset_empty):
1160         (bitset_set_all, bitset_copy):  Now inline functions, not macros.
1161         (bitset_empty, bitset_copy):
1162         Prefer sizeof (bitset) to multiplying it out ourselves.
1163         (bitset_not_merge): Remove; unused.
1164         (bitset_contain): Return bool, not unsigned int with one bit on.
1165         All callers changed.
1166         * regexec.c (build_trtable): Don't assume bitset has no stricter
1167         alignment than re_node_set; do this by defining a new internal
1168         type struct dests_alloc and using it to allocate memory.
1169
1170 2005-09-02  Paul Eggert  <eggert@cs.ucla.edu>
1171
1172         Check for arithmetic overflow when calculating sizes, to prevent
1173         some buffer-overflow issues.  These patches are conservative, in the
1174         sense that when I couldn't determine whether an overflow was possible,
1175         I inserted a run-time check.
1176         * regex_internal.h (re_xmalloc, re_xrealloc, re_x2realloc): New macros.
1177         (SIZE_MAX) [!defined SIZE_MAX]: New macro.
1178         (re_alloc_oversized, re_x2alloc_oversized, re_xnmalloc):
1179         (re_xnrealloc, re_x2nrealloc): New inline functions.
1180         * lib/regcomp.c (init_dfa, analyze, build_range_exp, parse_bracket_exp):
1181         (build_equiv_class, build_charclass): Check for arithmetic overflow
1182         in size expression calculations.
1183         * lib/regex_internal.c (re_string_realloc_buffers):
1184         (build_wcs_upper_buffer, re_node_set_add_intersect):
1185         (re_node_set_init_union, re_node_set_insert, re_node_set_insert_last):
1186         (re_dfa_add_node, register_state): Likewise.
1187         * lib/regexec.c (re_search_stub, re_copy_regs, re_search_internal):
1188         (prune_impossible_nodes, push_fail_stack, set_regs, check_arrival):
1189         (build_trtable, extend_buffers, match_ctx_init, match_ctx_add_entry):
1190         (match_ctx_add_subtop, match_ctx_add_sublast): Likewise.
1191
1192 2005-09-01  Paul Eggert  <eggert@cs.ucla.edu>
1193
1194         * glob.c (GET_LOGIN_NAME_MAX): Renamed from LOGIN_NAME_MAX,
1195         to avoid a collision with bits/local_lim.h in glibc.
1196         All uses changed.  Problem reported by Dmitry V. Levin in
1197         <http://sources.redhat.com/bugzilla/show_bug.cgi?id=1060>.
1198
1199         * regex_internal.c (build_wcs_upper_buffer): Fix portability
1200         bugs in int versus size_t comparisons.
1201         (re_string_context_at): Fix bug where the code assumed that
1202         Idx is signed.
1203
1204         Use bool where appropriate.
1205         * regcomp.c (re_set_fastmap): ICASE arg is bool, not int.
1206         All callers changed.
1207         (calc_eclosure_iter): Likewise, for ROOT arg.
1208         (parse_bracket_element): Likewise, for ACCEPT_HYPHEN arg.
1209         (build_charclass_op): Likewise, for NON_MATCH arg.
1210         * regex_internal.c (re_string_allocate, re_string_construct):
1211         (re_string_construct_common): Likewise, for ICASE arg.
1212         * regexec.c (re_search_2_stub, re_search_stub):
1213         Likewise, for RET_LEN arg.
1214         (check_matching): Likewise, for FL_LONGEST_MATCH arg.
1215         (set_regs): Likewise, for FL_BACKTRACK arg.
1216         * regcomp.c (re_compile_fastmap_iter, optimize_utf8):
1217         (duplicate_node_closure, calc_inveclosure, calc_eclosure):
1218         (calc_eclosure_iter, parse_bracket_exp):
1219         Use bool for internal variables that are booleans.
1220         * regexec.c (re_search_internal, check_matching, proceed_next_node):
1221         (set_regs, build_sifted_states, sift_states_bkref):
1222         (check_arrival_add_next_nodes, check_arrival_expand_ecl_sub):
1223         (expand_bkref_cache, build_trtable, group_nodes_into_DFAstates):
1224         (find_collation_sequence_value):
1225         Likewise.
1226         * regex_internal.c (re_node_set_insert, re_node_set_insert_last):
1227         (re_node_set_compare):
1228         Return bool, not int. All callers changed.
1229         * regexec.c (check_halt_node_context, check_dst_limits):
1230         (build_trtable, check_node_accept): Likewise.
1231         * regex_internal.h: Include stdbool.h.
1232
1233         Fix bugs uncovered when converting to bool.
1234         * regcomp.c (calc_eclosure_iter): Check for storage allocation
1235         failure instead of charging ahead blindly.
1236         * regex_internal.c (register_state): Likewise.
1237         * regexec.c (re_search_2_stub): Use simpler method than boolean
1238         for freeing internal storage.
1239         (group_nodes_into_DFA_states): Use unsigned int, not int, for
1240         bitset pieces used as boolean, to avoid undefined behavior
1241         on hosts that do int overflow checking.
1242
1243 2005-08-31  Derek Price  <derek@ximbiot.com>
1244
1245         * getdelim.c (getdelim): Return EOF on EOF.
1246         Reported by Larry Jones <lawrence.jones@ugs.com>.
1247
1248 2005-08-31  Paul Eggert  <eggert@cs.ucla.edu>
1249
1250         * regex_internal.c (re_string_reconstruct): Don't assume buffer
1251         lengths fit in regoff_t; this isn't true if regoff_t is the same
1252         width as size_t.
1253         * regex.c (re_search_internal): 5th arg is LAST_START
1254         (= START + RANGE) instead of RANGE.  This avoids overflow
1255         problems when regoff_t is the same width as size_t.
1256         All callers changed.
1257         (re_search_2_stub): Check for overflow when adding the
1258         sizes of the two strings.
1259         (re_search_stub): Check for overflow when adding START
1260         to RANGE; if it occurs, substitute the extreme value.
1261
1262 2005-08-31  Jim Meyering  <jim@meyering.net>
1263
1264         * regcomp.c (search_duplicated_node): Make first pointer arg
1265         a pointer-to-const.
1266         * regex_internal.c (create_ci_newstate, create_cd_newstate):
1267         (register_state): Likewise.
1268         * regexec.c (search_cur_bkref_entry, check_dst_limits):
1269         (check_dst_limits_calc_pos_1, check_dst_limits_calc_pos):
1270         (group_nodes_into_DFAstates): Likewise.
1271
1272 2005-08-31  Paul Eggert  <eggert@cs.ucla.edu>
1273
1274         On 64-bit hosts (where size_t is 64 bits and int is 32 bits), the
1275         old glibc regex code mishandles strings longer than 2**31 bytes.
1276         This patch fixes this when the regex code is used in gnulib
1277         (i.e., outside glibc).
1278
1279         This patch should not affect the use of the regex code inside
1280         glibc.  No doubt this problem also needs to be handled for glibc
1281         as well, but the result will be an incompatible change to the
1282         glibc ABI, and the old ABI will have to be supported too.  That
1283         can be the the subject for another patch.
1284
1285         * regex.h (_REGEX_LARGE_OFFSETS): New feature-test macro,
1286         governing whether the rest of this patch is active.  By default,
1287         the macro is disabled and the patch has no effect.
1288         (regoff_t) [defined _REGEX_LARGE_OFFSETS]: Define to off_t, not int.
1289         (__re_idx_t, __re_size_t, __re_long_size_t): New types.
1290         (struct re_pattern_buffer, re_search, re_search_2, re_match):
1291         (re_match_2, re_set_registers): Use the new types.
1292         * regex_internal.h (Idx, re_hashval_t): New types.
1293         (REG_MISSING, REG_ERROR, REG_VALID_INDEX, REG_VALID_NONZERO_INDEX):
1294         New macros.
1295         (re_node_set, re_charset_t, re_token_t, re_string_realloc_buffers):
1296         (re_string_context_at, bin_tree_t, re_dfastate_t):
1297         (struct re_state_table_entry, state_array_t, re_sub_match_last_t):
1298         (re_sub_match_top_t, re_match_context_t, re_sift_context_t):
1299         (struct re_fail_stack_ent_t, struct re_fail_stack_t, struct re_dfa_t):
1300         (re_string_char_size_at, re_string_wchar_at):
1301         (re_string_elem_size_at):
1302         Use the new types and macros to port to 64-bit hosts.
1303         Use unsigned types for internal values, so that the code
1304         mostly works even for arrays larger than SSIZE_MAX.
1305         * regcomp.c (re_compile_internal, init_dfa, duplicate_node):
1306         (search_duplicated_node, calc_eclosure_iter, fetch_number):
1307         (parse_reg_exp, parse_branch, parse_expression, parse_sub_exp):
1308         (build_equiv_class, build_charclass, re_compile_fastmap_iter):
1309         (free_dfa_content, create_initial_state, optimize_utf8, analyze):
1310         (optimize_subexps, calc_first, link_nfa_nodes, duplicate_node_closure):
1311         (calc_inveclosure, parse_dup_op, build_range_exp):
1312         (build_collating_symbol, parse_bracket_exp, build_charclass_op):
1313         (fetch_number, create_token_tree, mark_opt_subexp):
1314         Likewise.
1315         * regex_internal.c (re_string_construct_common, create_ci_newstate):
1316         (create_cd_newstate, re_string_allocate, re_string_construct):
1317         (re_string_realloc_buffers, build_wcs_upper_buffer):
1318         (re_string_skip_chars, build_upper_buffer, re_string_translate_buffer):
1319         (re_string_reconstruct, re_string_peek_byte_case):
1320         (re_string_fetch_byte_case, re_string_context_at):
1321         (re_node_set_alloc, re_node_set_init_1, re_node_set_init_2):
1322         (re_node_set_init_copy, re_node_set_add_intersect):
1323         (re_node_set_init_union, re_node_set_merge, re_node_set_insert):
1324         (re_node_set_insert_last, re_node_set_compare, re_node_set_contains):
1325         (re_node_set_remove_at, re_dfa_add_node, calc_state_hash):
1326         (re_acquire_state, re_acquire_state_context, register_state):
1327         Likewise.
1328         * regex.c (match_ctx_init, match_ctx_add_entry, search_cur_bkref_entry):
1329         (match_ctx_add_subtop, match_ctx_add_sublast, sift_ctx_init):
1330         (re_search_internal, re_search_2_stub, re_search_stub)
1331         (re_copy_regs, check_matching, check_halt_state_context, update_regs):
1332         (push_fail_stack, sift_states_iter_mb, build_sifted_states):
1333         (update_cur_sifted_state, check_dst_limits):
1334         (check_dst_limits_calc_pos_1, check_dst_limits_calc_pos):
1335         (check_subexp_limits, sift_states_bkref, merge_state_array):
1336         (check_subexp_matching_top, get_subexp, get_subexp_sub):
1337         (find_subexp_node, check_arrival, check_arrival_add_next_nodes):
1338         (check_arrival_expand_ecl, check_arrival_expand_ecl_sub):
1339         (expand_bkref_cache, check_node_accept_bytes):
1340         (group_nodes_into_DFAstates, check_node_accept, regexec, re_match):
1341         (re_search, re_match_2, re_search_2, prune_impossible_nodes):
1342         (acquire_init_state_context, check_halt_node_context):
1343         (proceed_next_node, pop_fail_stack, set_regs, free_fail_stack_return):
1344         (sift_states_backward, clean_state_log_if_needed):
1345         (sub_epsilon_src_nodes, add_epsilone_src_nodes, merge_state_with_log):
1346         (find_recover_state, transit_state_sb, transit_state_mb):
1347         (transit_state_bkref, build_trtable, match_ctx_clean):
1348         Likewise.
1349         * regcomp.c (parse_dup_op): Add an extra test if Idx is unsigned,
1350         to work around an assumption that REG_MISSING is negative.
1351
1352         * regcomp.c (re_comp) [defined _REGEX_RE_COMP || defined _LIBC]:
1353         (seek_collating_symbol_entry) [defined _LIBC]:
1354         (lookup_collation_sequence_value) [defined _LIBC]:
1355         (build_range_exp, build_collating_symbol) [defined _LIBC]:
1356         Use prototypes rather than old-style function definitions.
1357         * regexec.c (re_exec) [defined _REGEX_RE_COMP || defined _LIBC]:
1358         (transit_state_sb) [0]:
1359         (find_collation_sequence_value) [defined _LIBC]: Likewise.
1360
1361         * regexec.c (re_search_internal): Simplify update of rm_so and
1362         rm_eo.
1363
1364         * regcomp.c (re_compile_fastmap_iter, init_dfa, init_word_char):
1365         (optimize_subexps, lower_subexp):
1366         Don't assume 1<<31 has defined behavior on hosts with 32-bit int,
1367         since the signed shift might overflow.  Use 1u<<31 instead.
1368         * regex_internal.h (bitset_set, bitset_clear, bitset_contain): Likewise.
1369         * regexec.c (check_dst_limits_calc_pos_1, check_subexp_matching_top):
1370         Likewise.
1371
1372         * regcomp.c (optimize_subexps, lower_subexp):
1373         Use CHAR_BIT rather than 8, for clarity.
1374         * regexec.c (check_dst_limits_calc_pos_1):
1375         (check_subexp_matching_top): Likewise.
1376         * regcomp.c (init_dfa): Make table_size unsigned, so that we don't
1377         have to worry about portability issues when shifting it left.
1378         Remove no-longer-needed test for table_size > 0.
1379         * regcomp.c (parse_sub_exp): Do not shift more bits than there are
1380         in a word, as the resulting behavior is undefined.
1381         * regexec.c (check_dst_limits_calc_pos_1): Likewise;
1382         in one case, a <= should have been an <, and in another case the
1383         whole test was missing.
1384         * regex_internal.h (BYTE_BITS): Remove.  All uses changed to
1385         the standard name CHAR_BIT.
1386         * regexec.c (match_ctx_add_entry): Don't assume that ~0 == -1;
1387         this is not true on one's complement and signed-magnitude hosts.
1388
1389         * regex_internal.h (re_sub_match_top_t): Remove unused member
1390         next_last_offset.
1391         (struct re_dfa_t): Remove unused member states_alloc.
1392         * regcomp.c (init_dfa): Don't initialize unused members.
1393
1394 2005-08-31  Bruno Haible  <bruno@clisp.org>
1395
1396         * strstr.c: Include <stddef.h>, for NULL.
1397         * strcasestr.c: Likewise.
1398         Reported by Yoann Vandoorselaere <yoann.v@prelude-ids.com>.
1399
1400 2005-08-30  "Oskar Liljeblad" <oskar@osk.mine.nu>
1401
1402         * iconvme.h: Add prototype for iconv_alloc.
1403
1404 2005-08-29  Simon Josefsson  <jas@extundo.com>
1405
1406         * iconvme.c: Fix errno.
1407
1408 2005-08-29  "Oskar Liljeblad" <oskar@osk.mine.nu>
1409
1410         * iconvme.c: Split iconv_string into iconv_alloc.
1411
1412 2005-08-27  Jim Meyering  <jim@meyering.net>
1413
1414         * fopen-safer.c: Merge minor changes from coreutils.
1415         * dup-safer.c: Likewise.
1416         * fd-safer.c: Likewise.
1417
1418         Merge from coreutils.
1419         * stdio--.h: New file.
1420         * stdlib--.h: New file.
1421         * mkstemp-safer.c: New file.
1422
1423         GNU tar needs these.
1424         * pipe-safer.c: New file.
1425         * creat-safer.c: New file.
1426         * fcntl--.h (creat): Define to creat_safer.
1427         * fcntl-safer.h: Include <sys/types.h> and declare creat_safer.
1428         * unistd--.h (pipe): Define to pipe_safer.
1429         * unistd-safer.h: Declare pipe_safer.
1430
1431 2005-08-26  Paul Eggert  <eggert@cs.ucla.edu>
1432
1433         * regex_internal.h: Remove all references to
1434         RE_NO_INTERNAL_PROTOTYPES; no longer neeeded now that we assume C89
1435         or better.
1436         (bitset_not, bitset_merge, bitset_not_merge):
1437         (bitset_mask, re_string_allocate, re_string_construct):
1438         (re_string_reconstruct, re_string_destruct, re_string_elem_size_at):
1439         (re_string_char_size_at, re_string_wchar_at, re_string_peek_byte_case):
1440         (re_string_fetch_byte_case, re_node_set_alloc, re_node_set_init_1):
1441         (re_node_set_init_2, re_node_set_init_copy, re_node_set_add_intersect):
1442         (re_node_set_init_union, re_node_set_merge, re_node_set_insert):
1443         (re_node_set_insert_last, re_node_set_compare, re_node_set_contains):
1444         (re_node_set_remove_at, re_dfa_add_node, re_acquire_state):
1445         (re_acquire_state_context):
1446         Remove unnecessary forward decls.
1447         (re_string_char_size_at, re_string_wchar_at, re_string_elem_size_at):
1448         Put __attribute at function definition,
1449         now that the function decl has been removed.
1450         * lib/regex_internal.c (re_string_peek_byte_case):
1451         (re_string_fetch_byte_case, re_node_set_compare, re_node_set_contains):
1452         Likewise.
1453
1454 2005-08-26  Simon Josefsson  <jas@extundo.com>
1455
1456         * getpass.c: Use _WIN32 instead of WIN32, suggested by Bruno
1457         Haible <bruno@clisp.org>.
1458
1459 2005-08-25  Paul Eggert  <eggert@cs.ucla.edu>
1460
1461         * regexec.c (set_regs): Don't alloca with an unbounded size.
1462
1463         alloca modernization/simplification for regex.
1464         * regex.c: Remove portability cruft for alloca.  This no longer
1465         needs to be at the start of the file, and can be moved into
1466         regex_internal.h and simplified.
1467         * regex_internal.h: Include <alloca.h>.
1468         (__libc_use_alloca) [!defined _LIBC]: New macro.
1469         * regexec.c (build_trtable): Remove "#ifdef _LIBC", since the code
1470         now works outside glibc.
1471
1472 2005-08-24  Simon Josefsson  <jas@extundo.com>
1473
1474         * getpass.c: Add WIN32 implementation.  Conditionalize use of
1475         termios.h, tcgetattr, tcsetattr and __fsetlocking.  Remove some
1476         GLIBC specific code.
1477
1478 2005-08-25  Paul Eggert  <eggert@cs.ucla.edu>
1479
1480         Make regex safe for g++.  This fixes one real bug (an "err"
1481         that should have been "*err").  g++ problem reported by
1482         Sam Steingold.
1483         * regex_internal.h (re_calloc): New macro, consistent with
1484         re_malloc etc.  All callers of calloc changed to use re_calloc.
1485         * regex_internal.c (build_wcs_upper_buffer): Return reg_errcode_t,
1486         not int.  All callers changed.
1487         * regcomp.c (re_compile_fastmap_iter): Don't use alloca (mb_cur_max);
1488         just use an array of size MB_LEN_MAX.
1489         * regexec.c (push_fail_stack): Use re_realloc, not realloc.
1490         (find_recover_state): Change "err" to "*err"; this fixes what
1491         appears to be a real bug.
1492         (check_arrival_expand_ecl_sub): Be consistent about reg_errcode_t
1493         versus int.
1494
1495 2005-08-25  Jim Meyering  <jim@meyering.net>
1496
1497         * open-safer.c: Include <config.h>.
1498         Otherwise, we'd lose LARGEFILE support in any file using
1499         e.g. "fcntl--.h"
1500
1501 2005-08-24  Paul Eggert  <eggert@cs.ucla.edu>
1502
1503         * regcomp.c (regerror): 2nd arg is 'restrict', as per POSIX.
1504         * regex.h (regerror): Likewise.
1505
1506         * regex.c: Do not include <sys/types.h>, as POSIX no longer
1507         requires this.  (The code never needed it.)
1508
1509         * regcomp.c, regex_internal.c, regex_internal.h, regexec.c:
1510         All uses of recently-renamed identifiers changed to use the new,
1511         POSIX-compliant names.  The code will build and run just fine
1512         without these changes, but it's better to eat our own dog food
1513         and use the standard-conforming names.
1514
1515         * regex.h: Fix a multitude of POSIX name space violations.
1516         These changes have an effect only for programs that define
1517         _POSIX_C_SOURCE, _POSIX_SOURCE, or _XOPEN_SOURCE; they
1518         do not change anything for programs compiled in the normal way.
1519         Also, there is no effect on the ABI.
1520
1521         (_REGEX_SOURCE): New macro.
1522         Do not include <stddef.h> if _XOPEN_SOURCE and VMS are both
1523         defined and _GNU_SOURCE is not; this fixes a name space violation.
1524
1525         Rename the following macros to obey POSIX requirements.
1526         The old names are still visible as macros if _REGEX_SOURCE is defined.
1527         (REG_BACKSLASH_ESCAPE_IN_LISTS): renamed from
1528         RE_BACKSLASH_ESCAPE_IN_LISTS.
1529         (REG_BK_PLUS_QM): renamed from RE_BK_PLUS_QM.
1530         (REG_CHAR_CLASSES): renamed from RE_CHAR_CLASSES.
1531         (REG_CONTEXT_INDEP_ANCHORS): renamed from RE_CONTEXT_INDEP_ANCHORS.
1532         (REG_CONTEXT_INDEP_OPS): renamed from RE_CONTEXT_INDEP_OPS.
1533         (REG_CONTEXT_INVALID_OPS): renamed from RE_CONTEXT_INVALID_OPS.
1534         (REG_DOT_NEWLINE): renamed from RE_DOT_NEWLINE.
1535         (REG_DOT_NOT_NULL): renamed from RE_DOT_NOT_NULL.
1536         (REG_HAT_LISTS_NOT_NEWLINE): renamed from RE_HAT_LISTS_NOT_NEWLINE.
1537         (REG_INTERVALS): renamed from RE_INTERVALS.
1538         (REG_LIMITED_OPS): renamed from RE_LIMITED_OPS.
1539         (REG_NEWLINE_ALT): renamed from RE_NEWLINE_ALT.
1540         (REG_NO_BK_BRACES): renamed from RE_NO_BK_BRACES.
1541         (REG_NO_BK_PARENS): renamed from RE_NO_BK_PARENS.
1542         (REG_NO_BK_REFS): renamed from RE_NO_BK_REFS.
1543         (REG_NO_BK_VBAR): renamed from RE_NO_BK_VBAR.
1544         (REG_NO_EMPTY_RANGES): renamed from RE_NO_EMPTY_RANGES.
1545         (REG_UNMATCHED_RIGHT_PAREN_ORD): renamed from
1546         RE_UNMATCHED_RIGHT_PAREN_ORD.
1547         (REG_NO_POSIX_BACKTRACKING): renamed from RE_NO_POSIX_BACKTRACKING.
1548         (REG_NO_GNU_OPS): renamed from RE_NO_GNU_OPS.
1549         (REG_DEBUG): renamed from RE_DEBUG.
1550         (REG_INVALID_INTERVAL_ORD): renamed from RE_INVALID_INTERVAL_ORD.
1551         (REG_IGNORE_CASE): renamed from RE_ICASE.  This renaming is a bit
1552         unusual, since we can't clash with the POSIX REG_ICASE.
1553         (REG_CARET_ANCHORS_HERE): renamed from RE_CARET_ANCHORS_HERE.
1554         (REG_CONTEXT_INVALID_DUP): renamed from RE_CONTEXT_INVALID_DUP.
1555         (REG_NO_SUB): renamed from RE_NO_SUB.
1556         (REG_SYNTAX_EMACS): renamed from RE_SYNTAX_EMACS.
1557         (REG_SYNTAX_AWK): renamed from RE_SYNTAX_AWK.
1558         (REG_SYNTAX_GNU_AWK): renamed from RE_SYNTAX_GNU_AWK.
1559         (REG_SYNTAX_POSIX_AWK): renamed from RE_SYNTAX_POSIX_AWK.
1560         (REG_SYNTAX_GREP): renamed from RE_SYNTAX_GREP.
1561         (REG_SYNTAX_EGREP): renamed from RE_SYNTAX_EGREP.
1562         (REG_SYNTAX_POSIX_EGREP): renamed from RE_SYNTAX_POSIX_EGREP.
1563         (REG_SYNTAX_ED): renamed from RE_SYNTAX_ED.
1564         (REG_SYNTAX_SED): renamed from RE_SYNTAX_SED.
1565         (_REG_SYNTAX_POSIX_COMMON): renamed from _RE_SYNTAX_POSIX_COMMON.
1566         (REG_SYNTAX_POSIX_BASIC): renamed from RE_SYNTAX_POSIX_BASIC.
1567         (REG_SYNTAX_POSIX_MINIMAL_BASIC): renamed from
1568         RE_SYNTAX_POSIX_MINIMAL_BASIC.
1569         (REG_SYNTAX_POSIX_EXTENDED): renamed from RE_SYNTAX_POSIX_EXTENDED.
1570         (REG_SYNTAX_POSIX_MINIMAL_EXTENDED): renamed from
1571         RE_SYNTAX_POSIX_MINIMAL_EXTENDED.
1572         (REG_DUP_MAX): renamed from RE_DUP_MAX.  No need to undef it.
1573         (REG_UNALLOCATED): Renamed from REGS_UNALLOCATED.
1574         (REG_REALLOCATE): Renamed from REGS_REALLOCATE.
1575         (REG_FIXED): Renamed from REGS_FIXED.
1576         (REG_NREGS): Renamed from RE_NREGS.
1577
1578         (REG_ICASE, REG_NEWLINE, REG_NOSUB): Do not depend on the values
1579         of other REG_* macros, since POSIX says the user is allowed to
1580         #undef these macros selectively.
1581
1582         (reg_errcode_t): Update comment stating what other tables need
1583         to be consistent.
1584
1585         Rename the following enum values to obey POSIX requirements.
1586         The old names are still visible as macros.
1587         (_REG_ENOSYS): Renamed from REG_ENOSYS.  Define even if _XOPEN_SOURCE
1588         is not defined, since GNU is supposed to be a superset of POSIX as
1589         much as possible, and since we want reg_errcode_t to be a signed
1590         type for implementation consistency.
1591         (_REG_NOERROR): Renamed from REG_NOERROR.
1592         (_REG_NOMATCH): Renamed from REG_NOMATCH.
1593         (_REG_BADPAT): Renamed from REG_BADPAT.
1594         (_REG_ECOLLATE): Renamed from REG_ECOLLATE.
1595         (_REG_ECTYPE): Renamed from REG_ECTYPE.
1596         (_REG_EESCAPE): Renamed from REG_EESCAPE.
1597         (_REG_ESUBREG): Renamed from REG_ESUBREG.
1598         (_REG_EBRACK): Renamed from REG_EBRACK.
1599         (_REG_EPAREN): Renamed from REG_EPAREN.
1600         (_REG_EBRACE): Renamed from REG_EBRACE.
1601         (_REG_BADBR): Renamed from REG_BADBR.
1602         (_REG_ERANGE): Renamed from REG_ERANGE.
1603         (_REG_ESPACE): Renamed from REG_ESPACE.
1604         (_REG_BADRPT): Renamed from REG_BADRPT.
1605         (_REG_EEND): Renamed from REG_EEND.
1606         (_REG_ESIZE): Renamed from REG_ESIZE.
1607         (_REG_ERPAREN): Renamed from REG_ERPAREN.
1608         (REG_ENOSYS, REG_NOERROR, REG_NOMATCH, REG_BADPAT, REG_ECOLLATE):
1609         (REG_ECTYPE, REG_EESCAPE, REG_ESUBREG, REG_EBRACK, REG_EPAREN):
1610         (REG_EBRACE, REG_BADBR, REG_ERANGE, REG_ESPACE, REG_BADRPT, REG_EEND):
1611         (REG_ESIZE, REG_ERPAREN): Now macros, not enum constants.
1612
1613         (_REG_RE_NAME, _REG_RM_NAME): New macros.
1614         (REG_TRANSLATE_TYPE): Renamed from RE_TRANSLATE_TYPE.  All uses
1615         changed.  But support the old name if the new one is not defined
1616         and if _REGEX_SOURCE.
1617
1618         Change the following member names in struct re_pattern_buffer.
1619         The old names are still supported if !_REGEX_SOURCE.
1620         The new names are always supported, regardless of _REGEX_SOURCE.
1621         (re_buffer): Renamed from buffer.
1622         (re_allocated): Renamed from allocated.
1623         (re_used): Renamed from used.
1624         (re_syntax): Renamed from syntax.
1625         (re_fastmap): Renamed from fastmap.
1626         (re_translate): Renamed from translate.
1627         (re_can_be_null): Renamed from can_be_null.
1628         (re_regs_allocated): Renamed from regs_allocated.
1629         (re_fastmap_accurate): Renamed from fastmap_accurate.
1630         (re_no_sub): Renamed from no_sub.
1631         (re_not_bol): Renamed from not_bol.
1632         (re_not_eol): Renamed from not_eol.
1633         (re_newline_anchor): Renamed from newline_anchor.
1634
1635         Change the following member names in struct re_registers.
1636         The old names are still supported if !_REGEX_SOURCE.
1637         The new names are always supported, regardless of _REGEX_SOURCE.
1638         (rm_num_regs): Renamed from num_regs.
1639         (rm_start): Renamed from start.
1640         (rm_end): Renamed from end.
1641
1642         (re_set_syntax, re_compile_pattern, re_compile_fastmap):
1643         (re_search, re_search_2, re_match, re_match_2, re_set_registers):
1644         Prepend __ to parameter names.
1645
1646         Undo yesterday's changes.
1647
1648 2005-08-24  Jim Meyering  <jim@meyering.net>
1649
1650         Sync from coreutils.
1651         * fcntl--.h, fcntl-safer.h, open-safer.c: New files.
1652
1653 2005-08-21  Bruno Haible  <bruno@clisp.org>
1654
1655         * lock.h: Add multiple inclusion guard.
1656         * tls.h: Add multiple inclusion guard.
1657
1658 2005-08-23  Paul Eggert  <eggert@cs.ucla.edu>
1659
1660         * regex.h (REG_NOSYS)
1661         [!defined _XOPEN_SOURCE && 200112L <= _POSIX_C_SOURCE]:
1662         Define, since POSIX requires it as of 2001.
1663         (_REG_ENOSYS) [! (defined _XOPEN_SOURCE || 200112L <= _POSIX_C_SOURCE)]:
1664         New private symbol, used to keep the enum signed in all cases.
1665         * regex.h (RE_NO_EMPTY_RANGES): Fix doc bug reported by James Youngman
1666         in <http://lists.gnu.org/archive/html/bug-gnulib/2005-07/msg00132.html>.
1667
1668         * regex_internal.c (re_string_skip_chars, register_state):
1669         (calc_state_hash):
1670         Remove forward decls; no longer needed now that we use prototypes.
1671         * regexec.c (acquire_init_state_context, check_halt_node_context):
1672         (proceed_next_node, pop_fail_stack, sub_epsilon_src_nodes):
1673         (clean_state_log_if_needed): Likewise.
1674
1675 2005-08-20  Paul Eggert  <eggert@cs.ucla.edu>
1676
1677         Fix problems reported by Sam Steingold in
1678         <http://lists.gnu.org/archive/html/bug-gnulib/2005-08/msg00007.html>.
1679         * regexec.c (sift_states_bkref): Fix portability bug: the code
1680         assumed that reg_errcode_t is a signed type, which is not
1681         necessarily true if _XOPEN_SOURCE is not defined.
1682         * regex_internal.c (calc_state_hash): Put 'inline' before type, since
1683         some compilers warn about it otherwise.
1684
1685 2005-08-20  Jim Meyering  <jim@meyering.net>
1686
1687         * regexec.c (regexec, re_search_stub) [!_LIBC]: Omit declaration
1688         of unused local, dfa.
1689
1690 2005-08-20  Paul Eggert  <eggert@cs.ucla.edu>
1691
1692         * regcomp.c (create_initial_state): Remove duplicate decl.
1693         (init_word_char, create_initial_state, duplicate_node_closure):
1694         (fetch_token, peek_token_bracket, build_range_exp):
1695         (build_collating_symbol): Remove forward decls; no longer needed
1696         now that we use prototypes.
1697
1698         * regcomp.c:
1699         (re_compile_pattern, re_set_syntax, re_compile_fastmap):
1700         (re_compile_fastmap_iter, regcomp, regerror, regfree):
1701         (re_compile_internal, init_dfa, init_word_char, free_workarea_compile):
1702         (create_initial_state, optimize_utf8, analyze, postorder, preorder):
1703         (optimize_subexps, lower_subexps, lower_subexp, calc_first, calc_next):
1704         (link_nfa_nodes, duplicate_node_closure, search_duplicated_node):
1705         (duplicate_node, calc_inveclosure, calc_eclosure, calc_eclosure_iter):
1706         (fetch_token, peek_token, peek_token_bracket, parse, parse_reg_exp):
1707         (parse_branch, parse_expression, parse_sub_exp, parse_dup_op):
1708         (build_range_exp, build_collating_symbol, parse_bracket_exp):
1709         (parse_bracket_element, parse_bracket_symbol, build_equiv_class):
1710         (build_charclass, build_charclass_op, fetch_number, create_tree):
1711         (create_token_tree, mark_opt_subexp, duplicate_tree):
1712         Use prototypes rather than old-style definitions.
1713
1714         * regex_internal.c:
1715         (re_string_allocate, re_string_construct, re_string_realloc_buffers):
1716         (re_string_construct_common, build_wcs_buffer, build_wcs_upper_buffer):
1717         (re_string_skip_chars, build_upper_buffer, re_string_translate_buffer):
1718         (re_string_reconstruct, re_string_peek_byte_case):
1719         (re_string_fetch_byte_case, re_string_destruct, re_string_context_at):
1720         (re_node_set_alloc, re_node_set_init_1, re_node_set_init_2):
1721         (re_node_set_init_copy, re_node_set_add_intersect):
1722         (re_node_set_init_union, re_node_set_merge, re_node_set_insert):
1723         (re_node_set_insert_last, re_node_set_compare, re_node_set_contains):
1724         (re_node_set_remove_at, re_dfa_add_node, calc_state_hash):
1725         (re_acquire_state, re_acquire_state_context, register_state):
1726         (create_ci_newstate, create_cd_newstate, free_state):
1727         Likewise.
1728         * regexec.c (regexec, re_match, re_search, re_match_2, re_search_2):
1729         (re_search_2_stub, re_search_stub, re_copy_regs, re_set_registers):
1730         (re_search_internal, prune_impossible_nodes):
1731         (acquire_init_state_context, check_matching, static):
1732         (check_halt_node_context, check_halt_state_context, proceed_next_node):
1733         (push_fail_stack, pop_fail_stack, set_regs, free_fail_stack_return):
1734         (update_regs, sift_states_backward, build_sifted_states):
1735         (clean_state_log_if_needed, merge_state_array):
1736         (update_cur_sifted_state, add_epsilon_src_nodes):
1737         (sub_epsilon_src_nodes, check_dst_limits, check_dst_limits_calc_pos_1):
1738         (check_dst_limits_calc_pos, check_subexp_limits, sift_states_bkref):
1739         (sift_states_iter_mb, transit_state, merge_state_with_log, static):
1740         (find_recover_state, check_subexp_matching_top, transit_state_mb):
1741         (transit_state_bkref, get_subexp, get_subexp_sub, find_subexp_node):
1742         (check_arrival, check_arrival_add_next_nodes):
1743         (check_arrival_expand_ecl, check_arrival_expand_ecl_sub):
1744         (expand_bkref_cache, build_trtable, group_nodes_into_DFAstates):
1745         (check_node_accept_bytes, check_node_accept, extend_buffers):
1746         (match_ctx_init, match_ctx_clean, match_ctx_free, match_ctx_add_entry):
1747         (search_cur_bkref_entry, match_ctx_add_subtop, match_ctx_add_sublast):
1748         (sift_ctx_init):
1749         Likewise.
1750
1751         * regex_internal.h:
1752         (re_string_allocate, re_string_construct, re_string_reconstruct):
1753         (re_string_realloc_buffers, build_wcs_buffer, build_wcs_upper_buffer):
1754         (build_upper_buffer, re_string_translate_buffer, re_string_destruct):
1755         (re_string_elem_size_at, re_string_char_size_at, re_string_wchar_at):
1756         (re_string_context_at, re_string_peek_byte_case):
1757         (re_string_fetch_byte_case): Declare even if RE_NO_INTERNAL_PROTOTYPES
1758         is defined, since we now use prototypes always.
1759
1760         * regex.h (_RE_ARGS): Remove.  No longer needed, since we assume
1761         C89 or better.  All uses removed.
1762
1763 2005-08-19  Paul Eggert  <eggert@cs.ucla.edu>
1764
1765         * regex_internal.c (re_acquire_state, re_acquire_state_context)
1766         [defined lint]: Suppress bogus uninitialized-variable warnings.
1767
1768         * regcomp.c (duplicate_node): Return new index, not an error code,
1769         and let the caller return REG_ESPACE if out of space.  This
1770         removes an uninitialied-variable warning with GCC 4.0.1, and also
1771         avoids taking the address of a local variable.  All callers
1772         changed.
1773
1774 2005-08-19  Jim Meyering  <jim@meyering.net>
1775
1776         * regexec.c (proceed_next_node): Redo local variables to
1777         avoid GCC shadowing warnings.
1778
1779 2005-08-19  Paul Eggert  <eggert@cs.ucla.edu>
1780
1781         * regex_internal.c (re_string_realloc_buffers, re_node_set_insert):
1782         (re_node_set_insert_last, re_dfa_add_node):
1783         Rename local variables to avoid GCC shadowing warnings.
1784
1785 2005-08-18  Bruno Haible  <bruno@clisp.org>
1786
1787         * strstr.c (strstr): Fix return value in multibyte case.
1788         * strcasestr.c (strcasestr): Likewise.
1789
1790 2005-08-17  Jim Meyering  <jim@meyering.net>
1791
1792         Make the %s format (seconds since the epoch) work for a negative
1793         number and when used with a zero-padded field width, e.g. %015s.
1794
1795         * strftime.c (my_strftime): Move the `do_number_sign_and_padding'
1796         label so that it precedes the code to set `digits'.  Otherwise,
1797         %0Ns wouldn't work.  Before this change, `date -d @-22 +%05s' would
1798         print `00-22'.  Now, it prints `-0022', as it should.
1799
1800 2005-08-17  Paul Eggert  <eggert@cs.ucla.edu>
1801
1802         * regex.h: Remove useless space-before-tab.  From coreutils.
1803
1804 2005-08-17  Bruno Haible  <bruno@clisp.org>
1805
1806         * strcasestr.h: New file.
1807         * strcasestr.c: New file.
1808
1809 2005-08-17  Bruno Haible  <bruno@clisp.org>
1810
1811         * strstr.h: Ignore HAVE_STRSTR, always declare the gnulib function.
1812         * strstr.c: Completely rewritten, with multibyte locale support.
1813
1814 2005-08-17  Bruno Haible  <bruno@clisp.org>
1815
1816         * strcasecmp.c: Use mbuiter.h.
1817
1818 2005-08-17  Bruno Haible  <bruno@clisp.org>
1819
1820         * mbuiter.h: New file.
1821
1822 2005-08-16  Bruno Haible  <bruno@clisp.org>
1823
1824         * strcasecmp.c (struct mbiter_multi): Remove at_end field.
1825         (mbi_init): Update.
1826         (mbi_avail, mbi_advance): Let the iteration end before the terminating
1827         NUL byte, not after it.
1828
1829 2005-08-16  Bruno Haible  <bruno@clisp.org>
1830
1831         * mbchar.h (mb_cmp, mb_casecmp): Order the invalid characters after
1832         the valid ones. Makes the comparison operations transitive:
1833         cmp (a, b) < 0 && cmp (b, c) < 0 ==> cmp (a, c) < 0.
1834         * strcasecmp.c (strcasecmp): Use mb_casecmp.
1835
1836 2005-08-16  Bruno Haible  <bruno@clisp.org>
1837
1838         * strcase.h (strcasecmp): Add note in comments.
1839         * strncasecmp.c: Use code from strcasecmp.c.
1840         * strcasecmp.c: Use mbchar module. Define private mbiter variant.
1841         (strcasecmp): Work correctly in multibyte locales.
1842
1843 2005-08-16  Bruno Haible  <bruno@clisp.org>
1844
1845         * strnlen1.h: New file.
1846         * strnlen1.c: New file.
1847
1848 2005-08-16  Bruno Haible  <bruno@clisp.org>
1849
1850         * mbfile.h: New file.
1851
1852 2005-08-16  Bruno Haible  <bruno@clisp.org>
1853
1854         * mbiter.h: New file.
1855
1856 2005-08-16  Bruno Haible  <bruno@clisp.org>
1857
1858         * mbchar.h: New file.
1859         * mbchar.c: New file.
1860
1861 2005-08-16  Bruno Haible  <bruno@clisp.org>
1862
1863         * tls.h: New file, from GNU gettext.
1864         * tls.c: New file, from GNU gettext.
1865
1866 2005-08-15  Bruno Haible  <bruno@clisp.org>
1867
1868         * regex.h (__restrict_arr): Don't define to __restrict if __cplusplus
1869         is defined.
1870
1871 2005-08-14  Jim Meyering  <jim@meyering.net>
1872
1873         Sync from coreutils.
1874
1875         * fts-cycle.c (setup_dir, enter_dir, leave_dir, free_dir):
1876         Use the hash-table-based cycle-detection code not just when
1877         FTS_TIGHT_CYCLE_CHECK if specified, but also with FTS_LOGICAL.
1878         Reported by James Youngman in
1879         <http://lists.gnu.org/archive/html/bug-gnulib/2005-08/msg00011.html>.
1880         * fts_.h: Mention that with FTS_LOGICAL, we use FTS_TIGHT_CYCLE_CHECK.
1881         * fts.c (fts_cross_check) [FTS_DEBUG]: s/active_dir_ht/fts_cycle.ht/.
1882         This lets us compile with -DFTS_DEBUG, once again.
1883         * fts.c [! _LIBC]: Include "lstat.h" rather than rolling our own.
1884         * fts.c (fd_safer): Remove decl.
1885         Include fcntl--.h rather than unistd-safer.h
1886         (fts_safe_changedir): Don't call fd_safer; no longer needed
1887         now that we include fcntl--.h.
1888
1889 2005-08-11  Simon Josefsson  <jas@extundo.com>
1890
1891         * readline.h, readline.c: New file.
1892
1893 2005-08-11  Bruno Haible  <bruno@clisp.org>
1894
1895         * strnlen.h (strnlen): Change parameter name to match comment.
1896
1897 2005-08-10  Simon Josefsson  <jas@extundo.com>
1898
1899         * strndup.c: Use strnlen.h.
1900
1901         * strnlen.h: New file.
1902
1903 2005-08-02  Simon Josefsson  <jas@extundo.com>
1904
1905         * getline.h, getline.c: Rewrite.
1906
1907         * getdelim.h, getdelim.c: New files, ported from glibc.
1908
1909 2005-07-31  Bruno Haible  <bruno@clisp.org>
1910
1911         * lock.h (gl_lock_initializer): New macro.
1912         (gl_lock_define_initialized): Use it.
1913         (gl_rwlock_initializer): New macro.
1914         (gl_rwlock_define_initialized): Use it.
1915         (gl_recursive_lock_initializer): New macro.
1916         (gl_recursive_lock_define_initialized): Use it.
1917
1918 2005-07-26  Bruno Haible  <bruno@clisp.org>
1919
1920         * lock.h: Update from GNU gettext.
1921         * lock.c: Update from GNU gettext.
1922
1923 2005-07-18  Bruno Haible  <bruno@clisp.org>
1924
1925         * lock.h (gl_once_t): New type.
1926         (gl_once_define, gl_once): New macros.
1927         * lock.c (fresh_once): New variable.
1928         (glthread_once, glthread_once_call, glthread_once_singlethreaded): New
1929         functions.
1930
1931 2005-07-18  Simon Josefsson  <jas@extundo.com>
1932
1933         * check-version.c (check_version): Accept identical versions too.
1934
1935 2005-07-18  Bruno Haible  <bruno@clisp.org>
1936
1937         * lock.h: New file, from GNU gettext.
1938         * lock.c: New file, from GNU gettext.
1939
1940 2005-07-15  Paul Eggert  <eggert@cs.ucla.edu>
1941
1942         * quotearg.c: Add translator comment suggested by Bruno Haible,
1943         with a minor change.
1944
1945 2005-07-11  Paul Eggert  <eggert@cs.ucla.edu>
1946
1947         * version-etc-fsf.c (version_etc_copyright): Parameterize the
1948         copyright symbol and the year.
1949         * version-etc.c (COPYRIGHT_YEAR): New constant.
1950         (version_etc_va): Use parameterized copyright notice.
1951         Reword to conform to the current GNU coding standards.
1952
1953 2005-07-11  Simon Josefsson  <jas@extundo.com>
1954
1955         * size_max.h: New file.
1956
1957 2005-07-09  Sergey Poznyakoff  <gray@gnu.org.ua>
1958
1959         * argp-namefrob.h: Include unlocked-io.h. Removed unnecessary
1960         block of defines.
1961
1962 2005-07-08  Eric Blake  <ebb9@byu.net>  (tiny change)
1963        and  Paul Eggert  <eggert@cs.ucla.edu>
1964
1965         * regcomp.c (init_dfa, build_range_exp): Store __btowc value
1966         in wint_t, not wchar_t.  Remove now-unnecessary cast.
1967
1968 2005-07-07  Paul Eggert  <eggert@cs.ucla.edu>
1969
1970         * regex.c, regex.h: Sync from libc.
1971         * regcomp.c, regexec_internal.c, regex_internal.h, regexec.c:
1972         New files, synced from libc, except that regex_internal.h
1973         currently has a small porting fix.
1974
1975 2005-07-03  Paul Eggert  <eggert@cs.ucla.edu>
1976
1977         Remove the dependency of the strftime module on the tzset module.
1978         * strftime.c (my_strftime) [! defined _LIBC && ! HAVE_RUN_TZSET_TEST]:
1979         Copy the input structure, to work around some of the bug with
1980         Solaris 2.5.1 and Solaris 2.6.  If you still care about these old
1981         Solaris releases, you should also use the tzset module, but we won't
1982         require it as a dependency any more since we don't want LGPLed code
1983         to depend on GPLed code.
1984
1985 2005-07-02  Jim Meyering  <jim@meyering.net>
1986
1987         * backupfile.c (backup_args): Change a `0' to NULL.
1988
1989 2005-07-01  Jim Meyering  <jim@meyering.net>
1990
1991         * chown.c, cloexec.c, dup-safer.c, dup2.c, fsusage.c, getcwd.c:
1992         * getloadavg.c, mountlist.c, openat.h, pagealign_alloc.c:
1993         * save-cwd.c, tempname.c:
1994         Assume HAVE_FCNTL_H (i.e., include <fcntl.h> unconditionally,
1995         and don't include <sys/file.h>).
1996
1997 2005-07-01  Paul Eggert  <eggert@cs.ucla.edu>
1998
1999         * xnanosleep.c: Include timespec.h, since OpenBSD 3.4 <time.h>
2000         declares only 'struct timespec;' (!).
2001
2002 2005-06-29  Jim Meyering  <jim@meyering.net>
2003
2004         * mkdir-p.c (make_dir_parents): Don't apply sizeof to a hard-coded
2005         type name.  Use the variable name instead.
2006         * idcache.c (getuser, getuidbyname, getgroup, getgidbyname): Likewise.
2007
2008 2005-06-28  Simon Josefsson  <jas@extundo.com>
2009
2010         * check-version.h, check-version.c: New files.
2011
2012 2005-06-28  Simon Josefsson  <jas@extundo.com>
2013
2014         * base64.c (base64_encode): Indent.  Rename 'b64' to avoid
2015         collision with global variable.  Better indentation.  Don't
2016         increment buffer pointer beyond buffer end.  Based on comments
2017         from Paul Eggert <eggert@cs.ucla.edu>.
2018
2019         * base64.h: Indent.
2020
2021 2005-06-24  Paul Eggert  <eggert@cs.ucla.edu>
2022
2023         * canon-host.c (canon-host): Append trailing "," to 0 in
2024         initializer of struct addrinfo, as an indication that we don't
2025         care how many members the structure has.
2026
2027 2005-06-24  Derek Price  <derek@ximbiot.com>
2028         and Bruno Haible  <bruno@clisp.org>
2029
2030         Remove stat module & update lstat.
2031         * stat.c: Remove this file...
2032         (slash_aware_lstat): ...moving this content and its support...
2033         * lstat.c (rpl_lstat): ...into here.
2034         * lstat.h: New file.
2035
2036 2005-06-23  Paul Eggert  <eggert@cs.ucla.edu>
2037
2038         * mktime.c: Include <string.h> even if !DEBUG.  (From glibc.)
2039         (ranged_convert): Don't save conversion in a temporary struct.
2040         This causes a warning with GCC 4.0.0, and anyway in the typical
2041         case it's not worth the extra 100 bytes or so of code.
2042         (ranged_convert, __mktime_internal): When calling a function via a
2043         pointer P, use P () rather than (*P) (), as we now assume C89 or
2044         better.
2045
2046 2005-06-22  Paul Eggert  <eggert@cs.ucla.edu>
2047
2048         * readutmp.c (desirable_utmp_entry): Fix bug where "who -b" and
2049         "who -r" failed to give output.  Problem reported by Tim Waugh.
2050
2051         * xmalloc.c (HAVE_GNU_CALLOC): New constant.
2052         (xcalloc): Use it to avoid needless tests.
2053         Problem reported by Jim Meyering.
2054
2055 2005-06-16  Jim Meyering  <jim@meyering.net>
2056
2057         * calloc.c (rpl_calloc): Allocate a 1-byte buffer (not 1xS or Nx1)
2058         when either N or S is zero.
2059
2060 2005-06-16  Sergey Poznyakoff  <gray@Mirddin.farlep.net>
2061
2062         * argp.h (__option_is_short): Check upper limit of
2063         __key. Isprint() requires its argument to have the value
2064         of an unsigned char or EOF.
2065
2066 2005-06-10  Paul Eggert  <eggert@cs.ucla.edu>
2067
2068         * fnmatch.c (fnmatch): If there is an encoding error in a
2069         multibyte string or pattern, fall back on unibyte matching.
2070         Problem reported by James Youngman.
2071
2072 2005-06-08  Bruno Haible  <bruno@clisp.org>
2073
2074         * binary-io.h (fileno): Undefine before defining it. Avoids a gcc
2075         warning on mingw.
2076
2077 2005-06-08  Bruno Haible  <bruno@clisp.org>
2078
2079         * csharpcomp.h: New file, from GNU gettext.
2080         * csharpcomp.c: New file, from GNU gettext.
2081         * csharpcomp.sh.in: New file, from GNU gettext.
2082
2083 2005-06-07  Derek Price  <derek@ximbiot.com>
2084
2085         Sync from CVS.
2086         * glob_.h: Indent nested #ifdef.
2087
2088 2005-06-02  Paul Eggert  <eggert@cs.ucla.edu>
2089
2090         Sync from coreutils.
2091         Use "file name" when talking about file names, instead of "filename"
2092         or "path", as per the GNU coding standards.
2093         * mkdir-p.c: Renamed from makepath.c.
2094         (make_dir_parents): Renamed from make_path.  All callers changed.
2095         * mkdir-p.h: Likewise.  All includers changed.
2096         * filenamecat.c: Renamed from path-concat.c.
2097         (file_name_concat): Renamed from path_concat.  All callers changed.
2098         [TEST_FILE_NAME_CONCAT]: Renamed from TEST_PATH_CONCAT.
2099         * filenamecat.h: Likewise.  All includers changed.
2100         * acl.c: Don't use "path" or "filename" to mean "file name"
2101         in comments or local variable names.
2102         * basename.c: Likewise.
2103         * canonicalize.c, canonicalize.h: Likewise.
2104         * dirname.c, dirname.h: Likewise.
2105         * euidaccess.c: Likewise.
2106         * exclude.c: Likewise
2107         * fnmatch_.h, fnmatch_loop.c: Likewise.
2108         * fsusage.c, fsuage.h: Likewise.
2109         * fts.c, fts_.h: Likewise.
2110         * getcwd.c: Likewise.
2111         * getloadavg.c: Likewise.
2112         * mkstemp.c: Likewise.
2113         * mountlist.c, mountlist.h: Likewise.
2114         * openat.c, openat.h: Likewise.
2115         * readlink-stub.c: Likewise.
2116         * readutmp.c, readutmp.h: Likewise.
2117         * rename.c: Likewise.
2118         * rmdir.c: Likewise.
2119         * same.c: Likewise.
2120         * savedir.c: Likewise.
2121         * stripslash.c: Likewise.
2122         * tempname.c: Likewise.
2123         * xreadlink.c: Likewise.
2124         * exclude.c (excluded_file_name): Renamed from excluded_filename.
2125         All uses changed.
2126         * exclude.h: Likewise.
2127
2128         * euidaccess.c (getuid, getgid, getuid, getegid)
2129         [!defined _POSIX_VERSION]: Remove decls; not needed these days.
2130         * idcache.c (getpwuid, getpwnam, getgrgid, getgrnam)
2131         [!defined _POSIX_VERSION]: Remove decls; not needed these days.
2132         * pathmax.h: Include <limits.h> unconditionally, since other
2133         files have been getting away with it for years (MORE/BSD 4.3
2134         is extinct now).
2135         * userspec.c (getpwnam, getgrnam, getgrgid)
2136         [!defined _POSIX_VERSION]: Remove decls; not needed these days.
2137
2138         * pathmax.h (_POSIX_PATH_MAX) [!defined _POSIX_PATH_MAX]:
2139         Define to 256, not 255, as per modern POSIX.
2140
2141 2005-06-01  Bruno Haible  <bruno@clisp.org>
2142
2143         * csharpexec.h: New file, from GNU gettext.
2144         * csharpexec.c: New file, from GNU gettext.
2145         * csharpexec.sh.in: New file, from GNU gettext.
2146
2147 2005-05-31  Derek Price  <derek@ximbiot.com>
2148             Paul Eggert  <eggert@cs.ucla.edu>
2149
2150         Sync from cvs.
2151         * glob_.h: s/MISSING_SYS_CDEFS_H/_SYS_CDEFS_H/ and comment.
2152
2153 2005-05-29  Derek Price  <derek@ximbiot.com>
2154             Paul Eggert  <eggert@cs.ucla.edu>
2155
2156         * glob_.h, glob.c: New files.
2157
2158 2005-05-27  Paul Eggert  <eggert@cs.ucla.edu>
2159
2160         * getlogin_r.c (getlogin_r): Don't set errno to 0 on return.
2161
2162         * fts.c: Don't worry about debugging on pre-C99-compatible hosts;
2163         the configuration hassle isn't worth it.
2164         Include inttypes.h and stdint.h unconditionally if FTS_DEBUG.
2165         (LONGEST_MODIFIER, PRIuMAX): Remove.
2166
2167 2005-05-27  Bruno Haible  <bruno@clisp.org>
2168
2169         * getlogin_r.h: Remove second include of <stddef.h>.
2170
2171 2005-05-25  Bruno Haible  <bruno@clisp.org>
2172             Derek Price  <derek@ximbiot.com>
2173
2174         * getlogin_r.h: Simplify API documentation.
2175
2176 2005-05-25  Derek Price  <derek@ximbiot.com>
2177             Paul Eggert  <eggert@cs.ucla.edu>
2178
2179         * getlogin_r.c, getlogin_r.h: New files.
2180
2181 2005-05-22  Bruno Haible  <bruno@clisp.org>
2182
2183         * minmax.h: Include <limits.h> only when it defines MIN, MAX.
2184         Also include <sys/param.h> if it defines MIN, MAX.
2185         Based on a patch by Derek Price <derek@ximbiot.com>.
2186
2187 2005-05-22  Bruno Haible  <bruno@clisp.org>
2188
2189         * stdint_.h (_STDINT_H_HAVE_INT64): New macro. Use it in #ifdefs.
2190         (INT64_MIN): Fix definition.
2191         Suggested by Paul Eggert <eggert@cs.ucla.edu>.
2192
2193         * stdint_.h (_STDINT_H_NEED_SIGNED_INT_TYPES): Renamed from
2194         NEED_SIGNED_INT_TYPES.
2195
2196         * stdint_.h (_STDINT_H_HAVE_SYSTEM_INTTYPES): Renamed from
2197         HAVE_SYSTEM_INTTYPES.
2198
2199 2005-05-22  Paul Eggert  <eggert@cs.ucla.edu>
2200
2201         * fts.c (fd_safer) [_LGPL_PACKAGE]: New static function,
2202         so that unistd-safer.h (GPL'ed code) need not be included.
2203
2204 2005-05-20  Paul Eggert  <eggert@cs.ucla.edu>
2205
2206         New fts module.
2207         * fts.c: Don't include "cycle-check.h" or "hash.h".
2208         (setup_dir, free_dir): New functions.
2209         (enter_dir, leave_dir): Define trivial
2210         alternatives of _LGPL_PACKAGE.  Move to fts-cycle.c if !_LGPL_PACKAGE.
2211         (HT_INITIAL_SIZE, ENTER_DIR): Remove.  All uses removed.
2212         (LEAVE_DIR): Fix typo: pass Fts and Ent to leave_dir.
2213         (struct Active_dir, AD_compare, AD_hash, enter_dir, leave_dir):
2214         Move to fts-cycle.c.
2215         (fts_open): Use setup_dir.
2216         (fts_close): Use free_dir.
2217         (fts_read): Have just one copy of the ENTER_DIR code rather than three.
2218         This adds a label and some gotos, but the alternatives were messier.
2219         Check for memory allocation failure when entering a dir.
2220         (fts_stat) [_LGPL_PACKAGE]: Bring back glibc cycle detection code.
2221         * fts_.h (_LGPL_PACKAGE) [defined _LIBC]: New macro.
2222         (FTS): New member fts_cycle, that is a union that contains the
2223         old active_dir_ht and cycle_state.  All uses changed to mention
2224         fts_cycle.ht and fts_cycle.state.
2225         * fts-cycle.c: New file, containing GPL'ed code migrated out of
2226         fts.c, with the following changes:
2227         (setup_dir, free_dir): New functions.
2228         (enter_dir): Now returns bool.  Return true if successful, false
2229         if memory exhausted.  All callers changed.
2230         Do not bother partly cleaning up on
2231         memory allocation failure; that is free_dir's job.
2232         However, free ad if hash_insert fails, to avoid memory leak.
2233         (enter_dir, leave_dir): Accommodate change to FTS by inspecting
2234         fts->fts_options to see which union member to use.
2235
2236 2005-05-20  Jim Meyering  <jim@meyering.net>
2237
2238         * unlinkdir.h (cannot_unlink_dir) [UNLINK_CANNOT_UNLINK_DIR]:
2239         Now a macro, to pacify GCC.
2240
2241 2005-05-20  Eric Blake  <ebb9@byu.net>  (tiny change)
2242
2243         * chown.c (rpl_chown): Return -1 on failure.
2244
2245 2005-05-18  Paul Eggert  <eggert@cs.ucla.edu>
2246
2247         * canonicalize.c: Include canonicalize.h first, to test interface.
2248         Include <stddef.h> unconditionally, since we assume C89 now.
2249         All uses of PTR_INT_TYPE replaced by ptrdiff_t.
2250         * fts.c: Include fts_.h first, to check interface.
2251         Do not include intprops.h; no longer needed.
2252         Include cycle-check.h and hash.h, since fts_.h no longer does.
2253         Remove unnecessary casts of closedir to void.
2254         (fts_build): Use a simpler method (not involving TYPE_SIGNED) to
2255         decide whether to decrement nlinks.
2256         * fts_.h: Do not include hash.h or cycle-check.h; no longer needed.
2257         (FTS): Use struct hash_table * instead of Hash_table, so that
2258         we no longer need to include hash.h here.
2259
2260 2005-05-17  Jim Meyering  <jim@meyering.net>
2261
2262         * fts.c, fts_.h: New files, from coreutils.
2263
2264 2005-05-14  Paul Eggert  <eggert@cs.ucla.edu>
2265
2266         Sync from coreutils.
2267         * unlinkdir.c, unlinkdir.h: New files.
2268         * gethrxtime.c, gethrxtime.h, getpass.h, mountlist.h, path-concat.c,
2269         regex.h, unlocked-io.h, xtime.h:
2270         White space changes only.
2271         * makepath.c (make_path): Port to hosts where leading "//" is special.
2272         * yesno.c: Include getline.h, not ctype.h.
2273         (yesno): Don't remove leading white space; POSIX doesn't allow it.
2274         Use getline to remove arbitrary restriction on response length.
2275
2276 2005-05-13  Bruno Haible  <bruno@clisp.org>
2277
2278         * stdint_.h (int64_t, uint64_t, int_least64_t, uint_least64_t,
2279         int_fast64_t, uint_fast64_t, intmax_t, uintmax_t, INT64_MIN, INT64_MAX,
2280         UINT64_MAX, INT_LEAST64_MIN, INT_LEAST64_MAX, UINT_LEAST64_MAX,
2281         INT_FAST64_MIN, INT_FAST64_MAX, UINT_FAST64_MAX, INTMAX_MIN,
2282         INTMAX_MAX, UINTMAX_MAX, INT64_C, UINT64_C, INTMAX_C, UINTMAX_C):
2283         Add support for 64-bit integers in the MSVC compiler.
2284
2285 2005-05-13  Paul Eggert  <eggert@cs.ucla.edu>
2286
2287         * byteswap_.h, getsubopt.h, iconvme.h, strsep.c, strsep.h:
2288         Change the initial comment to refer to GPL, not LGPL.
2289         gnulib-tool will change it to LGPL as needed.
2290
2291         * __fpending.c, acl.c, acl.h, alloca_.h, allocsa.c, allocsa.h,
2292         argmatch.c, argmatch.h, argp-ba.c, argp-eexst.c, argp-fmtstream.c,
2293         argp-fmtstream.h, argp-fs-xinl.c, argp-help.c, argp-namefrob.h,
2294         argp-parse.c, argp-pv.c, argp-pvh.c, argp-xinl.c, argp.h, argz.c,
2295         argz_.h, asnprintf.c, asprintf.c, atanl.c, backupfile.c,
2296         backupfile.h, base64.c, base64.h, basename.c, binary-io.h,
2297         byteswap_.h, c-ctype.c, c-ctype.h, c-stack.c, c-stack.h,
2298         c-strtod.c, calloc.c, canon-host.c, canonicalize.c,
2299         canonicalize.h, ceill.c, chdir-long.c, chdir-long.h, chown.c,
2300         classpath.c, classpath.h, cloexec.c, closeout.c, closeout.h,
2301         concatpath.c, config.charset, copy-file.c, copy-file.h,
2302         cycle-check.c, cycle-check.h, diacrit.c, diacrit.h, dirfd.c,
2303         dirfd.h, dirname.c, dirname.h, dummy.c, dup-safer.c, dup2.c,
2304         eealloc.h, error.c, error.h, euidaccess.c, exclude.c, exclude.h,
2305         execute.c, execute.h, exit.h, exitfail.c, exitfail.h, expl.c,
2306         fatal-signal.c, fatal-signal.h, fd-safer.c, file-type.c,
2307         file-type.h, fileblocks.c, filemode.c, filemode.h, findprog.c,
2308         findprog.h, floorl.c, fnmatch.c, fnmatch_.h, fnmatch_loop.c,
2309         fopen-safer.c, free.c, frexpl.c, fsusage.c, fsusage.h,
2310         full-read.c, full-read.h, full-write.c, full-write.h,
2311         fwriteerror.c, fwriteerror.h, gai_strerror.c, gcd.c, gcd.h,
2312         getaddrinfo.c, getaddrinfo.h, getcwd.c, getcwd.h, getdate.h,
2313         getdate.y, getdomainname.c, getdomainname.h, getgroups.c,
2314         gethostname.c, gethrxtime.c, gethrxtime.h, getline.c, getline.h,
2315         getloadavg.c, getndelim2.c, getndelim2.h, getnline.c, getnline.h,
2316         getopt.c, getopt1.c, getopt_.h, getopt_int.h, getpagesize.h,
2317         getpass.c, getpass.h, getsubopt.c, getsubopt.h, gettext.h,
2318         gettime.c, gettimeofday.c, getugroups.c, getusershell.c,
2319         group-member.c, group-member.h, hard-locale.c, hard-locale.h,
2320         hash-pjw.c, hash-pjw.h, hash.c, hash.h, human.c, human.h,
2321         iconvme.c, iconvme.h, idcache.c, inet_ntop.h, intprops.h,
2322         inttostr.c, inttostr.h, isdir.c, javacomp.c, javacomp.h,
2323         javacomp.sh.in, javaexec.c, javaexec.h, javaexec.sh.in,
2324         lbrkprop.h, lchown.c, ldexpl.c, linebreak.c, linebreak.h,
2325         linebuffer.c, linebuffer.h, localcharset.c, localcharset.h,
2326         logl.c, long-options.c, long-options.h, lstat.c, makepath.c,
2327         makepath.h, malloc.c, mathl.h, mbswidth.c, mbswidth.h, md5.c,
2328         md5.h, memcasecmp.c, memcasecmp.h, memchr.c, memcmp.c, memcoll.c,
2329         memcoll.h, memcpy.c, memmem.c, memmem.h, mempcpy.c, mempcpy.h,
2330         memrchr.c, memrchr.h, memset.c, minmax.h, mkdir.c, mkdtemp.c,
2331         mkdtemp.h, mkstemp.c, mktime.c, modechange.c, modechange.h,
2332         mountlist.c, mountlist.h, nanosleep.c, obstack.c, obstack.h,
2333         openat.c, openat.h, pagealign_alloc.c, pagealign_alloc.h,
2334         path-concat.c, path-concat.h, pathmax.h, pathname.h, physmem.c,
2335         physmem.h, pipe.c, pipe.h, poll.c, poll_.h, posixtm.c, posixtm.h,
2336         posixver.c, printf-args.c, printf-args.h, printf-parse.c,
2337         printf-parse.h, progname.c, progname.h, progreloc.c, putenv.c,
2338         quote.c, quote.h, quotearg.c, quotearg.h, raise.c, readlink.c,
2339         readtokens.c, readtokens.h, readtokens0.c, readtokens0.h,
2340         readutmp.c, readutmp.h, realloc.c, ref-add.sin, ref-del.sin,
2341         regex.c, regex.h, rename.c, rmdir.c, rpmatch.c, safe-read.c,
2342         safe-read.h, safe-write.c, safe-write.h, same.c, same.h,
2343         save-cwd.c, save-cwd.h, savedir.c, savedir.h, setenv.c, setenv.h,
2344         settime.c, sh-quote.c, sh-quote.h, sha1.c, sha1.h, sig2str.c,
2345         sig2str.h, sincosl.c, snprintf.c, snprintf.h, sqrtl.c,
2346         stat-macros.h, stat.c, stdbool_.h, stdint_.h, stdio-safer.h,
2347         stpcpy.c, stpcpy.h, stpncpy.c, stpncpy.h, strcase.h, strcasecmp.c,
2348         strchrnul.c, strchrnul.h, strcspn.c, strdup.c, strdup.h,
2349         strerror.c, strftime.c, strftime.h, stripslash.c, strndup.c,
2350         strndup.h, strnlen.c, strpbrk.c, strpbrk.h, strsep.c, strsep.h,
2351         strstr.c, strstr.h, strtod.c, strtoimax.c, strtok_r.c, strtok_r.h,
2352         strtol.c, strtoll.c, strtoul.c, strtoull.c, strverscmp.c,
2353         strverscmp.h, sysexit_.h, tempname.c, time_r.c, time_r.h,
2354         timegm.c, timegm.h, timespec.h, trigl.c, trigl.h, ucs4-utf16.h,
2355         ucs4-utf8.h, unicodeio.c, unicodeio.h, unistd-safer.h,
2356         unlocked-io.h, unsetenv.c, userspec.c, utf16-ucs4.h, utf8-ucs4.h,
2357         utime.c, utimecmp.c, utimecmp.h, utimens.c, vasnprintf.c,
2358         vasnprintf.h, vasprintf.c, vasprintf.h, version-etc-fsf.c,
2359         version-etc.c, version-etc.h, vsnprintf.c, vsnprintf.h,
2360         w32spawn.h, wait-process.c, wait-process.h, xalloc-die.c,
2361         xalloc.h, xallocsa.c, xallocsa.h, xasprintf.c, xgetcwd.c,
2362         xgetcwd.h, xgetdomainname.c, xgetdomainname.h, xgethostname.c,
2363         xmalloc.c, xmemcoll.c, xnanosleep.c, xreadlink.c, xreadlink.h,
2364         xsetenv.c, xsetenv.h, xsize.h, xstrndup.c, xstrndup.h, xstrtod.c,
2365         xstrtod.h, xstrtoimax.c, xstrtol.c, xstrtol.h, xstrtoumax.c,
2366         xtime.h, xvasprintf.c, xvasprintf.h, yesno.c, yesno.h:
2367         Update FSF postal mail address.
2368
2369 2005-05-10  Yoann Vandoorselaere <yoann.v@prelude-ids.com>
2370
2371         * getaddrinfo.c: Don't fail when SOCK_STREAM or SOCK_DGRAM are
2372         specified in ai_socktype. Fix invalid ai_protocol
2373         check. ai_protocol is usually set to 0 or depending on
2374         ai_family/ai_socktype to IPPROTO_TCP / IPPROTO_UDP.  Checking for
2375         SOCK_STREAM / SOCK_DGRAM in ai_protocol was invalid.  Set
2376         ai_socktype / ai_protocol in the returned addrinfo structure.
2377
2378 2005-05-09  Yoann Vandoorselaere <yoann.v@prelude-ids.com>
2379             Bruno Haible  <bruno@clisp.org>
2380
2381         * inet_ntop.h: New file.
2382         * inet_ntop.c: New file, from glibc with modifications.
2383
2384 2005-05-08  Jim Meyering  <jim@meyering.net>
2385
2386         * classpath.c (PATH_SEPARATOR): Remove insignificant trailing blank.
2387
2388 2005-05-01  Paul Eggert  <eggert@cs.ucla.edu>
2389
2390         Merge from coreutils.  Among other things,
2391         add bulletproofing for cases where stdin, stdout, or stderr are closed.
2392         * fd-safer.c: New file.
2393         * fcntl-safer.h, open-safer.c: Remove.
2394         * chdir-long.c: Fix comment "fetish" -> "coreutils".
2395         * dup-safer.c: Include unistd-safer.h first.
2396         Don't include errno.h.
2397         (dup_safer) [!defined F_DUPFD]: Let fd_safer do the real work.
2398         * file-type.h: Don't assume invoker included sys/stat.h first.
2399         * file-type.c: Rely on file-type.h change.
2400         * getloadavg.c: Include unistd-safer.h.
2401         (getloadavg): Use safer open.
2402         * getusershell.c: Include "stdio-safer.h".
2403         (getusershell): Use safer fopen.
2404         * long-options.c (long_options): Use NULL rather than 0.
2405         * modechange.h (mode_free): Remove; all callers changed to invoke
2406         'free'.
2407         * modechange.c: Likewise.
2408         xstrtol.h, stdbool.h, stddef.h: Don't include; no longer needed.
2409         (MODE_DONE): New constant.
2410         (struct mode_change): Remove 'next' member.
2411         (make_node_op_equals): New function; like the old one of the
2412         same name, except it allocates an array.
2413         (mode_compile, mode_create_from_ref): Use it.
2414         (mode_compile): Allocate result as an array, not a linked list.
2415         Parse octal string ourself, so that we catch mistakes like "+0".
2416         (mode_adjust): Arg is an array, not a linked list.
2417         * modechange.c: Include stat-macros.h, xalloc.h.
2418         (S_ISDIR, S_ISUID, S_ISGID, S_ISVTX, S_IRUSR, S_IWUSR, S_IXUSR):
2419         (S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH, S_IXOTH, S_IRXWU):
2420         (S_IRWXG, S_IRWXO, CHMOD_MODE_BITS):
2421         Remove.  This is now stat-macros.h's job.
2422         (talloc): Remove.  All callers replaced by xalloc, so that
2423         our invokers don't have to worry about reporting memory failures.
2424         (make_node_op_equals): Remove.
2425         (MODE_ORDINARY_CHAGE, MODE_X_IF_ANY_X, MODE_COPY_EXISTING):
2426         New constants.
2427         (struct mode_change): Moved here from modechange.h.
2428         (mode_append_entry): Remove.
2429         (mode_compile): Remove MASKED_OPS arg, since it encouraged
2430         apps to have incorrect behavior.  Use simpler algorithm for head
2431         and tail.  Don't futz with umask; that's now the job of mode_adjust.
2432         Detect more invalid usages rather than having somewhat-random behavior.
2433         Don't insert an "a=" action, as that leads to incorrect behavior.
2434         (mode_compile, mode_create_from_ref): Return NULL on error instead
2435         of an enum, since now there's only one way to have an error.  All
2436         callers changed.
2437         (mode_adjust): Accept new arg UMASK_VALUE, and interpret it
2438         at the correct time.  Simplify calculation of "+u" and its ilk.
2439         Don't mishandle "+X".
2440         (mode_free): Remove "register" and localize decls.
2441         * modechange.h (MODE_X_IF_ANY_X, MODE_COPY_EXISTING):
2442         (struct mode_change): Move to modechange.c; callers don't
2443         need to see this stuff.
2444         (MODE_MASK_EQUALS, MODE_MASK_PLUS, MODE_MASK_MINUS, MODE_MASK_ALL):
2445         (MODE_INVALID, MODE_MEMORY_EXHAUSTED, MODE_BAD_REFERENCE): Remove.
2446         (mode_change, mode_adjust): Reflect the new signatures noted above.
2447         * nanosleep.c (rpl_nanosleep): Include "timespec.h" before macros
2448         that might redefine system include files.
2449         (siginterrupt) [!HAVE_SIGINTERRUPT]: New macro.
2450         (my_usleep): Use NULL rather than (void *) 0.
2451         (rpl_nanosleep) [!defined SA_NOCLDSTOP]:
2452         Use siginterrupt to specify that system calls should be interrupted.
2453         (rpl_nanosleep): Move initialization of suspended closer to call of
2454         my_usleep.
2455         * readutmp.h (read_utmp): New arg OPTIONS.  All uses changed.
2456         * readutmp.c: Likewise.  Include signal.h, stdbool.h.
2457         (desirable_utmp_entry): New function.
2458         (read_utmp) [defined UTMP_NAME_FUNCTION]: Redo memory allocation
2459         using x2nrealloc, to simplify logic.
2460         (read_utmp) [!defined UTMP_NAME_FUNCTION]: Check for overflow in
2461         size calculation.  Do not assume utmp file is a regular file.
2462         * readutmp.h (UT_PID): Moved here from ../src/who.c.
2463         (READ_UTMP_CHECK_PIDS): New constant.
2464         * save-cwd.c: Include unistd-safer.h.
2465         (save_cwd): Use fd_safer.
2466         * tempname.c (S_ISDIR, S_IRUSR, S_IRUSR, S_IWUSR, S_IXUSR): Remove.
2467         [!_LIBC] Include "stat-macros.h" instead.
2468         * unistd-safer.h (fd_safer): New decl.
2469
2470 2005-05-01  Oskar Liljeblad  <oskar@osk.mine.nu>
2471
2472         * byteswap_.h: New file.
2473
2474 2005-04-25  Albert Chin  <china@thewrittenword.com>
2475
2476         * regex.c: Include <stdio.h>, as a workaround to a Compaq Desktop
2477         Toolkit C bug.
2478
2479 2005-04-13  Paul Eggert  <eggert@cs.ucla.edu>
2480
2481         * getdate.y (zone): Allow relunit_snumber after tZONE, so
2482         that "UTC +1 second" continues to work.  Problem reported
2483         by Dmitry V. Levin.
2484         (relunit_snumber): New rule.
2485         (relunit): Use it.
2486
2487 2005-04-12  Paul Eggert  <eggert@cs.ucla.edu>
2488
2489         * getdate.y (universal_time_zone_table): New constant.
2490         (time_zone_table): Remove GMT, UT, UTC entries; they're now in
2491         universal_time_zone_table.
2492         (lookup_zone): Prefer universal_time_zone_table to
2493         local_time_zone_table, so that "GMT" time stamps are allowed in
2494         London during the summer.  Problem reported by Ian Abbott.
2495
2496 2005-04-12  Jim Meyering  <jim@meyering.net>
2497
2498         * human.c (humblock): Set *options even when returning due to
2499         xstrtoumax conversion failure.  Thanks to a used-uninitialized
2500         warning from gcc-4.
2501
2502 2005-04-09  Jim Meyering  <jim@meyering.net>
2503
2504         * posixtm.c (posixtime) [lint]: Avoid spurious warning from gcc-4's
2505         -Wuninitialized: initialize tm0.tm_year.
2506
2507 2005-04-04  Paul Eggert  <eggert@cs.ucla.edu>
2508
2509         * getdate.y (parser_control): rels_seen is now a boolean, not a
2510         count, since there's no maximum.  All uses changed.
2511         Add member dsts_seen.
2512         (local_zone): Accumulate dsts_seen rather than relying on tm_isdst
2513         not being INT_MAX.
2514         (get_date): Initialize dsts_seen, and check that it doesn't go over 1.
2515         Use pc_rels_seen to decide whther a date is absolute.
2516
2517         * getdate.y (number): Don't overwrite year.
2518         (get_date): Initialize pc.year.digits to 0, not 4, to enable above
2519         check.
2520
2521 2005-04-02  Simon Josefsson  <jas@extundo.com>
2522
2523         * getaddrinfo.h: Fix OpenBSD compilation failure, inspired by tiny
2524         patch from Yoann Vandoorselaere <yoann@prelude-ids.org>.
2525
2526 2005-03-27  Jim Meyering  <jim@meyering.net>
2527
2528         * argmatch.c: Clarify comment: null-terminated -> NULL-terminated.
2529
2530 2005-03-26  Paul Eggert  <eggert@cs.ucla.edu>
2531
2532         * intprops.h (INT_STRLEN_BOUND, INT_BUFSIZE_BOUND):
2533         "one's complement" -> "ones' complement" in comment, as per Knuth.
2534         "value of type" -> "type or expression" in comment.
2535         * mktime.c, strftime.c: Propagate intprops.h comment nits.
2536
2537 2005-03-26  Jim Meyering  <jim@meyering.net>
2538
2539         Comment nits.
2540         * intprops.h: Add the apostrophe in `(one|two)'s complement'.
2541         Correct typos: s/or/of/.
2542
2543 2005-03-23  Jim Meyering  <jim@meyering.net>
2544
2545         * canonicalize.c: Remove duplicate `#include "stat-macros.h"'.
2546
2547 2005-03-21  Jim Meyering  <jim@meyering.net>
2548
2549         Changes imported from coreutils.
2550
2551         * cycle-check.c: Don't include xalloc.h.
2552
2553         * path-concat.c: Don't include assert.h.
2554         (path_concat): Remove assertion that would have triggered
2555         for ABASE starting with more than one slash.
2556         Reported by Andreas Schwab.
2557
2558         * path-concat.c (path_concat): Set *BASE_IN_RESULT
2559         properly when ABASE is an absolute file name.
2560         Correct the description of this function.
2561         Include <assert.h>.
2562         Add an assertion and a test driver.
2563         This fixes a bug introduced on 2004-07-02.
2564         Andreas Schwab reported the resulting failure of cp --parents:
2565         http://lists.gnu.org/archive/html/bug-coreutils/2005-01/msg00130.html
2566
2567 2005-03-18  Paul Eggert  <eggert@cs.ucla.edu>
2568
2569         * strftime.c (my_strftime): If the underlying strftime returns 0
2570         (which shouldn't happen), generate nothing instead of returning 0
2571         immediately, so that nstrftime (NULL, ...) doesn't return 0.
2572
2573 2005-03-16  Bruno Haible  <bruno@clisp.org>
2574
2575         * stdint_.h: Use HAVE_LONG_LONG_64BIT instead of HAVE_LONGLONG_64BIT.
2576
2577 2005-03-15  Paul Eggert  <eggert@cs.ucla.edu>
2578
2579         * strftime.c (my_strftime): Prepend space to format so that we can
2580         reliably distinguish strftime failure from empty output on POSIX
2581         hosts.
2582
2583 2005-03-08  Paul Eggert  <eggert@cs.ucla.edu>
2584
2585         * iconvme.c (SIZE_MAX): New macro, if not already defined.
2586         (iconv_string): Don't guess a size-zero buffer, as that might cause
2587         buffer overrun.  Instead, avoid multiplying by MB_LEN_MAX if the
2588         result would be 'too large', where 'too large' is (heuristically)
2589         the square root of SIZE_MAX, divided by MB_LEN_MAX to allay
2590         overflow concerns.  This will prevent some unwanted malloc failures
2591         when the inputs are very large.
2592
2593 2005-03-15  Bruno Haible  <bruno@clisp.org>
2594
2595         * regex.c (byte_re_match_2_internal): Rename local variable 'not' to
2596         'negate'.
2597
2598         * regex.c (byte_re_match_2_internal): Reduce scope of same_str_p
2599         variable.
2600
2601         * regex.c (EXTEND_BUFFER, regcomp): Cast the realloc/malloc results.
2602
2603 2005-03-14  Paul Eggert  <eggert@cs.ucla.edu>
2604
2605         * mktime.c (TYPE_TWOS_COMPLEMENT, TYPE_ONES_COMPLEMENT,
2606         TYPE_SIGNED_MAGNITUDE, TYPE_MINIMUM, TYPE_MAXIMUM): Sync from
2607         intprops.h.
2608         * strtol.c: Likewise.
2609
2610 2005-03-14  Simon Josefsson  <jas@extundo.com>
2611
2612         * timegm.h: Use proper prototype CPP guards, reported by Dave Love
2613         <fx@gnu.org>.
2614
2615 2005-03-14  Jim Meyering  <jim@meyering.net>
2616
2617         * strftime.c (my_strftime) [HAVE_STRFTIME && ! (_NL_CURRENT
2618         && HAVE_STRUCT_ERA_ENTRY)]: Initialize the first byte of ubuf[]
2619         to be nonzero so that we (and caller) can detect the difference
2620         between a valid zero-length expansion and an error return, even
2621         when the underlying strftime fails before writing anything into
2622         that location.
2623
2624 2005-03-10  Jim Meyering  <jim@meyering.net>
2625
2626         * save-cwd.c [!HAVE_FCHDIR]: Define open, fchdir, and chdir_long
2627         so that this module works on systems without fchdir.
2628
2629 2005-03-09  Paul Eggert  <eggert@cs.ucla.edu>
2630
2631         Factor int-properties macros into a single file, except for
2632         glibc-related files.
2633         * intprops.h: New file.
2634         * getloadavg.c: Include it instead of limits.h.
2635         (INT_STRLEN_BOUND): Remove.
2636         * human.c: Include intprops.h.
2637         (group_number): Use INT_STRLEN_BOUND instead of rolling it ourself.
2638         * human.h (LONGEST_HUMAN_READABLE): Use 146/485 rather than 302/1000.
2639         * inttostr.h: Include intprops.h instead of limits.h.
2640         (INT_STRLEN_BOUND, INT_BUFSIZE_BOUND): Remove.
2641         * mktime.c (TYPE_IS_INTEGER, TYPE_TWOS_COMPLEMENT): New macros,
2642         for consistency with intprops.h.
2643         (time_t_is_integer, twos_complement_arithmetic): Use them.
2644         * sig2str.h: Include <signal.h>, intprops.h.
2645         (INT_STRLEN_BOUND): Remove.
2646         * strftime.c (TYPE_SIGNED): Remove.
2647         (INT_STRLEN_BOUND): Switch to same implementation as intprops.h.
2648         * strtol.c: Adjust comments to match intprops.h.
2649         * userspec.c: Include intprops.h.
2650         (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM): Remove.
2651         * utimecmp.c, xnanosleep.c, xstrtol.c: Likewise.
2652         * utimecmp.c (utimecmp): Use TYPE_IS_INTEGER, TYPE_TWOS_COMPLEMENT
2653         instead of rolling our own expressions.
2654         * xstrtol.c: Include xstrtol.h first, to test interface.
2655
2656         * strftime.c: Include <stdbool.h>.  Use bool where appropriate,
2657         instead of int.
2658         (my_strftime): Do not mishandle years close to INT_MAX, by doing
2659         the right thing even if adding 1900 would overflow.  Similarly
2660         for tm_mon + 1 and tm_yday + 1.
2661         Make %Y always equivalent to %C%y, and similarly for %G and %g.
2662         (DO_NUMBER, DO_NUMBER_SPACEPAD): Set digits to d, not a conditional.
2663         (DO_SIGNED_NUMBER): New macro.
2664         (my_strftime) [HAVE_TZNAME]: Don't dump core if tp->tm_dst > 1.
2665
2666 2005-03-07  Bruno Haible  <bruno@clisp.org>
2667
2668         * pagealign_alloc.c (MAP_FILE, MAP_FAILED): Define fallbacks.
2669
2670 2005-03-03  Derek R. Price  <derek@ximbiot.com>
2671             Bruno Haible  <bruno@clisp.org>
2672
2673         * pagealign_alloc.h: New file.
2674         * pagealign_alloc.c: New file.
2675
2676 2005-01-28  Bruno Haible  <bruno@clisp.org>
2677
2678         * stpncpy.h (stpncpy): Define as a macro without arguments, so that
2679         stpncpy.c uses it.
2680
2681 2005-03-01  Paul Eggert  <eggert@cs.ucla.edu>
2682
2683         Remove workaround for bug in Linux kernel 2.6.8 or thereabouts.
2684         The workaround isn't strictly needed for POSIX conformance, and
2685         it's too much of a pain to configure and maintain.  We'll ask
2686         people to fix their kernels instead.
2687         * xnanosleep.c: Don't include gethrxtime.h or xtime.h.
2688         (NANOSLEEP_BUG_WORKAROUND): Remove.
2689         (xnanosleep): Remove the workaround.
2690
2691 2005-02-12  Bruno Haible  <bruno@clisp.org>
2692
2693         * vasnprintf.c (EOVERFLOW): Define to a fallback if needed.
2694
2695 2005-02-25  Paul Eggert  <eggert@cs.ucla.edu>
2696
2697         * gethrxtime.h, gethrxtime.c, xtime.h: New files.
2698         * timespec.h (gettime): Return void, since it always
2699         succeeds now.  All uses changed.
2700         * gettime.c (gettime) Likewise.
2701         [HAVE_NANOTIME]: Prefer nanotime.
2702         Assume gettimeofday succeeds, as POSIX requires.
2703         Assime time () succeeds, since other code already does.
2704         * xnanosleep.c: Include xtime.h and gethrxtime.h, not xalloc.h.
2705         (timespec_subtract): Remove.
2706         (NANOSLEEP_BUG_WORKAROUND): New constant.
2707         (xnanosleep): Use gethrxtime rather than gettime; this simplifies
2708         things considerably.  Use it only on GNU/Linux hosts, since the
2709         workaround shouldn't be needed elsewhere.
2710
2711 2005-02-24  Bruno Haible  <bruno@clisp.org>
2712
2713         * gettext.h: Update from GNU gettext 0.14.2.
2714
2715 2005-02-24  Bruno Haible  <bruno@clisp.org>
2716
2717         * localcharset.c: Update from GNU gettext 0.14.2.
2718         * config.charset: Update from GNU gettext 0.14.2.
2719
2720 2005-02-22  Simon Josefsson  <jas@extundo.com>
2721
2722         * iconvme.h, iconvme.c: New files, from libc.
2723
2724 2005-02-20  Neil Conway  <neilc@samurai.com>
2725
2726         * xgethostname.c (xgethostname): Check for ENOMEM, which is
2727         returned by OSX/Darwin if the specified buffer is not large
2728         enough for the hostname.
2729
2730 2005-02-03  Paul Eggert  <eggert@cs.ucla.edu>
2731
2732         * memrchr.h: New file.
2733         * chdir-long.c: Include it.
2734         * memrchr.c [!defined _LIBC]: Include it rather than <string.h>
2735         Don't bother including stddef.h.
2736
2737 2005-02-03  Sergey Poznyakoff  <gray@Mirddin.farlep.net>
2738
2739         * argp-help.c (__argp_help): Create a fake struct argp_state and
2740         pass it to _help, otherwise the latter coredumps trying to
2741         dereference state.root_argp.
2742
2743 2005-02-01  Paul Eggert  <eggert@cs.ucla.edu>
2744
2745         * mountlist.h (MOUNTLIST_H_): New macro, to protect against double
2746         inclusion.
2747         Include <sys/types.h>, for dev_t.
2748         (ME_DUMMY, ME_REMOTE): Move from here....
2749         * mountlist.c (ME_DUMMY, ME_REMOTE): To here.
2750         (ME_DUMMY): Count "subfs" as a dummy.  Problem reported by
2751         Dmitry V. Levin.
2752         Include mountlist.h first, to test the interface.
2753
2754 2005-01-29  Bruno Haible  <bruno@clisp.org>
2755
2756         * progname.c (program_name): Initialize.
2757         Needed when linking statically on MacOS X.
2758
2759 2005-01-28  Bruno Haible  <bruno@clisp.org>
2760
2761         * javacomp.sh.in: New file, from GNU gettext.
2762         * javacomp.h: New file, from GNU gettext.
2763         * javacomp.c: New file, from GNU gettext.
2764
2765 2005-01-26  Bruno Haible  <bruno@clisp.org>
2766
2767         * javaexec.sh.in: New file, from GNU gettext.
2768         * javaexec.h: New file, from GNU gettext.
2769         * javaexec.c: New file, from GNU gettext.
2770
2771 2005-01-26  Simon Josefsson  <jas@extundo.com>
2772
2773         * gai_strerror.c: Use GPL in header.
2774
2775 2005-01-24  Sergey Poznyakoff  <gray@Mirddin.farlep.net>
2776
2777         * argp-help.c (hol_entry_help): Avoid using non-constant
2778         initializers for struct pentry_state.
2779         (__argp_error): Check return value of __asprintf
2780         (__argp_failure): Translate error message
2781
2782         * argp-parse.c: Removed braces around the expansion of N_()
2783
2784 2005-01-21  Jim Meyering  <jim@meyering.net>
2785
2786         * openat.h (AT_SYMLINK_NOFOLLOW): Define to 4096, so it's the
2787         same value as for Solaris 9.
2788
2789         * chdir-long.c (chdir_long): Rewrite to remove limitation on
2790         component length.  This included changing the parameter to be
2791         of type `char *' rather than `char const *'.
2792         * chdir-long.h (chdir_long): Update prototype.
2793
2794         * openat.c (fdopendir, fstatat): New functions.
2795         * openat.h: Include headers required for use of DIR and struct stat.
2796         [AT_SYMLINK_NOFOLLOW]: Define.
2797         (fdopendir, fstatat): Add prototypes.
2798
2799 2005-01-21  Bruno Haible  <bruno@clisp.org>
2800
2801         * classpath.h: New file, from GNU gettext.
2802         * classpath.c: New file, from GNU gettext.
2803
2804 2005-01-20  Simon Josefsson  <jas@extundo.com>
2805
2806         * version-etc-fsf.c: New file, with version_etc_copyright.
2807         * version-etc.c: Remove version_etc_copyright.
2808         * version-etc.h (version_etc_copyright): Use [] instead of * in
2809         prototype, suggested by Paul Eggert <eggert@CS.UCLA.EDU>.
2810
2811 2005-01-20  Paul Eggert  <eggert@cs.ucla.edu>
2812
2813         * save-cwd.c (save_cwd): Remove code to support the case
2814         where fchdir is missing or flaky.
2815
2816 2005-01-20  Simon Josefsson  <jas@extundo.com>
2817
2818         * base64.h (isbase64): Add.
2819
2820         * base64.c (isb64): Rename to isbase64, use to_uchar instead of
2821         using a unsigned prototype, don't inline.
2822         (base64_decode): Use it.
2823
2824 2005-01-19  Bruno Haible  <bruno@clisp.org>
2825
2826         * sh-quote.h: New file, from GNU gettext.
2827         * sh-quote.c: New file, from GNU gettext.
2828
2829 2005-01-18  Paul Eggert  <eggert@cs.ucla.edu>
2830
2831         Merge changes from coreutils, as described below in several
2832         changelogs dated today.
2833
2834         * save-cwd.c: Include "save-cwd.h" before other include files.
2835         (O_DIRECTORY): Remove; not needed here, since "." must be
2836         a directory.  All uses removed.
2837         (save_cwd): Use __sgi || __sun, not sun || __sun.  __sun is
2838         universal on Suns, and we also need to test for IRIX.
2839         Revamp code to use 'if' rather than '#if'.
2840         Avoid unnecessary comparison of cwd->desc to 0.
2841
2842         * utimens.c (futimens): Robustify the previous patch, by checking
2843         for known valid error numbers rather than observed invalid ones.
2844
2845 2005-01-18  Jim Meyering  <jim@meyering.net>
2846
2847         * version-etc.c (version_etc_copyright): Update copyright date.
2848
2849         * utimens.c (futimens): Account for the fact that futimes
2850         can also fail with errno == ENOSYS or errno == ENOENT.
2851         Patch from Dmitry V. Levin.
2852
2853         Change the name of the robust chdir function from chdir to chdir_long.
2854         * save-cwd.c: Include chdir-long.h rather than chdir.h.
2855         (restore_cwd): Use chdir_long, not chdir.
2856         * chdir-long.c: Renamed from chdir.c.
2857         * chdir-long.h: Renamed from chdir.h.
2858         [!defined PATH_MAX]: Define chdir_long to chdir on systems like the
2859         Hurd.
2860
2861 2005-01-18  Bob Proulx  <bob@proulx.com>
2862
2863         * obstack.c [DEFAULT_ALIGNMENT]: Use an intermediate type to simplify
2864         offsetof() macro construct to avoid compile failure with native HP-UX
2865         11.0 ANSI C compiler.
2866
2867 2005-01-06  Bruno Haible  <bruno@clisp.org>
2868
2869         * stpncpy.c: Remove HAVE_STPNCPY and gnu_stpncpy renaming, redundant
2870         because stpncpy.m4 takes care of it.
2871
2872 2004-01-24  Bruno Haible  <bruno@clisp.org>
2873
2874         * progreloc.c (xstrdup): Define as strdup if no xmalloc should be used.
2875
2876 2003-10-09  Bruno Haible  <bruno@clisp.org>
2877
2878         * progreloc.c: Include xalloc.h instead of xmalloc.h.
2879
2880 2005-01-06  Bruno Haible  <bruno@clisp.org>
2881
2882         * fwriteerror.h (fwriteerror): Change specification to include fclose.
2883         * fwriteerror.c: Include <stdbool.h>.
2884         (fwriteerror): At the end, close the file stream. Record whether
2885         stdout was already closed.
2886
2887 2004-05-27  Bruno Haible  <bruno@clisp.org>
2888
2889         * execute.c (environ): Declare if needed.
2890         * pipe.c (environ): Likewise.
2891         Reported by Michael Schloh von Bennewitz <michael.schloh@cw.com>.
2892
2893 2005-01-04  Paul Eggert  <eggert@cs.ucla.edu>
2894
2895         * human.c (SIZE_MAX, UINTMAX_MAX): Move these conditional
2896         definitions to be after all include files, to avoid collisions.
2897         Problem reported by Bob Proulx.
2898
2899 2004-12-28  Paul Eggert  <eggert@cs.ucla.edu>
2900
2901         * error.c [!_LIBC && !ENABLE_NLS]: Do not include "gettext.h";
2902         not needed.  This removes a dependency on the gettext module.
2903         [defined _LIBC]: Do not include <libintl.h>; not needed.
2904
2905 2004-12-24  Paul Eggert  <eggert@cs.ucla.edu>
2906
2907         * c-strtod.c (STRTOD): Depend on HAVE_C99_STRTOLD, not
2908         HAVE_DECL_STRTOLD.
2909
2910 2004-12-23  Paul Eggert  <eggert@cs.ucla.edu>
2911
2912         * argp-parse.c: Include <stddef.h>.
2913         (alignof, alignto): New macros.
2914         (parser_init): Don't assume that void * is aligned sufficiently
2915         for struct option.
2916
2917         * getdate.y (YYSTACK_USE_ALLOCA): Define to 0, since there's no
2918         need to extend the stack.
2919         (YYINITDEPTH): New macro, so that the initial stack isn't overly
2920         large.
2921
2922 2004-12-22  Sergey Poznyakoff  <gray@Mirddin.farlep.net>
2923
2924         * argp-parse.c (parser_init): Avoid arithmetics on void pointers.
2925
2926 2004-12-19  Paul Eggert  <eggert@cs.ucla.edu>
2927
2928         * alloca_.h: Conditionalize on _GNULIB_ALLOCA_H, not _ALLOCA_H.
2929         Remove now-obsolete comment about AIX.
2930         * getdate.y: Include <alloca.h> only if HAVE_ALLOCA.
2931         (YYSTACK_USE_ALLOCA): Define to 0 if !HAVE_ALLOCA.
2932         (YYMAXDEPTH): New macro.
2933
2934 2004-12-18  Bruno Haible  <bruno@clisp.org>
2935
2936         * fatal-signal.c (fatal_signals): Make non-const.
2937         (init_fatal_signals): New function.
2938         (uninstall_handlers, install_handlers): Ignore signals that were set to
2939         SIG_IGN.
2940         (at_fatal_signal): Call init_fatal_signals.
2941         (init_fatal_signal_set): Likewise. Ignore signals that were set to
2942         SIG_IGN.
2943         Reported by Paul Eggert.
2944
2945 2004-12-08  Paul Eggert  <eggert@cs.ucla.edu>
2946
2947         * getdate.y (textint): New member "negative".
2948         (time_zone_hhmm): New function.
2949         Expect 14 shift-reduce conflicts, not 13.
2950         (o_colon_minutes): New rule.
2951         (time, zone): Use it to add support for +HH:MM, UTC+HH:MM.
2952         (yylex): Set the "negative" member of signed numbers.
2953
2954 2004-12-04  Paul Eggert  <eggert@cs.ucla.edu>
2955
2956         Changes imported from coreutils.
2957         * hard-locale.c: Assume <locale.h> exists.
2958         Include "strdup.h".
2959         (GLIBC_VERSION): New macro.
2960         (hard_locale): Assume setlocale exists.
2961         Rewrite to avoid #ifdef.
2962         Use strdup rather than malloc + strcpy.
2963         * human.c: Assume <locale.h> exists.
2964         (human_readable): Assume localeconv exists.
2965
2966 2004-12-01  Jakub Jelinek  <jakub@redhat.com>
2967
2968         * mktime.c (__mktime_internal): If SEC_REQUESTED != SEC,
2969         convert T2, not T.  (Imported from libc.)
2970
2971 2004-11-30  Paul Eggert  <eggert@cs.ucla.edu>
2972
2973         * getcwd.c (is_ENAMETOOLONG): New macro.
2974         (__getcwd.c): Don't restore errno; glibc doesn't.
2975         [HAVE_PARTLY_WORKING_GETCWD && !defined AT_FDCWD]: Try system getcwd
2976         first, falling back to our code only if its results look suspicious.
2977         Ensure that the resulting buffer is only as large as necessary.
2978
2979         * readutmp.c: Include readutmp.h first.
2980         Include <errno.h>, since readutmp.h no longer does that.
2981         * readutmp.h: Don't include <errno.h>,
2982         <sys/param.h>, <time.h>; not needed to establish interface.
2983         (errno): Remove decl.
2984         (HAVE_STRUCT_XTMP_UT_TYPE): Remove; no longer needed.
2985         (UT_TYPE_EQ, UT_TYPE_NOT_DEFINED, UT_TYPE_BOOT_TIME,
2986         UT_TYPE_USER_PROCESS, IS_USER_PROCESS): New macros.
2987
2988 2004-11-28  Simon Josefsson  <jas@extundo.com>
2989
2990         * base64.h, base64.c: New file.
2991
2992 2004-11-27  Paul Eggert  <eggert@cs.ucla.edu>
2993
2994         * getcwd.h: New file, which I forgot to check in on 2004-11-25.
2995
2996 2004-11-25  Paul Eggert  <eggert@cs.ucla.edu>
2997
2998         Fix problems reported by Scott S. Tinsley for HP-UX 11.11 using
2999         HP's ANSI C compiler.
3000         * fsusage.c (statvfs) [HAVE_SYS_STATVFS_H]: Remove decl.
3001         Declaring int functions causes warnings on some modern systems and
3002         shouldn't be needed to compile on ancient ones.
3003         * same.c (MIN) [defined MIN]: Don't define, since it's already
3004         defined.
3005
3006         * getcwd.c: Replace by a copy of glibc/sysdeps/posix/getcwd.c, but
3007         with the following changes.
3008         (__set_errno): Parenthesize properly.
3009         Include <stdbool.h>.
3010         (MIN, MAX, MATCHING_INO): New macros.
3011         (__getcwd): Define with prototype, not K&R form.
3012         Use heuristics to allocate default buffer on stack if possible.
3013         If AT_FDCWD is defined, use openat and fstatat to avoid O(N**2)
3014         behavior, and to avoid the PATH_MAX limit when computing
3015         ../../../../...
3016         Use MATCHING_INO to compare inode number to file.
3017         Check for arithmetic overflow in size calculations.
3018         Fix bug in reallocation of dot array that caused getcwd to fail
3019         on directories nested deeper than 75.
3020         Be more careful about saving errno on error.
3021         Do not use realloc; use only free+malloc, as this is a bit
3022         more flexible and avoids a needless copy operation.
3023         Do not inspect st_dev and st_ino for symbolic links; POSIX
3024         doesn't specify the latter.
3025         Check for closedir errors.
3026         Avoid needless casts.
3027         Use "#ifdef weak_alias" around weak_alias, to be like other
3028         glibc code.
3029         The following changes to getcwd.c have effect only when used in
3030         gnulib; they have no effect inside glibc proper.
3031         (#pragma alloca) [defined _AIX && !defined __GNUC__]: Remove,
3032         as alloca isn't used.
3033         (alloca, __alloca): Likewise.
3034         [!_LIBC]: Include "getcwd.h", "mempcpy.h".
3035         Include <stddef.h>, <stdlib.h>, <string.h>, <limits.h>
3036         unconditionally, as gnulib assumes C89 or better.
3037         Do not include <sys/param.h>.
3038         (errno) [!defined __GNU_LIBRARY__ && !defined STDC_HEADERS]: Remove
3039         no-longer-necessary 'extern int errno' decl; gnulib assumes C89 or
3040         better.
3041         (NULL) [!defined NULL]: Remove; we assume C89 or better.
3042         Include <dirent.h> in a way that is compatible with modern Autoconf.
3043         (_D_ALLOC_NAMELEN, _D_EXACT_NAMLEN):
3044         New macros, if not already defined.
3045         Include <unistd.h> if _LIBC, not if __GNU_LIBRARY__.
3046         Use "_LIBC", not "defined _LIBC", for consistency.
3047         (HAVE_MEMPCPY): Remove; no longer needed now that gnulib has
3048         a mempcpy module.
3049         (__lstat, __closedir, __opendir, __readdir) [!_LIBC]: New macros.
3050         (GETCWD_RETURN_TYPE): Remove.  All uses replaced by char *.
3051         * xgetcwd.c: David MacKenzie's old code was removed, so give
3052         credit only to Jim Meyering and adjust the copyright dates.
3053         Do not include <limits.h>, <stdio.h>, <sys/types.h>,
3054         <stdlib.h>, <unistd.h>, "pathmax.h".
3055         Instead, include "xgetcwd.h" (first) and "getcwd.h".
3056         (INITIAL_BUFFER_SIZE): Remove.
3057         (xgetcwd): Rely on getcwd, since we now depend on a reliable one.
3058
3059 2004-11-23  Jim Meyering  <jim@meyering.net>
3060
3061         * getopt_.h: Remove trailing blanks.
3062
3063 2004-11-23  Paul Eggert  <eggert@cs.ucla.edu>
3064
3065         * utimens.c (__attribute__, ATTRIBUTE_UNUSED): New macros.
3066         (futimens): New function, which uses futimes if available.
3067         (futimens, utimens): Support timespec==NULL, with same semantics
3068         as utime and utimens.
3069         * utimens.h (futimens): New decl.
3070
3071 2004-11-23  Jim Meyering  <jim@meyering.net>
3072
3073         * __fpending.c: Add comment.
3074
3075 2004-11-23  Sergey Poznyakoff  <gray@Mirddin.farlep.net>
3076
3077         * getopt_.h: Re-addition of __getopt_argv_const caused
3078         redefinition warnings. To avoid them, include the defines
3079         in `#if !defined __need_getopt ... #endif'. The only place
3080         where __getopt_argv_const is used is in definitions
3081         of getopt_long and getopt_long_only below, which are as well
3082         protected by `#ifndef __need_getopt'.
3083         [defined __GETOPT_PREFIX && !defined __need_getopt]: Undef
3084         __need_getopt after including <stdio.h> and <unistd.h> These
3085         headers might have defined it.
3086
3087 2004-11-20  Paul Eggert  <eggert@cs.ucla.edu>
3088
3089         * getopt_.h (__GETOPT_CONCAT, __GETOPT_XCONCAT, __GETOPT_ID):
3090         New macros.
3091         (getopt, getopt_long, getopt_long_only, optarg, opterr, optind,
3092         optopt): Use them instead of invoking ## directly; otherwise, the
3093         symbols will be __GETOPT_PREFIXgetopt rather than rpl_getopt.
3094
3095 2004-11-19  Bruno Haible  <bruno@clisp.org>
3096
3097         * strtok_r.c: Move comments from here...
3098         * strtok_r.h: ... to here.
3099
3100 2004-11-17  Paul Eggert  <eggert@cs.ucla.edu>
3101
3102         * realloc.c (rpl_realloc): Call 'free' if n==0, since realloc
3103         might fail.  Problem reported by Yoann Vandoorselaere.
3104         * calloc.c (rpl_calloc): Defend against buggy calloc implementations
3105         that mishandle size_t overflow.
3106
3107 2004-11-16  Paul Eggert  <eggert@cs.ucla.edu>
3108
3109         * canon-host.c: Include "strdup.h".
3110         (canon_host): Use getaddrinfo if available, so that IPv6 works.
3111         Use strdup instead of malloc/strcpy to duplicate strings.
3112
3113         * human.h (LONGEST_HUMAN_READABLE): Add 1 for space before unit.
3114         (human_space_before_unit): New constant.
3115         * human.c (human_readable): Support it.
3116
3117         * xgetcwd.c: Include <limits.h>, for PATH_MAX.
3118         (xgetcwd): Set errno correctly when failing.
3119         Work around Solaris 9 bug: getcwd sets errno==ERANGE even though
3120         the failure is actually due to a PATH_MAX problem.
3121
3122         Further getopt changes to make it more likely that glibc will
3123         buy the changes back.
3124         * getopt.c (POSIXLY_CORRECT): New constant.
3125         (getopt): Use it, so to preserve glibc semantic
3126         * getopt1.c (getopt_long, getopt_long_only): Arg is char * const *
3127         when compiling for libc.
3128         * getopt_.h (__getopt_argv_const): Bring it back.
3129         (getopt_long, getopt_long_only): Use it.
3130
3131         * getopt.c (_getopt_initialize, _getopt_internal_r, _getopt_internal):
3132         New arg POSIXLY_CORRECT.  All callers changed.
3133         (getopt): Argv is now char * const *, as per standard.
3134         (_getopt_internal_r, _getopt_internal): Argv is now char **,
3135         not char *__getopt_argv_const *.
3136         * getopt1.c (getopt_long, _getopt_long_r, getopt_long_only,
3137         _getopt_long_only_r): Likewise.
3138         * getopt_.h (getopt, getopt_long, geopt_long_only): Likewise.
3139         * getopt_int.h (_getopt_internal, _getopt_internal_r,
3140         _getopt_long_r, _getopt_long_only_r): Likewise.
3141         * getopt_.h (__getopt_argv_const): Remove.
3142         (getopt): Argv is now char * const *, as per standard.
3143
3144         * getdate.y (tORDINAL): New token.
3145         (day, relunit): Allow it for relative times.
3146         (relative_time_table): Use tORDINAL for ordinals.
3147
3148 2004-11-15  Jim Meyering  <jim@meyering.net>
3149
3150         * closeout.c: Include "__fpending.h" once again.
3151         Include <stdbool.h>.
3152         (close_stdout): Don't fail just because stdout was closed initially,
3153         since some programs don't write to stdout in the normal course of
3154         operation (other than --version and --help), and we don't want this
3155         function to make e.g. `touch file >&-' fail.
3156         But do fail if it was closed and someone has tried to write to it.
3157         E.g., `printf foo >&-' must fail.
3158
3159 2004-11-11  Simon Josefsson  <jas@extundo.com>
3160
3161         * strtok_r.h, strtok_r.c: New file.
3162
3163 2004-11-11  Paul Eggert  <eggert@cs.ucla.edu>
3164
3165         * getopt_.h (__getopt_argv_const): New macro, to be used so that
3166         we can stop lying to compilers about the constness of argv when we
3167         are compiled outside glibc.
3168         (getopt, getopt_long, getopt_long_only): Use it.
3169         * getopt.c (_getopt_initialize, _getopt_internal_r, _getopt_internal,
3170         getopt): Likewise.
3171         * getopt1.c (getopt_long, _getopt_long_r, getopt_long_only,
3172         _getopt_long_only_r): Likewise.
3173         * getopt_int.h (_getopt_internal, _getopt_internal_r, _getopt_long_r,
3174         _getopt_long_only_r): Likewise.
3175
3176         * getopt_.h [defined __GETOPT_PREFIX && !defined __need_getopt]:
3177         Include <stdlib.h> and <stdio.h>, and <unistd.h> if available.
3178         Then rename getopt to __GETOPT_PREFIX##getopt, and so forth for
3179         the other external symbols.
3180         (getopt) [!defined __GNU_LIBRARY]: Use prototype, not old-style
3181         declaration, since the above renaming now works around collisions.
3182
3183 2004-11-11  Jim Meyering  <jim@meyering.net>
3184
3185         * linebreak.c: Remove trailing blanks.
3186         * alloca_.h: Likewise.
3187         * acosl.c: Likewise.
3188         * euidaccess.c: Likewise.
3189         * allocsa.h: Likewise.
3190
3191 2004-11-10  Paul Eggert  <eggert@cs.ucla.edu>
3192
3193         * mktime.c (SHR): New macro, which is a portable
3194         substitute for >> that should work even on Crays.
3195         (TIME_T_MIDPOINT, ydhms_diff, __mktime_internal): Use it.
3196         Problem reported by Mark D. Baushke in
3197         <http://lists.gnu.org/archive/html/bug-gnulib/2004-11/msg00071.html>.
3198         * getdate.y (SHR): Likewise.
3199         (tm_diff): Use it.
3200         * strftime.c (SHR): Likewise.
3201         (tm_diff): Use it.
3202         * quotearg.c (struct quoting_options): Use unsigned int for
3203         quote_these_too, so that right shifts are well defined.  All uses
3204         changed.
3205
3206 2004-11-10  Simon Josefsson  <jas@extundo.com>
3207
3208         * getaddrinfo.h, getaddrinfo.c: New files.
3209
3210 2004-11-10  Jim Meyering  <jim@meyering.net>
3211
3212         Ensure that no close failure goes unreported.
3213         * closeout.c (close_stdout): Always close stdout.  I.e., don't
3214         return early when it seems there's nothing to flush.
3215         Don't include __fpending.h.
3216
3217 2004-11-09  Paul Eggert  <eggert@cs.ucla.edu>
3218
3219         * strftime.c (DO_MULTIBYTE): Check for wchar.h, too.
3220
3221 2004-11-05  Bruno Haible  <bruno@clisp.org>
3222
3223         * readlink.c: Include stddef.h, needed for size_t on Woe32.
3224         Reported by Mark D. Baushke <mdb@cvshome.org>.
3225
3226 2004-11-04  Bruno Haible  <bruno@clisp.org>
3227
3228         2004-09-11  Bruno Haible  <bruno@clisp.org>
3229                 * allocsa.valgrind: New file.
3230         2004-02-06  Bruno Haible  <bruno@clisp.org>
3231                 * allocsa.h (sa_alignof): Define differently with HP-UX cc, to
3232                 avoid a bug of this cc on HP-UX 10.20 dealing with enums.
3233                 Reported by Christopher Seip <chris.seip@hp.com>.
3234
3235 2004-11-03  Paul Eggert  <eggert@cs.ucla.edu>
3236
3237         * xreadlink.c (xreadlink): AIX and HP-UX readlink return -1
3238         with errno == ERANGE if the buffer is too small.
3239         Problem reported by Mark D. Baushke.
3240
3241 2004-11-02  Paul Eggert  <eggert@cs.ucla.edu>
3242
3243         * xreadlink.c (MAXSIZE): New macro.
3244         (xreadlink): Use it instead of SSIZE_MAX.  Ensure initial buffer
3245         size does not exceed MAXSIZE.  Avoid cast.
3246         As suggested by Mark D. Baushke in
3247         <http://lists.gnu.org/archive/html/bug-gnulib/2004-11/msg00009.html>,
3248         if readlink fails with buffer size just under MAXSIZE, try again
3249         with MAXSIZE.
3250
3251 2004-11-02  Derek R. Price  <derek@ximbiot.com>
3252         and  Paul Eggert  <eggert@cs.ucla.edu>
3253
3254         * getdate.y [!TEST]: Include <stdio.h>, since we use sprintf now.
3255         (get_date): Overparenthesize to avoid GCC warning.
3256
3257 2004-11-02  Bruno Haible  <bruno@clisp.org>
3258
3259         * setenv.h (unsetenv): Define as a macro if the system's unsetenv()
3260         function returns void.
3261
3262 2004-11-01  Paul Eggert  <eggert@cs.ucla.edu>
3263
3264         * getpass.c (fflush_unlocked, flockfile, funlockfile)
3265         (funlockfile, fputs_unlocked, putc_unlocked): Don't define if
3266         already declared.
3267
3268 2004-10-29  Paul Eggert  <eggert@cs.ucla.edu>
3269
3270         * getdate.y: Add support for TZ="foo" within a date string.
3271         Fix some bugs near time_t boundaries.  Reject dates with
3272         out-of-range components, e.g., "Sept 31".
3273         Include <stdlib.h>, "setenv.h", "xalloc.h".
3274         (ISDIGIT_LOCALE): Remove; unused.
3275         Note that the TZ and time functions used here are not reentrant.
3276         (mktime_ok, get_tz): New functions.
3277         (TZBUFSIZE): New constant.
3278         (get_date): Parse leading TZ="foo".  Reject out-of-range components;.
3279         This requires that we sometimes generate our own TZ="XXX..." setting.
3280
3281 2004-10-27  Derek R. Price  <derek@ximbiot.com>
3282
3283         * mktime.c (not_equal_tm): Remove redundant check.
3284
3285 2004-10-24  Paul Eggert  <eggert@cs.ucla.edu>
3286
3287         * getdate.y: Use Bison 1.875 features, and some minor
3288         code cleanups.  This change does not affect semantics.
3289         Don't include <stdlib.h>; no longer needed.
3290         Don't include unlocked-io.h; only the "#if TEST" code uses
3291         stdio, and performance isn't crucial there.
3292         (PC, YYLEX_PARAM, YYPARSE_PARAM): Remove; replaced by
3293         Bison 1.875 features as described below.
3294         All uses of "PC." replaced by "pc->".
3295         (YYSTYPE): Add a forward declaration.
3296         (yylex, yyerror): Use full prototypes in forward decls.
3297         Use "%pure-parser" rather than obsolescent "%pure_parser".
3298         Use %parse-param and %lex-param instead of obsolescent
3299         YYPARSE_PARAM and YYLEX_PARAM.
3300         (meridian_table, month_and_day_table, time_units_table,
3301         relative_time_table, time_zone_table, military_table,
3302         lookup_zone, lookup_word, get_date):
3303         Use NULL instead of 0 where appropriate.
3304         (to_hour): Avoid abort (), to avoid a dependency on
3305         stdlib.h.
3306         (yyerror, yylex): Now accepts parser_control * arg.
3307         (main) [TEST]: Use '\0' rather than 0 for char.
3308
3309 2004-10-22  Paul Eggert  <eggert@cs.ucla.edu>
3310
3311         * getpagesize.c (getpagesize): Don't assume <sys/param.h> exists.
3312         It's now the caller's responsibility to handle the case where
3313         !HAVE_GETPAGESIZE && !defined getpagesize.
3314
3315         * mktime.c (leapyear): Arg is long int, not int.
3316
3317 2004-10-18  Paul Eggert  <eggert@cs.ucla.edu>
3318
3319         * argp-fs-xinl.c, argp-xinl.c: Update from glibc.
3320
3321 2004-10-12  Simon Josefsson  <jas@extundo.com>
3322
3323         * getpass.c (fflush_unlocked, flockfile, funlockfile)
3324         (fputs_unlocked, putc_unlocked) [!_LIBCS && !USE_UNLOCKED_IO]: Map
3325         to real functions.
3326
3327 2004-10-11  Yoann Vandoorselaere  <yoann@prelude-ids.org>
3328
3329         * vsnprintf.h: New file.
3330         * vsnprintf.c: New file.
3331
3332 2004-10-07  Bruno Haible  <bruno@clisp.org>
3333
3334         * snprintf.c (snprintf): Avoid a memory allocation if the result fits
3335         into the provided buffer.
3336
3337 2004-10-06  Paul Eggert  <eggert@cs.ucla.edu>
3338
3339         * diacrit.c, diacrit.h: Add GPL notice.
3340
3341         * atanl.c, logl.c: Add GPL notice, to match glibc's added LGPL notice.
3342         * atanl.c (atanl): Keep the code as similar to glibc as possible.
3343         * logl.c (logl): Keep the code as similar to glibc as possible.
3344         This avoids a potential constant-folding bug.
3345
3346 2004-10-05  Bruno Haible  <bruno@clisp.org>
3347
3348         * strsep.h: Don't declare strsep() if HAVE_STRSEP.
3349
3350 2004-10-04  Paul Eggert  <eggert@cs.ucla.edu>
3351
3352         * xalloc.h (xmemdup): Renamed from xclone.  All uses changed.
3353         * xmalloc.c (xmemdup): Likewise.
3354         * xalloc.h (CCLONE, CLONE, NEW, XCALLOC, XMALLOC, XREALLOC,
3355         XFREE): Remove these long-obsolescent macros.
3356         * xmalloc.c (xstrdup): Implementation moved here from xstrdup.c
3357         * xstrdup.c: Remove.
3358
3359         * regex.c (re_comp): Cast gettext return value to char *,
3360         Problem reported by Martin Neitzel via Mark D. Baushke.
3361
3362 2004-10-04  Simon Josefsson  <jas@extundo.com>
3363
3364         * error.c, md5.c, regex.c: Use '#if USE_UNLOCKED_IO' instead of
3365         '#ifdef USE_UNLOCKED_IO'.
3366
3367 2004-10-04  Paul Eggert  <eggert@cs.ucla.edu>
3368
3369         * argmatch.c, closeout.c, error.c, exclude.c, getdate.y,
3370         getndelim2.c, getpass.c, getusershell.c, linebuffer.c,
3371         md5.c, mountlist.c, posixtm.c, readtokens.c, readutmp.c,
3372         regex.c, sha1.c, version-etc.c, yesno.c:
3373         Include "unlocked-io.h" only if USE_UNLOCKED_IO.
3374         * unlocked-io.h: Don't worry about USE_UNLOCKED_IO; that's now
3375         the includer's responsibility.
3376
3377         Sync from coreutils.
3378
3379         * modechange.c (mode_compile): Don't decrement a pointer that
3380         points to the start of a string, as the C Standard says the
3381         resulting behavior is undefined.
3382
3383         * backupfile.h (enum backuptype): Rename none -> no_backups,
3384         simple -> simple_backups, numbered_existing ->
3385         numbered_existing_backups, numbered -> numbered_backups
3386         to avoid shadowing problems.  All uses changed.
3387         * argmatch.c (enum backuptype) [defined TEST]: Likewise.
3388         * backupfile.c (check_extension, numbered_backup):
3389         Rename locals to avoid shadowing 'basename'.
3390         * backupfile.h (VALID_BACKUP_TYPE): Don't evaluate arg more than
3391         once.
3392
3393         * .cppi-disable: Add getopt_.h, getopt_int.h.
3394         * .cvsignore: Add getopt.h.
3395
3396 2004-10-04  Simon Josefsson  <jas@extundo.com>
3397
3398         * memmem.h: New file.
3399         * memmem.c: New file, taken from glibc.
3400
3401 2004-10-02  Jim Meyering  <jim@meyering.net>
3402
3403         * dirfd.h, getpagesize.h: Add copyright notice.
3404
3405 2004-10-01  Paul Eggert  <eggert@cs.ucla.edu>
3406
3407         * snprintf.c: Remove comments as to why each header is needed.
3408
3409 2004-10-01  Yoann Vandoorselaere <yoann@prelude-ids.org>
3410
3411         * strsep.h: New file.
3412         * strsep.c: New file.
3413
3414 2004-10-01  Simon Josefsson  <jas@extundo.com>
3415
3416         * snprintf.c (snprintf): Handle size==0.
3417
3418 2004-10-01  Simon Josefsson  <jas@extundo.com>
3419             Bruno Haible  <bruno@clisp.org>
3420
3421         * snprintf.c: Include <stdarg.h>, <stdlib.h>, <string.h>.
3422         (snprintf): Declare 'args'.
3423
3424 2004-09-30  Simon Josefsson  <jas@extundo.com>
3425
3426         * snprintf.h, snprintf.c: New files.
3427
3428 2004-09-30  Sergey Poznyakoff  <gray@Mirddin.farlep.net>
3429
3430         * argp-help.c (canon_doc_option): Fixed coredump if *name==NULL
3431         (hol_entry_help): Never translate an empty string.
3432         Do not translate option tag (opt->name) if OPTION_NO_TRANS is set
3433         * argp.h (OPTION_NO_TRANS): New option.
3434
3435 2004-09-29  Oskar Liljeblad  <oskar@osk.mine.nu>
3436
3437         * xvasprintf.c: Include xalloc.h.
3438         (xvasprintf): Use xalloc_die, not xmalloc_die.
3439
3440 2004-09-28  Paul Eggert  <eggert@cs.ucla.edu>
3441
3442         * dummy.c: Change copyright notice to FSF, and license to GPL.
3443
3444 2004-09-13  Paul Eggert  <eggert@cs.ucla.edu>
3445
3446         * argp-pvh.c (argp_program_version_hook): Provide initial value.
3447         Problem reported by Bruno Haible in:
3448         http://lists.gnu.org/archive/html/bug-tar/2004-09/msg00023.html
3449
3450 2004-09-11  Paul Eggert  <eggert@cs.ucla.edu>
3451
3452         * mempcpy.h: Wrap the entire include file inside #ifndef mempcpy,
3453         in case some system header has #define'd it.  Problem reported by
3454         Soeren D. Schulze in
3455         <http://lists.gnu.org/archive/html/bug-gnulib/2004-09/msg00017.html>.
3456
3457 2004-09-08  Bruno Haible  <bruno@clisp.org>
3458
3459         * stdint_.h: New file, taken from GNU clisp.
3460
3461 2004-09-08  Oskar Liljeblad  <oskar@osk.mine.nu>
3462
3463         * xvasprintf.h: New file.
3464         * xvasprintf.c: New file.
3465         * xasprintf.c: New file.
3466
3467 2004-09-08  Bruno Haible  <bruno@clisp.org>
3468
3469         * vasnprintf.c (VASNPRINTF): Signal EOVERFLOW if the resulting length
3470         is > INT_MAX.
3471         * vasprintf.c (vasprintf): Don't test for length > INT_MAX any more.
3472
3473 2004-08-19  Paul Eggert  <eggert@cs.ucla.edu>
3474
3475         Import from coreutils.
3476         * userspec.c: Don't use <alloca.h>, so that we don't use alloca on
3477         strings on unbounded length.  alloca's performance benefits aren't
3478         that important here.
3479         (V_STRDUP): Remove.
3480         (parse_with_separator): New function, with most of the internals
3481         of the old parse_user_spec.  Allow user to omit both user and group,
3482         for compatibility with FreeBSD.
3483         Clone only the user name, not the entire spec.
3484         Do not set *uid, *gid unless entirely successful.
3485         Avoid memory leak in some failing cases.
3486         Fix regression for USER.GROUP reported by Dmitry V. Levin in
3487         <http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00102.html>
3488         (parse_user_spec): Rewrite to use parse_with_separator.
3489
3490 2004-08-12  Paul Eggert  <eggert@cs.ucla.edu>
3491
3492         * argp-help.c, argp-parse.c: Use "gettext.h" instead of
3493         its complicated substitute.
3494         * argp-help.c: Include <errno.h>, for program_invocation_short_name
3495         and program_invocation_name.
3496         (__argp_basename) [!_LIBC]: Remove; the only use was
3497         replaced by its body.
3498         (__argp_short_program_name): Change condition from
3499         !defined __argp_short_program_name to
3500         ! (defined _LIBC || HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME),
3501         to match argp-namefrob.h.
3502         (__argp_failure): Don't assume strerror_r returns char *.
3503         * argp-parse.c (N_): Define unconditionally.
3504         (argp_default_options): Fill out initializers with 0 to avoid
3505         gcc warnings.
3506
3507 2004-08-12  Simon Josefsson  <jas@extundo.com>
3508
3509         * getopt.c, getopt1.c: Remove ELIDE_CODE hack.
3510         * getopt_.h: Renamed from getopt.h.
3511
3512 2004-08-11  Paul Eggert  <eggert@cs.ucla.edu>
3513
3514         Merge from coreutils.
3515
3516         * fnmatch.c (WIDE_CHAR_SUPPORT): Don't set to 1 if missing
3517         wmemchr or wmemcpy.  Problem reported by Robert Dahlem
3518         for Reliant Unix 5.43.
3519
3520         * obstack.c: Include <inttypes.h> and <stdint.h> if available.
3521         (union fooround): Use uintmax_t, not long int.
3522         The rest is a merge from libc:
3523         [defined _LIBC]: Include <shlib-compat.h>.
3524         (_obstack) [defined _LIBC]: Remove after 2.3.4.
3525
3526         * settime.c (settime): Recode to avoid warning with Sun Forte C 6U2.
3527
3528         * strverscmp.c: Convert to UTF-8.
3529
3530 2004-08-09  Paul Eggert  <eggert@cs.ucla.edu>
3531
3532         * obstack.h (obstack_empty_p):
3533         Don't assume that chunk->contents is suitably aligned.
3534         * obstack.c (_obstack_begin, _obstack_begin_1, _obstack_newchunk):
3535         Likewise. Problem reported by Benno in
3536         <http://sources.redhat.com/ml/libc-alpha/2004-08/msg00055.html>.
3537
3538         * chown.c (rpl_chown): Work even if the file is writeable but not
3539         readable.  This could be improved further but it'd take some work.
3540
3541 2004-08-08  Simon Josefsson  <jas@extundo.com>
3542
3543         * xgethostname.c: Don't include error.h (not used).
3544
3545         * getpass.h: Add.
3546         * getpass.c: Include getpass.h first.
3547
3548 2004-08-08  Paul Eggert  <eggert@cs.ucla.edu>
3549
3550         * xalloc-die.c: New files.
3551         * xalloc.h (xalloc_fail_func, xalloc_msg_memory_exhausted): Remove.
3552         All uses removed.
3553         * xmalloc.c (xalloc_fail_func, xalloc_msg_memory_exhausted): Likewise.
3554         Move inclusions of gettext.h, error.h, exitfail.h to xalloc-die.c.
3555         (_, N_, xalloc_die): Move to xalloc-die.c.
3556         * userspec.c (parse_user_spaec): Use xstrdup rather than strdup,
3557         so that we needn't mess with xalloc_msg_memory_exhausted.
3558
3559         * sha1.h: Renamed from sha.h.
3560         (SHA1_H): Renamed from _SHA_H.
3561         (sha1_ctx): Renamed from sha_ctx.
3562         (sha1_init_ctx): Renamed from sha_init_ctx.
3563         (sha1_process_block): Renamed from sha_process_block.
3564         (sha1_process_bytes): Renamed from sha_process_bytes.
3565         (sha1_finish_ctx): Renamed from sha_finish_ctx.
3566         (sha1_read_ctx): Renamed from sha_read_ctx.
3567         (sha1_stream): Renamed from sha_stream.
3568         (sha1_buffer): Renamed from sha_buffer.
3569         * sha1.c: Likewise; renamed from sha.c.
3570         Do not include <sys/types.h>.
3571         Include <stddef.h> rather than <stdlib.h>.
3572
3573 2004-08-08  Bruno Haible  <bruno@clisp.org>
3574
3575         * pathname.h (FILE_SYSTEM_PREFIX_LEN): Renamed from
3576         FILESYSTEM_PREFIX_LEN.
3577         * progreloc.c: Likewise.
3578         * concatpath.c (concatenated_pathname): Use FILE_SYSTEM_PREFIX_LEN.
3579
3580 2004-08-06  Paul Eggert  <eggert@cs.ucla.edu>
3581
3582         Merge from tar.
3583         * argp-help.c (make_hol, hol_append): Don't assume that
3584         SIZE_MAX is a valid preprocessor constant.
3585         (__argp_basename): Change from "#ifndef _LIBC"
3586         to "#ifndef __argp_short_program_name", so that
3587         we don't compile these functions for tar.
3588
3589         More merges from coreutils.
3590         * raise.c, readtokens0.h, readtokens0.c, strftime.h, utimens.h,
3591         utimens.c, utimecmp.h, utimecmp.c, xnanosleep.h, xnanosleep.c,
3592         yesno.h: New files.
3593         * addext.c: Remove; no longer needed.
3594         * yesno.c, argmatch.h, argmatch.c, backupfile.h, backupfile.c,
3595         euidaccess.c, filemode.c, closeout.c, dup2.c, exclude.c,
3596         fileblocks.c, filemode.c, fnmatch.c, fnmtahc_loop.c,
3597         fopen-safer.c, fsusage.c, fsusage.h, ftruncate.c, full-write.c,
3598         getdate.y, getloadavg.c, getugroups.c, hard-locale.c, hard-locale.h,
3599         hash.c, human.c, human.h, lchown.c, lchown.h, makepath.c, makepath.h,
3600         md5.c, md5.h, memchr.c, memcoll.c, memrchr.c, modechange.c,
3601         modechange.h, mountlist.c, mountlist.h, nanosleep.c, posixtm.c,
3602         putenv.c, quotearg.c, quotearg.h, readtokens.c, readutmp.c,
3603         readutmp.h, rmdir.c, safe-read.c, save-cwd.c, savedir.c, setenv.c,
3604         sig2str.c, stat.c, strtoimax.c, strverscmp.c, userspec.c, utime.c,
3605         version-etc.c., xgethostname.c, xmemcoll.c, xreadlink.c, xstrtod.c,
3606         xstrtod.h, xstrtoimax.c, xstrtol.c, xstrtol.h, xstrtoumax.c:
3607         Import changes from coreutils.
3608
3609 2004-08-05  Paul Eggert  <eggert@cs.ucla.edu>
3610
3611         Merge from coreutils.
3612
3613         * .gdb-history: Remove; this doesn't belong here.
3614
3615         * c-strtod.c, c-strtod.h, c-strtold.c, cycle-check.c,
3616         cycle-check.h, dev-ino.h, canonicalize.h, canonicalize.c,
3617         fcntl-safer.h, fcntl-safer.c, getcwd.c: New files.
3618
3619         * dirname.h: Include <stdbool.h>.
3620         (FILE_SYSTEM_PREFIX_LEN): Renamed from FILESYSTEM_PREFIX_LEN,
3621         for consistency with POSIX terminology.  All uses changed.
3622         (IS_ABSOLUTE_FILE_NAME, IS_RELATIVE_FILE_NAME): New macros.
3623         (strip_trailing_slashes): Use bool for booleans.
3624         * stripslash.c (strip_trailing_slashes): Likewise.
3625
3626         * error.c: Work around bug in OpenBSD 3.4 sterror_r: it
3627         sometimes returns a positive errno value even when it succeeds.
3628         (print_errno_message) [!LIBC]: Fall back on strerror if
3629         __strerror_r fails.
3630
3631         * path-concat.c (mempcpy): Don't define if a system header defines it.
3632         Don't include stdio.h, stdlib.h, unistd.h, strdup.h.
3633         (longest_relative_suffix): New function.
3634         (path_concat): Use it.  Assume first argument is not NULL.
3635         Port to DOS.  Omit redundant separators.
3636         Report an error instead of returning NULL.
3637         Use mempcpy instead of memcpy.
3638         (xpath_concat): Remove: not declared or used.
3639
3640         * same.h: Include <stdbool.h>
3641         (same_name): Return bool, not int.
3642         * same.c (same_name): Likewise.
3643         (errno): Don't declare; we assume C89 or better now.
3644
3645         * stat-macros (S_ISCTG, S_ISOFD, S_ISOFL): New macros,
3646         if not already defined.
3647
3648         * xgetcwd.c (errno): Don't declare; we assume C89 or better now.
3649         * dup-safer.c (errno): Likewise.
3650
3651 2004-08-03  Paul Eggert  <eggert@cs.ucla.edu>
3652
3653         * fatal.c, fatal.h: Remove as the "fatal" module wasn't used or
3654         working.
3655
3656 2004-08-03  Simon Josefsson  <jas@extundo.com>
3657
3658         * strdup.h: Only use HAVE_DECL_STRDUP if defined.
3659         * progname.h: Don't include stdbool.h.
3660
3661 2004-08-02  Simon Josefsson  <jas@extundo.com>
3662
3663         * getsubopt.h: New file, with comments from Bruno Haible.
3664         * getsubopt.c: New file, from glibc, but slightly modified based on
3665         suggestions from Paul Eggert <eggert@cs.ucla.edu>.
3666
3667 2004-08-01  Simon Josefsson  <jas@extundo.com>
3668
3669         * xgetdomainname.c: Include stdlib.h, for free().
3670
3671 2004-07-16  Simon Josefsson  <jas@extundo.com>
3672
3673         * dummy.c: New file.
3674
3675 2004-07-16  Bruno Haible  <bruno@clisp.org>
3676
3677         * backupfile.h: Add extern "C" for C++.
3678         * closeout.h: Likewise.
3679         * copy-file.h: Likewise.
3680         * findprog.h: Likewise.
3681         * full-write.h: Likewise.
3682         * pathname.h: Likewise.
3683         * progname.h: Likewise.
3684         * stpcpy.h: Likewise.
3685         * stpncpy.h: Likewise.
3686         * strcase.h: Likewise.
3687         * strstr.h: Likewise.
3688         * xalloc.h: Likewise.
3689
3690         * mbswidth.h: Add extern "C" for C++.
3691         Reported by Albert Chin-A-Young <china@thewrittenword.com>.
3692
3693 2004-07-09  Simon Josefsson  <jas@extundo.com>
3694
3695         * getndelim2.c: Include stddef.h, for ptrdiff_t.  (FreeBSD 4.9
3696         failed without this.)
3697
3698 2004-07-09  Paul Eggert  <eggert@cs.ucla.edu>
3699
3700         * fchown-stub.c: New file.
3701
3702 2004-06-24  Jim Meyering  <jim@meyering.net>
3703
3704         * obstack.h (obstack_base): Cast to (void *), per documentation.
3705
3706 2004-06-22  Paul Eggert  <eggert@cs.ucla.edu>
3707
3708         * argz.c, argz_.h: New files, which are autoupdated from libtool.
3709
3710 2004-06-01  Jim Meyering  <jim@meyering.net>
3711
3712         * calloc.c: New file.
3713
3714 2004-06-06  Paul Eggert  <eggert@cs.ucla.edu>
3715
3716         * getdate.y (yylex): Allow space between sign and number.
3717         Problem reported by Dan Jacobson.
3718
3719 2004-06-01  Paul Eggert  <eggert@cs.ucla.edu>
3720         and  Jim Meyering  <jim@meyering.net>
3721
3722         Merge from coreutils CVS.
3723
3724         * stat-macros.h: New file, with contents from file-type.h
3725         and coreutils' system.h.
3726         * file-type.c: Include "stat-macros.h".
3727         * file-type.h (file_type): Move all macro definitions to new file,
3728         stat-macros.h.
3729
3730         * chown.c (rpl_chown) [CHOWN_FAILS_TO_HONOR_ID_OF_NEGATIVE_ONE]:
3731         Wrap old code with this conditional.
3732         [CHOWN_MODIFIES_SYMLINK]: Try to work around a chown
3733         function that does not dereference symlinks.
3734         * lchown.c (lchown) [CHOWN_MODIFIES_SYMLINK]: Just call chown.
3735
3736         * xreadlink.c: Include xreadlink.h first, to catch .h file
3737         dependency problems.
3738         (xreadlink): Accept new arg SIZE, for efficiency.
3739         All decls and uses changed.
3740         * xreadlink.h: Include <stddef.h>, for size_t.
3741
3742         * .cppi-disable: Add alloca_.h, allocsa.h, exit.h, getndelim2.h,
3743         gettext.h, localcharset.h, strdup.h, strndup.h, strtoul.c, time_r.h.
3744
3745         * .cvsignore: Add alloca.h, fnmatch.h, poll.h, stdbool.h, sysexits.h.
3746
3747 2004-05-30  Paul Eggert  <eggert@cs.ucla.edu>
3748
3749         * xmalloc.c (HAVE_MALLOC, HAVE_REALLOC): Do not require these
3750         macros to be defined.
3751         (xnmalloc_inline, xnrealloc_inline, xcalloc): Do not die if
3752         the allocator returns NULL because the requested size is zero.
3753
3754 2004-05-20  Paul Eggert  <eggert@cs.ucla.edu>
3755
3756         * malloc/obstack.c (_obstack) [defined _LIBC]: Bring back this
3757         var.  Add comment explaining why libc still defines it.  This
3758         merges the following patch from glibc:
3759         http://sources.redhat.com/ml/libc-alpha/2004-05/msg00157.html
3760
3761 2004-05-19  Paul Eggert  <eggert@cs.ucla.edu>
3762
3763         * obstack.c (_obstack): Remove unused variable.  It hasn't been
3764         present in glibc since revision 1.1 of this file.
3765         * obstack.h (_obstack_free, obstack_1grow, obstack_1grow_fast,
3766         obstack_alignment_mask, obstack_alloc, obstack_base,
3767         obstack_blank, obstack_blank_fast, obstack_chunk_size,
3768         obstack_copy, obstack_copy0, obstack_finish, obstack_grow,
3769         obstack_grow0, obstack_init, obstack_int_grow,
3770         obstack_int_grow_fast, obstack_make_room, obstack_memory_used,
3771         obstack_next_free, obstack_object_size, obstack_ptr_grow,
3772         obstack_ptr_grow_fast, obstack_room): Remove declarations of
3773         nonexistent functions.
3774
3775 2004-05-17  Derek R. Price  <derek@ximbiot.com>
3776             Paul Eggert  <eggert@cs.ucla.edu>
3777
3778         * argp-help.c, argp-parse.c: Assume <alloca.h> rather than freecoding.
3779
3780 2004-05-14  Bruno Haible  <bruno@clisp.org>
3781
3782         * vasnprintf.c (VASNPRINTF): Correctly handle the case of a precision
3783         that consists of a '.' followed by an empty digit string.
3784         Patch by Tor Lillqvist <tml@iki.fi>.
3785
3786 2004-05-17  Paul Eggert  <eggert@cs.ucla.edu>
3787
3788         Port obstack to the AS/400, where pointers are 16 bytes wide and
3789         you cannot cast an integer to a valid pointer.  This patch is
3790         currently waiting to be integrated into glibc; see
3791         <http://sources.redhat.com/ml/libc-alpha/2004-05/msg00073.html>.
3792
3793         * obstack.h (__PTR_TO_INT, __INT_TO_PTR): Remove.
3794         All uses of __INT_TO_PTR (PTR_TO_INT ...) replaced by __PTR_ALIGN.
3795         (__BPTR_ALIGN, __PTR_ALIGN): New macros.
3796         (struct obstack): temp member is now a union of a pointer and
3797         an integer, instead of an integer.  All integer uses changed.
3798         This does not affect the physical layout of struct obstack,
3799         except on hosts (like the AS/400) where the size or alignment of
3800         void * is greater than that of ptrdiff_t.
3801         (obstack_finish) [! (defined __GNUC__ && defined __STDC__ &&
3802         __STDC__)]: Store temporary in pointer member of union, not
3803         integer member.
3804         * obstack.c: Include <stddef.h>, for offsetof.
3805         (struct fooalign): Remove; it doesn't need a name.
3806         (union fooround): Change double to long double, and add void *.
3807         (DEFAULT_ALIGNMENT): Use offsetof to compute.
3808         (DEFAULT_ALIGNMENT, DEFAULT_ROUNDING): Now an enum constant,
3809         not a macro.  Hence the values are always int; so remove all
3810         casts-to-int in uses.
3811
3812 2004-05-16  Paul Eggert  <eggert@cs.ucla.edu>
3813             Derek Price  <derek@ximbiot.com>
3814
3815         * alloca.c: Include <alloca.h>, to get our interface.
3816         * alloca_.h: Use __alloca on AIX, so that we don't have to
3817         include <alloca.h> first.  Use C89 prototype for alloca; this
3818         requires including <stddef.h> for size_t.  Use extern "C" if C++.
3819         Use #elif for simplicity, since we can assume C89 now.
3820         Don't try to source the system alloca.h since it will not be found
3821         and to prevent recursively including its replacement.
3822         * fnmatch.c: Include <alloca.h> instead of opencoding.
3823         * regex.c: Likewise.
3824
3825 2004-05-16  Derek Price  <derek@ximbiot.com>
3826             Paul Eggert  <eggert@cs.ucla.edu>
3827
3828         getline cleanup.  This changes the getndelim2 API: both order of
3829         arguments, and meaning of delim2 (now uses EOF, not 0, to indicate
3830         no delimiter).
3831
3832         * getline.c: Don't include stddef.h or stdio.h, since our
3833         interface does that.
3834         (getline): Always use getdelim, so that we don't have two
3835         copies of this code.
3836         * getndelim2.c: Include <limits.h>, <inttypes.h>, <stdint.h>
3837         if available.
3838         (PTRDIFF_MAX, SIZE_MAX, SSIZE_MAX): Define if not defined.
3839         (GETNDELIM2_MAXIMUM): New macro.
3840         (getndelim2): Reorder arguments.  delim==EOF now means no delimiter,
3841         instead of the old practice of delim2==0.  All callers changed.
3842         Return -1 on overflow, instead of returning junk.
3843         Do not set *linesize unless allocation succeeds.
3844         * getndelim2.h: Do not include stddef.h; no longer needed, now
3845         that we include sys/types.h.
3846         * getnline.h: Likewise.
3847         * getndelim2.h (GETNLINE_NO_LIMIT): New macro.
3848         (getndelim2): Reorder arguments.
3849         * getnline.c (getnline, getndelim):
3850         Don't discard the NMAX argument.
3851         (getnline): Invoke getndelim, to avoid code duplication.
3852         * getnline.h (GETNLINE_NO_LIMIT): New macro, used instead
3853         of (size_t) -1 by callers of the getnline family.
3854
3855 2004-05-13  Paul Eggert  <eggert@cs.ucla.edu>
3856
3857         * nanosleep.c (suspended): Change its type from int to
3858         sig_atomic_t volatile.
3859         (first_call): Make it private to rpl_nanosleep, and have it
3860         be zero initially as that's a bit faster.
3861         (my_usleep): Round up fractional times instead of truncating them,
3862         as this is the usual meaning for 'sleep'.
3863
3864         * gettime.c (gettime): Fall back on `time' if `gettimeofday'
3865         doesn't work.
3866         * settime.c: Include <unistd.h>, for stime (on Solaris 8, anyway).
3867         (ENOSYS): Define if not defined.
3868         (settime): Fall back on stime if it exists and settimeofday fails.
3869         But don't bother with fallbacks if a method fails with errno == EPERM.
3870
3871 2004-05-11  Jim Meyering  <jim@meyering.net>
3872
3873         Prior to this change, the save_cwd caller required read access to the
3874         current directory on most systems (ones with the fchdir function).
3875
3876         * save-cwd.c (save_cwd) [HAVE_FCHDIR]: If opening `.' read-only
3877         fails, try write-only, and finally, resort to using xgetcwd.
3878
3879 2004-05-06  Paul Eggert  <eggert@cs.ucla.edu>
3880
3881         * obstack.c, obstack.h: Import changes from libc.
3882
3883 2004-04-28  Bruno Haible  <bruno@clisp.org>
3884
3885         * findprog.c (find_in_path): Treat Cygwin like Windows, since it also
3886         implicitly appends .exe to executables.
3887         * localcharset.c (ISSLASH): Treat Cygwin like Windows, since it now
3888         accepts Windows pathnames.
3889         * pathname.h (ISSLASH, IS_PATH_WITH_DIR, FILESYSTEM_PREFIX_LEN): Treat
3890         Cygwin like Windows, since it now accepts Windows pathnames.
3891         * progreloc.c (ISSLASH, IS_PATH_WITH_DIR, FILESYSTEM_PREFIX_LEN): Treat
3892         Cygwin like Windows, since it now accepts Windows pathnames.
3893         Reported by Derek Robert Price <derek@ximbiot.com>.
3894
3895 2004-04-20  Jim Meyering  <jim@meyering.net>
3896
3897         * getndelim2.c (getndelim2): Upon realloc failure, don't leak memory.
3898
3899 2004-04-20  Jim Meyering  <jim@meyering.net>
3900             Bruno Haible  <bruno@clisp.org>
3901
3902         * localcharset.c (get_charset_aliases) [!VMS && !WIN32]: Don't leak
3903         memory when realloc fails.
3904
3905 2004-04-18  Jim Meyering  <jim@meyering.net>
3906
3907         * readutmp.c (read_utmp) [UTMP_NAME_FUNCTION]: Upon realloc failure,
3908         don't leak memory and do call END_UTMP_ENT.
3909
3910 2004-04-11  Paul Eggert  <eggert@twinsun.com>
3911
3912         * inttostr.h: Include <limits.h> unconditionally, since we assume C89.
3913         (CHAR_BIT): Remove, since we assume C89.
3914         Include <stdint.h> if available, as per current Autoconf CVS advice.
3915
3916 2004-03-30  Paul Eggert  <eggert@twinsun.com>
3917
3918         * cloexec.h, cloexec.c (set_cloexec_flag): Return int
3919         not bool, to be more consistent with Unix conventions.
3920         Suggested by Bruno Haible.
3921
3922         Merge from coreutils.
3923
3924         * imaxtostr.c, inttostr.c, inttostr.h, offtostr.c, umaxtostr.c:
3925         New files.
3926
3927         * getdate.h: Include stdbool.h, and timespec.h instead of
3928         the usual <time.h> dance.
3929         (get_date): Change signature to support fractional time stamps.
3930         All callers changed.
3931         * getdate.y: Include "getdate.h" first, as we can now
3932         assume C89 and don't need to worry about 'const'.
3933         Similarly, include "unlocked-io.h" near start, not in middle.
3934         Include <limits.h>.
3935         (textint.value): Use long int rather than int.
3936         (textint.digits): Use size_t rather than int.
3937         (BILLION, LOG10_BILLION): New constants.
3938         (parser_control): New member rel_ns.  Members day_ordinal,
3939         time_zone, month, day, hour, minutes, rel_year, rel_month,
3940         rel_day, rel_hour, rel_minutes, rel_seconds
3941         are now long int, not int.  Member seconds is now struct timespec,
3942         not int.  New member timespec_seen.  Members dates_seen, days_seen,
3943         local_zones_seen, rels_seen, times_seen, zones_seen are now size_t,
3944         not int.
3945         (%union.intval): Now long int, not int.
3946         New member timespec.
3947         (tSDECIMAL_NUMBER, tUDECIMAL_NUMBER): New tokens.
3948         (seconds, signed_seconds, unsigned_seconds): New nonterminals.
3949         (spec): Now is a timespec or an item list.
3950         (timespec, items): New nonterminals.
3951         (time, rel, relunit, number, get_date):
3952         Add support for fractional seconds.
3953         (time): Fix bug: seconds weren't cleared in "00:00 +0000" syntax.
3954         (gmtime, localtime, mktime): Remove decls; not needed with C89.
3955         (to_hour): First arg is now long int, not int.
3956         (to_year): Returns long int, not int.
3957         Don't treat year -70 like 70.
3958         (tm_diff): Returns long int, not int.
3959         (lookup_word): Use bool instead of int when appropriate.
3960         (yylex): Use size_t for count, not int.
3961         Detect overflow when parsing large integer constants.
3962         Add support for fractions.
3963         (get_date): Make pointers 'const' if possible.
3964         Use more-portable code to detect integer overflow.
3965         (main) [TEST]: Adjust to above changes.  Test for localtime failure.
3966         Don't use ctime; it's not reliable if the year has >4 digits.
3967
3968         * human.c (humblock): Inspect BLOCKSIZE if BLOCK_SIZE isn't set.
3969         This is for compatibility with BSD.
3970
3971         * timespec.h (ST_TIME_CMP_NS, ST_TIME_CMP): Define.
3972         (ATIME_CMP, CTIME_CMP, MTIME_CMP, TIMESPEC_NS): Likewise.
3973         From coreutils' system.h.
3974
3975         * userspec.c: Don't include "posixver.h".
3976         (parse_user_spec): Fall back on USER.GROUP parsing, regardless
3977         of POSIX version, as POSIX 1003.1-2001 allows that behavior as a
3978         compatible extension.  Simplify code by removing a boolean int
3979         that was always nonzero if a string was nonnull.
3980
3981 2004-03-30  Jim Meyering  <jim@meyering.net>
3982
3983         Merge from coreutils.
3984
3985         * mountlist.c [HAVE_SYS_UCRED_H]: Include grp.h before sys/ucred.h.
3986
3987         * readtokens.c (readtoken): Don't leak 64 bytes when reading
3988         an empty input stream.
3989
3990         * readtokens.c: Include <stdbool.h>.
3991         (readtoken): Use `size_t' rather than int/long.
3992         All callers adjusted.
3993         Use `bool' rather than `int' where appropriate.
3994         Use memset rather than an explicit loop.
3995         Use x2nrealloc rather than xrealloc.
3996         Allow the use of `\0' as a delimiter.
3997         (readtokens): Likewise.
3998         * readtokens.h (readtoken, readtokens): Update prototypes.
3999
4000 2004-03-30  Bruno Haible  <bruno@clisp.org>
4001
4002         * getloadavg.c (getloadavg): Don't assume setlocale returns
4003         nonnull.
4004
4005 2004-03-29  Paul Eggert  <eggert@twinsun.com>
4006
4007         Merge changes to getloadavg.c from coreutils and Emacs.
4008
4009         * getloadavg.c [!defined HAVE_SETLOCALE] (setlocale):
4010         Define to an expression, not to the empty string.
4011         Include cloexec.h and xalloc.h.
4012         (getloadavg): Restore LC_NUMERIC locale after setting it temporarily.
4013         Use set_cloexec_flag rather than rolling our own.
4014         * cloexec.c, cloexec.h: New files.
4015
4016 2004-03-18  Paul Eggert  <eggert@twinsun.com>
4017
4018         * getopt.h: Sync with libc CVS.
4019
4020 2004-03-18  Paul Eggert  <eggert@twinsun.com>
4021             Bruno Haible  <bruno@clisp.org>
4022
4023         * mbswidth.h: Include <wchar.h> only if HAVE_DECL_MBSWIDTH_IN_WCHAR_H,
4024         not on all platforms that have <wchar.h>.
4025         * mbswidth.c: Include <stdio.h> and <time.h> before <wchar.h>.
4026
4027 2004-03-09  Paul Eggert  <eggert@twinsun.com>
4028
4029         * argp-parse.c, getopt.c, getopt.h, getopt1.c:
4030         Sync with libc CVS.
4031         * getopt_int.h: New file, also synced from libc.
4032
4033 2004-03-07  Paul Eggert  <eggert@twinsun.com>
4034
4035         * c-stack.c (SIGACTION_WORKS): New macro.  Use it instead of long
4036         '#if' expressions.  Unlike the code it replaces, it does not
4037         depend on (defined _SC_PAGESIZE).  However, it does depend on
4038         HAVE_STRUCT_SIGACTION_SA_SIGACTION; this last change fixes a bug
4039         first reported by Jason Andrade in
4040         <http://mail.gnu.org/archive/html/bug-textutils/2003-03/msg00027.html>.
4041
4042 2004-01-18  Simon Josefsson  <jas@extundo.com>
4043
4044         * strdup.h: New file.
4045         * strdup.c: Include it.
4046         * path-concat.c: Include strdup.h. Drop strdup declaration.
4047         * userspec.c: Include strdup.h. Drop strdup declaration.
4048
4049 2004-02-06  Karl Berry  <karl@gnu.org>
4050
4051         * config.charset: update from gettext 0.14.1.
4052
4053 2004-02-05  Paul Eggert  <eggert@twinsun.com>
4054
4055         Add comments and code, prompted by suggestions from Bruno Haible
4056         for sh-quote.
4057         * quotearg.h (quotearg_alloc): New decl.  Improve the comments
4058         describing the enum quoting_style values.
4059         * quotearg.c (quotearg_alloc): New function.
4060         (quotearg_buffer_restyled): Treat lone { and } as special.
4061         Treat = as special.  Work around bug with older shells
4062         that "see" a '\' that is really the 2nd byte of a multibyte char.
4063         Quote empty string with shell_quoting_style.
4064
4065 2004-02-03  Bruno Haible  <bruno@clisp.org>
4066
4067         * pipe.h: New file, from GNU gettext.
4068         * pipe.c: New file, from GNU gettext.
4069
4070 2004-01-27  Bruno Haible  <bruno@clisp.org>
4071
4072         * execute.h: New file, from GNU gettext.
4073         * execute.c: New file, from GNU gettext.
4074         * w32spawn.h: New file, from GNU gettext.
4075
4076 2004-01-23  Paul Eggert  <eggert@twinsun.com>
4077
4078         Exit-status fix from coreutils.
4079
4080         Use exit_failure consistently in place of EXIT_FAILURE,
4081         so that program exit statuses are consistent on failure.
4082
4083         * argmatch.c (ARGMATCH_DIE) [! defined ARGMATCH_DIE]:
4084         Include "exitfail.h", and use exit_failure rather than EXIT_FAILURE.
4085         * argmatch.h: Comment fix to match the above.
4086         * obstack.c (obstack_exit_failure) [!defined _LIBC]:
4087         Now a macro referring to exit_failure, instead of a separate
4088         variable.  Include "exitfail.h" to get it.
4089         * xstrtol.h: Include "exitfail.h".
4090         (STRTOL_FATAL_ERROR): Exit with status exit_failure, not 2.
4091
4092         * long-options.c (parse_long_options): Use prototype
4093         for usage function arg.  Pass it EXIT_SUCCESS rather than 0,
4094         for clarity.
4095
4096 2004-01-21  Jim Meyering  <jim@meyering.net>
4097
4098         * mktime.c (__mktime_internal) [!_LIBC]: Define to mktime_internal
4099         so as not to conflict with a different-sized __mktime_internal
4100         function in GNU libc.
4101         * timegm.c (__mktime_internal) [!_LIBC]: Likewise.
4102         Problem building statically-linked `ls' reported by Michael Brunnbauer.
4103
4104 2004-01-18  Paul Eggert  <eggert@twinsun.com>
4105
4106         Merge from diffutils.
4107
4108         * file-type.c (file_type): Add typed memory objects.
4109         * file-type.h (S_TYPEISTMO): New macro.
4110
4111         * c-stack.h (c_stack_action): Remove argv argument.
4112         * c-stack.c (c_stack_action): Likewise.  All uses changed.
4113         (die): Don't calculate message unless segv_action returns.
4114         (get_stack_location, min_address_from_argv, max_address_from_argv,
4115         volatile stack_base, volatile_stack_size): Remove.
4116         (segv_handler): If ! HAVE_XSI_STACK_OVERFLOW_HEURISTIC, assume
4117         that every segmentation violation is a stack overflow.  (Ouch!)
4118         See Debian bug 136249 (still outstanding) for more info about why
4119         HAVE_XSI_STACK_OVERFLOW_HEURISTIC fails on Linux kernels.
4120
4121 2003-11-30  Bruno Haible  <bruno@clisp.org>
4122
4123         Safer stack allocation.
4124         * setenv.c: Include allocsa.h.
4125         (alloca): Remove fallback definition.
4126         (freea): Remove macro.
4127         (__add_to_environ) [!_LIBC]: Use allocsa instead of alloca. Use freesa
4128         instead of freea.
4129
4130 2003-10-17  Bruno Haible  <bruno@clisp.org>
4131
4132         * binary-io.h: Avoid warnings on Cygwin.
4133
4134 2003-12-28  Bruno Haible  <bruno@clisp.org>
4135
4136         * wait-process.c (wait_subprocess): Add ignore_sigpipe argument.
4137         * wait-process.c (wait_subprocess): Likewise. Handle SIGPIPE specially.
4138
4139 2003-11-28  Bruno Haible  <bruno@clisp.org>
4140
4141         * wait-process.c (cleanup_slaves): Use ANSI C declaration.
4142
4143 2003-11-27  Bruno Haible  <bruno@clisp.org>
4144
4145         * wait-process.c: On Windows, include windows.h. Needed on mingw.
4146
4147 2003-11-17  Bruno Haible  <bruno@clisp.org>
4148
4149         * wait-process.c (wait_process): Disable the 2003-10-31 waitid() patch.
4150
4151 2003-11-24  Bruno Haible  <bruno@clisp.org>
4152
4153         * xallocsa.h: New file, from GNU gettext.
4154         * xallocsa.c: New file, from GNU gettext.
4155
4156 2003-11-24  Bruno Haible  <bruno@clisp.org>
4157
4158         * allocsa.h: New file, from GNU gettext.
4159         * allocsa.c: New file, from GNU gettext.
4160
4161 2003-11-24  Bruno Haible  <bruno@clisp.org>
4162
4163         * eealloc.h: New file.
4164
4165 2004-01-15  Jim Meyering  <jim@meyering.net>
4166
4167         Merge from coreutils.
4168
4169         * md5.h (rol) [__GNUC__ && __i386__]: Don't use `asm' code.  These
4170         days, gcc-3.x does better all by itself.  Patch from Dean Gaudet:
4171         http://mail.gnu.org/archive/html/bug-coreutils/2003-11/msg00144.html
4172
4173         * posixver.c (DEFAULT_POSIX2_VERSION): Use definition of new,
4174         optional configure-time default.
4175
4176         * version-etc.c (version_etc_copyright): Update copyright date.
4177
4178         * xreadlink.c (xreadlink): Correct outdated comment.
4179
4180 2004-01-15  Paul Eggert  <eggert@twinsun.com>
4181
4182         Merge from coreutils.
4183
4184         * posixver.c: Include posixver.h.
4185
4186         * same.c: Include <stdbool.h>, <limits.h>.
4187         (_POSIX_NAME_MAX): Define if not defined.
4188         (MIN): New macro.
4189         (same_name): If file names are silently truncated, report
4190         that the file names are the same if they are the same after
4191         the silent truncation.
4192
4193         * xstrtod.h (xstrtod): Accept an extra arg, specifying the
4194         conversion function.
4195         * xstrtod.c (xstrtod): Likewise.  All callers changed to
4196         include c-strtod.h and use c_strtod.  Don't include stdlib.h; no
4197         longer needed.
4198
4199 2004-01-14  Paul Eggert  <eggert@twinsun.com>
4200
4201         * fnmatch_loop.c (ALLOCA_LIMIT): Remove macro, which collided
4202         with like-named macro in fnmatch.c.
4203         (EXT): Use an internal constant instead.
4204
4205         Merge fnmatch patches from glibc.
4206         * fnmatch.c (mbsinit): Remove define.
4207         Add libc_hidden_ver (__fnmatch, fnmatch).
4208         * fnmatch_loop.c (FCT): Cast to int32_t and UCHAR when appropriate.
4209         Adjust to renaming of collseq_table_lookup to __collseq_table_lookup.
4210
4211 2003-12-14  Karl Berry  <karl@gnu.org>
4212
4213         * config.charset: update from gettext-runtime.
4214
4215 2003-12-03  Paul Eggert  <eggert@twinsun.com>
4216
4217         * getgroups.c (getgroups): xmalloc takes one argument, not two.
4218         Bug reported by Alfred M. Szmidt.
4219
4220 2003-11-29  Karl Berry  <karl@gnu.org>
4221
4222         * argp-{help.c,parse.c,namefrob.h}, argp.h: update from libc.
4223
4224 2003-11-23  Paul Eggert  <eggert@twinsun.com>
4225             Bruno Haible  <bruno@clisp.org>
4226
4227         * printf-parse.h: Don't include sys/types.h.
4228         (ARG_NONE): New macro.
4229         (char_directive): Change type of *arg_index fields to size_t.
4230         * printf-parse.c: Don't include sys/types.h.
4231         (SSIZE_MAX): Remove macro.
4232         (PRINTF_PARSE): Change the type of the arg_index variables to size_t.
4233         Remove unnecessary overflow check.
4234         * vasnprintf.c (VASNPRINTF): Update for type change of *arg_index
4235         fields.
4236
4237 2003-11-24  Paul Eggert  <eggert@twinsun.com>
4238
4239         * alloca.c: Remove dependency on xalloc module.
4240         (xalloc_die): Remove.
4241         (memory_full) [!defined emacs]: New macro.
4242         [!defined emacs]: Don't include xalloc.h.
4243         (alloca): Invoke memory_full, not xalloc_die, if malloc fails or
4244         address arithmetic overflows.  Change datatypes a bit to avoid
4245         unnecessary casts.
4246
4247 2003-11-22  Jim Meyering  <jim@meyering.net>
4248
4249         * xmalloc.c (x2nrealloc_inline): Fix typos in comments: s/size/size_t/.
4250
4251 2003-11-17  Bruno Haible  <bruno@clisp.org>
4252
4253         * vasnprintf.c (alloca): Remove fallback definition.
4254         (freea): Remove definition.
4255         (VASNPRINTF): Use alloca only for small sizes, say <= 4000 bytes.
4256         Reported by Paul Eggert.
4257
4258 2003-11-17  Jim Meyering  <jim@meyering.net>
4259
4260         On systems without utime and without a utimes function capable of
4261         dealing with a NULL struct utimbuf* argument, this utime replacement
4262         could -- in unusual circumstances -- leak a file descriptor.
4263         * utime.c: Include <unistd.h> and <errno.h>.
4264         (utime_null): Be sure to close `fd' and to preserve errno.
4265         Reported by Geoff Collyer via Arnold Robbins.
4266
4267 2003-11-16  Paul Eggert  <eggert@twinsun.com>
4268             Bruno Haible  <bruno@clisp.org>
4269
4270         Protect against address arithmetic overflow.
4271         * printf-args.h: Include stddef.h.
4272         (arguments): Change type of field 'count' to size_t.
4273         * printf-args.c (printf_fetchargs): Use size_t instead of
4274         'unsigned int' where appropriate.
4275         * printf-parse.h: Include sys/types.h.
4276         (char_directive): Change type of *arg_index fields to ssize_t.
4277         (char_directives): Change type of fields 'count', max_*_length to
4278         size_t.
4279         * printf-parse.c: Include sys/types.h and xsize.h.
4280         (SSIZE_MAX): Define fallback value.
4281         (PRINTF_PARSE): Use size_t instead of 'unsigned int' and ssize_t
4282         instead of 'int' where appropriate. Check a_allocated, d_allocated
4283         against overflow. Reject %m$ argument numbers > SSIZE_MAX + 1.
4284         * vasnprintf.c: Include xsize.h.
4285         (VASNPRINTF): Use size_t instead of 'unsigned int' where appropriate.
4286         Check alloca, malloc, realloc, ENSURE_ALLOCATION arguments against
4287         overflow. Avoid wraparound when converting a width or precision from
4288         decimal to binary.
4289
4290 2003-11-16  Bruno Haible  <bruno@clisp.org>
4291
4292         Update from GNU gettext.
4293         * printf-parse.c: Generalize to it can be compiled for wide strings.
4294         (PRINTF_PARSE, CHAR_T, DIRECTIVE, DIRECTIVES): New macros.
4295         * vasnprintf.c: Generalize to it can be compiled for wide strings.
4296         (VASNPRINTF, CHAR_T, DIRECTIVE, DIRECTIVES, PRINTF_PARSE, USE_SNPRINTF,
4297         SNPRINTF): New macros.
4298         Don't include <alloca.h> if the file is used inside libintl.
4299         (local_wcslen): New function, for Solaris 2.5.1.
4300         (VASNPRINTF): Use it instead of wcslen.
4301
4302 2003-11-16  Bruno Haible  <bruno@clisp.org>
4303
4304         * xsize.h (xmax): New function.
4305         (xsum, xsum3, xsum4): Declare as "pure" functions.
4306
4307 2003-11-12  Paul Eggert  <eggert@twinsun.com>
4308
4309         * xalloc.h: Do not include <limits.h> or <stdint.h>.
4310         (xalloc_oversized): Use sizeof (ptrdiff_t) and sizeof (size_t) for
4311         the heuristic, rather than PTRDIFF_MAX and SIZE_MAX.  This
4312         heuristic is just as accurate as far as we know, and it removes a
4313         dependency on size_max.m4 and ptrdiff_max.m4.
4314
4315 2003-11-12  Paul Eggert  <eggert@twinsun.com>
4316
4317         * xstrtol.c (__xstrtol): Remove "break" immediately after
4318         "return", to pacify some unknown compiler.  Problem reported
4319         by Joerg Schilling.
4320
4321 2003-11-11  Bruno Haible  <bruno@clisp.org>
4322
4323         * xsize.h (SIZE_MAX): Remove fallback definition.
4324         * xalloc.h: Include limits.h. Assume SIZE_MAX and PTRDIFF_MAX are
4325         defined.
4326
4327 2003-11-10  Paul Eggert  <eggert@twinsun.com>
4328
4329         * xalloc.h (xalloc_oversized): [! (defined PTRDIFF_MAX &&
4330         PTRDIFF_MAX < SIZE_MAX)]: Fix off-by-one error that would have
4331         rejected some allocations of exactly SIZE_MAX - 2 bytes.
4332         From Bruno Haible.
4333         [defined PTRDIFF_MAX && PTRDIFF_MAX < SIZE_MAX]: Use SIZE_MAX,
4334         not (size_t) -1, since it's defined here.
4335
4336 2003-11-06  Paul Eggert  <eggert@twinsun.com>
4337
4338         * xalloc.h [HAVE_STDINT_H]: Include <stdint.h>.
4339         (xalloc_oversized) [! (PTRDIFF_MAX < SIZE_MAX)]:
4340         Reject sizes of exactly SIZE_MAX bytes.
4341         * xreadlink.c: Include "xalloc.h" before checking whether SIZE_MAX
4342         is defined, since "xalloc.h" now defines SIZE_MAX on modern hosts.
4343
4344 2003-11-05  Bruno Haible  <bruno@clisp.org>
4345
4346         * xsize.h: Include limits.h, to avoid a possible collision with
4347         SIZE_MAX defined in <limits.h> on Solaris.
4348
4349 2003-11-04  Bruno Haible  <bruno@clisp.org>
4350
4351         * xsize.h: New file.
4352         * linebreak.c: Include xsize.h.
4353         (mbs_possible_linebreaks, mbs_width_linebreaks): Check malloc()
4354         argument for overflow.
4355         Suggested by Paul Eggert.
4356
4357 2003-10-31  Bruno Haible  <bruno@clisp.org>
4358
4359         * wait-process.c (wait_process): Use waitid with WNOWAIT if available,
4360         to avoid (extremely rare) race condition.
4361         Suggested by Paul Eggert.
4362
4363 2003-11-03  Jim Meyering  <jim@meyering.net>
4364
4365         * userspec.c: Include "userspec.h".
4366         * userspec.h: New file.
4367
4368 2003-10-31  Paul Eggert  <eggert@twinsun.com>
4369
4370         * mountlist.h (struct mount_entry.me_type_malloced): New member.
4371         * mountlist.c (SIZE_MAX): Define if not defined already.
4372         (read_filesystem_list): Set and use me_type_malloced.
4373         Use "sizeof *me" rather than "sizeof (struct mount_entry)" (or
4374         whatever the type happens to be), for brevity and consistency.
4375         Check for size calculation overflow on Alphas running OSF/1.
4376
4377 2003-10-31  Jim Meyering  <jim@meyering.net>
4378
4379         * hash.c: Include "xalloc.h" for use of xalloc_oversized.
4380
4381         * linebuffer.c: Include <string.h> for declaration of memset.
4382
4383 2003-10-30  Paul Eggert  <eggert@twinsun.com>
4384             Bruno Haible  <bruno@clisp.org>
4385
4386         * vasprintf.c: Include <limits.h>, <stdlib.h>.
4387         (vasprintf): Fail if the resulting length doesn't fit in an 'int'.
4388
4389 2003-10-29  Paul Eggert  <eggert@twinsun.com>
4390
4391         * xalloc.h (xalloc_oversized): Now a macro, not a function,
4392         so that it works even if SIZE_MAX < N.  Do not include <stdbool.h>;
4393         no longer needed.
4394         * quotearg.c (quotearg_n_options): Use it.
4395         * group-member.c: Include <stdbool.h>.
4396         (free_group_info): Arg is now const *; don't free arg.
4397         (get_group_info): Now returns bool and accepts struct group_info *,
4398         rather than returning a malloc'ed struct group_info *.
4399         All uses changed.  Check for overflow in internal size calculation.
4400
4401         * getusershell.c (readname): Simplify the code by using x2nrealloc
4402         rather than xmalloc/xrealloc.
4403         * linebuffer.c (initbuffer, readlinebuffer): Simplify the code by
4404         using x2realloc rather than xmalloc/xrealloc.  Also, fix a C
4405         conformance bug: the old code used a pointer after freeing the
4406         storage that it addressed.
4407         * hash.c (hash_initialize): Simplify the code by using xalloc_oversized
4408         rather than doing it by hand.
4409         * getgroups.c (getgroups): Don't use xrealloc, since we don't need
4410         the buffer preserved.  Use free and xmalloc instead.
4411         * quotearg.c (quotearg_n_options): Likewise.
4412         Use a simpler test for size overflow.  Don't use xalloc_oversized
4413         because unsigned int might be wider than size_t (!); this suggests
4414         that we should switch from unsigned int to size_t for slot numbers.
4415
4416 2003-10-27  Bruno Haible  <bruno@clisp.org>
4417
4418         * stdbool_.h: Better support for BeOS.
4419
4420 2003-10-27  Paul Eggert  <eggert@twinsun.com>
4421
4422         * exclude.c (new_exclude): Use xzalloc rather than xmalloc
4423         to allocate the returned structure.  Do not allocate a subarray,
4424         as x2nrealloc will do that.
4425         (add_exclude): Use x2nrealloc to reallocate ex->exclude,
4426         instead of xnrealloc.
4427         (add_exclude_file): Use x2realloc instead of malloc + xnrealloc.
4428
4429 2003-10-26  Paul Eggert  <eggert@twinsun.com>
4430
4431         * xalloc.h (xalloc_oversized): New static inline function, for
4432         callers that want to do their own size-overflow checking.  Include
4433         <stdbool.h>, since xalloc_oversized returns bool.
4434         * xalloc.c (array_size_overflow): Remove.  All callers changed
4435         to use xalloc_oversized.
4436
4437         Add two functions x2realloc, x2nrealloc, for programs that grow
4438         arrays dynamically by doubling their sizes.
4439         * xalloc.h (x2realloc, x2nrealloc): New decls.
4440         * xmalloc.c (x2nrealloc_inline, x2nrealloc, x2realloc):
4441         New functions.
4442
4443         Port to C99 semantics for 'inline' of external functions.
4444         Bug reported by Bruno Haible.
4445         * xmalloc.c (xnmalloc_inline): New static inline function,
4446         with the old contents of xnmalloc.
4447         (xnmalloc, xmalloc): Use it.
4448         (xnrealloc_inline): New static inline function,
4449         with the old contents of xnrealloc.
4450         (xnrealloc, xrealloc): Use it.
4451
4452         * alloc.c (alloca): xmalloc cannot return NULL, so don't test for that.
4453
4454 2003-10-25  Paul Eggert  <eggert@twinsun.com>
4455
4456         Fix several address-calculation bugs in the hash modules,
4457         plus some minor code cleanup.
4458
4459         * hash.h: Include <stdbool.h>, for bool.
4460         * hash.c: Don't include <stdbool.h>, since hash.h does it now.
4461         * hash.h (Hash_hasher, hash_get_n_buckets, hash_get_n_buckets_used,
4462         hash_get_n_entries, hash_get_max_bucket_length,
4463         hash_get_entries, hash_do_for_each, hash_string, hash_initialize,
4464         hash_rehash): Use size_t rather than unsigned.
4465         * hash.c (struct hash_table, hash_get_n_buckets,
4466         hash_get_n_buckets_used, hash_get_n_entries,
4467         hash_get_max_bucket_length, hash_table_ok, hash_print_statistics,
4468         hash_get_entries, hash_do_for_each, hash_string, is_prime,
4469         next_prime, hash_initialize, hash_rehash, hash_delete, hash_print):
4470         Likewise.
4471         (SIZE_MAX): Define if not defined.
4472         (hash_get_max_bucket_length, hash_table_ok, hash_lookup,
4473         hash_get_first, hash_get_next, hash_get_entries, hash_do_for_each,
4474         hash_print):
4475         Use const * when possible.
4476         (hash_string): Use (unsigned char) *P rather than *(unsigned char *) P.
4477         (check_tuning): Fix bug: if tuning parameters were very close to
4478         0 or 1, rounding errors could have caused subscript violations.
4479         (hash_initialize, allocate_entry, hash_print): Remove unnecessary cast.
4480         (hash_initialize): Add 'fail:' label
4481         to free table and return NULL, and use it to simplify code.
4482         Use calloc rather than clearing the storage ourself.
4483         (hash_initialize, hash_rehash): Check for arithmetic overflow in
4484         buffer size calculations.
4485         * hash-pjw.h (hash_pjw): Use size_t, not unsigned.
4486         Include <stddef.h>, for size_t.
4487         * hash-pjw.c (hash_pjw): Likewise.
4488         Switch to method described by Bruno Haible.
4489         Include <limits.h>, for CHAR_BIT.
4490         (SIZE_BITS): New macro.
4491
4492 2003-10-21  Paul Eggert  <eggert@twinsun.com>
4493
4494         * getndelim2.c (getndelim2): When size calculation overflows,
4495         ceiling the allocation at NMAX bytes rather than silently
4496         discarding input bytes before NMAX is reached.  This makes
4497         a difference only if NMAX exceeds SIZE_MAX / 2.
4498
4499         * obstack.c: Merge from glibc.
4500         [defined _LIBC]: Include <obstack.h>, not "obstack.h".
4501         Add libc_hidden_def (_obstack_newchunk).
4502         (_obstack_free) [! defined _LIBC]: Remove.
4503         [defined _LIBC]: Make a strong alias from obstack_free, rather than
4504         a clone of the function body.
4505         (fputs) [defined _LIBC && defined USE_IN_LIBIO]: Remove.
4506         [defined _LIBC && !defined USE_IN_LIBIO]: Include <libio/iolibio.h>.
4507
4508         * obstack.h: Indenting cleanup, to make it easier to merge with glibc.
4509         (obstack_grow, obstack_grow0): Remove unnecessary parentheses around
4510         arg to memcpy.
4511
4512         * obstack.h (obstack_1grow_fast): Properly parenthesize arg.
4513         (obstack_ptr_grow_fast, obstack_int_grow_fast):
4514         Don't use lvalue casts, as GCC plans to remove support for them
4515         in GCC 3.5.  Reported by Joseph S. Myers.  This bug
4516         was also present in the non-GCC version, indicating that this
4517         code had always been buggy and had never been widely used.
4518         (obstack_1grow, obstack_ptr_grow, obstack_int_grow, obstack_blank):
4519         Use the fast variant of each macro, rather than copying the
4520         definiens of the fast variant; that way, we'll be more likely to
4521         catch future bugs in the fast variants.
4522
4523 2003-10-20  Bruno Haible  <bruno@clisp.org>
4524
4525         * wait-process.h: New file, from GNU gettext.
4526         * wait-process.c: New file, from GNU gettext.
4527
4528 2003-10-19  Jim Meyering  <jim@meyering.net>
4529
4530         * vasnprintf.c (vasnprintf): Work around losing snprintf on HPUX 10.20.
4531
4532 2003-10-16  Paul Eggert  <eggert@twinsun.com>
4533
4534         * getgroups.c: Include <errno.h>, <stdlib.h>.
4535         (getgroups): First arg is int, not size_t.
4536         Don't let 'free' mangle errno.
4537
4538 2003-10-16  Jim Meyering  <jim@meyering.net>
4539
4540         * xmalloc.c: Include <string.h>, for declarations of memset and memcpy.
4541
4542 2003-10-15  Paul Eggert  <eggert@twinsun.com>
4543
4544         * exclude.c: Do not include <inttypes.h> or <stdint.h>.
4545         (SIZE_MAX): Remove.
4546         (new_exclude, add_exclude_file): Initial size no longer needs to
4547         be a power of 2.
4548         (add_exclude, add_exclude_file): Use xnrealloc instead of rolling
4549         our own address arithmetic overflow checking.
4550
4551         * fnmatch.c (SIZE_MAX): Define if standard headers don't.
4552         (fnmatch): Do not alloca more than 2000 wide characters;
4553         instead, use malloc for large buffers.
4554         Check for address arithmetic overflow, and return -1
4555         with errno set to ENOMEM in that case.
4556         * fnmatch_loop.c (ALLOCA_LIMIT): New macro.
4557         (NEW_PATTERN): Do not alloca more than 8000 bytes;
4558         instead, return -1.  Check for address arithmetic overflow.
4559
4560 2003-10-14  Paul Eggert  <eggert@twinsun.com>
4561
4562         Handle invalid suffixes and overflow independently, so that
4563         callers can treat them independently as needed.  Fix some bugs in
4564         suffix handling, e.g., "100k@" was not diagnosed as an invalid
4565         suffix for a human-readable blocksize.  The major caller-visible
4566         change is the addition of a new
4567         LONGINT_INVALID_SUFFIX_CHAR_WITH_OVERFLOW enum value, indicating
4568         that both overflow and suffix chars were found.
4569
4570         * human.c (humblock): Don't check separately for invalid suffix
4571         char; that is xstrtoumax's job (now that its bug is fixed).
4572         * xstrtoimax.c (STRTOL_T_MINIMUM, STRTOL_T_MAXIMUM) [defined
4573         INTMAX_MAX]: New macros.
4574         * xstrtol.c (STRTOL_T_MINIMUM, STRTOL_T_MAXIMUM, TYPE_MINIMUM,
4575         TYPE_MAXIMUM): New macros.
4576         (bkm_scale, bkm_scale_by_power): Return strtol_error, not int.
4577         (bkm_scale, bkm_scale_by_power, __xstrtol): Return maximal values
4578         if overflow occurs, as it's what __strtol does and it's more useful
4579         in practice.
4580         (__xstrtol): If __strtol reports some error other than ERANGE,
4581         reflect it to the caller as LONGINT_INVALID.  If it reports
4582         ERANGE, continue the rest of parsing, and report LONGINT_OVERFLOW
4583         | LONGINT_INVALID_SUFFIX_CHAR if both errors occur.
4584         * xstrtol.h (LONGINT_INVALID_SUFFIX_CHAR_WITH_OVERFLOW): New enum
4585         value.
4586         (_STRTOL_ERROR): Handle it.  Abort when given unknown error codes.
4587         * xstrtoul.c (STRTOL_T_MINIMUM, STRTOL_T_MAXIMUM): New macros.
4588         * xstrtoumax.c (STRTOL_T_MINIMUM, STRTOL_T_MAXIMUM)
4589         [defined UINTMAX_MAX]: New macros.
4590
4591 2003-10-14  Bruno Haible  <bruno@clisp.org>
4592
4593         * fatal-signal.h: Improved comments. Suggested by Paul Eggert.
4594         * fatal-signal.c: Use sig_atomic_t. Suggested by Paul Eggert.
4595         Also use volatile where needed.
4596
4597 2003-10-12  Paul Eggert  <eggert@twinsun.com>
4598
4599         * xalloc.h (xnmalloc, xzalloc, xnrealloc, xclone): New decls.
4600         (XMALLOC, XCALLOC, XREALLOC, XFREE, CCLONE, CLONE): Deprecate,
4601         and define in terms of the other primitives.
4602         * xmalloc.c: Include stdbool.h; do not include exit.h.
4603         (SIZE_MAX): Define if not already defined.
4604         (array_size_overflow): New function.
4605         (xalloc_die): Abort instead of exiting if 'error' returns.
4606         (xnmalloc, xnrealloc, xzalloc, xclone): New functions.
4607         (xmalloc, xrealloc): Use them.
4608         (xcalloc): Check for address arithmetic overflow.
4609         * xstrdup.c (xstrdup): Use xclone, since memcpy should be
4610         a bit faster than strcpy.
4611
4612 2003-10-08  Paul Eggert  <eggert@twinsun.com>
4613
4614         Merge getpass from libc, plus a few fixes.
4615
4616         * getpass.c (HAVE_STDIO_EXT) [_LIBC]: Define to 1.
4617         Include <stdbool.h>.
4618         Include <stdio_ext.h> if HAVE_STDIO_H, otherwise define
4619         __fsetlocking to empty.
4620         [_LIBC]: Do not include "getline.h" or "unlocked-io.h", but
4621         do include <bits/libc-lock.h>.
4622         Do not include <fcntl.h>; not needed.
4623         [_LIBC]: Include <wchar.h>.
4624         (NOTCANCEL_MODE): New macro.
4625         (flockfile, funlockfile) [_LIBC]: New macros.
4626         (__libc_cleanup_push, __libc_cleanup_pop, __getline, __tcgetattr)
4627         [!_LIBC]: New macros.
4628         (call_fclose): New function.
4629         (getpass): Use it.  Save tty stream separately; this simplifies the
4630         code and makes it more reliable if stdin happens to equal stdout.
4631         Invoke __fsetlocking on tty.
4632         Handle thread cancellation if needed.
4633         Namespace cleanup (use __tcgetattr, __getline).
4634         Use bool for Booleans.
4635         [USE_IN_LIBIO]: Handle wide streams.
4636         [!_LIBC]: Unconditionally do the fseek, since we don't know what
4637         stream might go where.
4638
4639         * unlocked-io.h: Include <stdio.h>, so that the caller
4640         doesn't have to include <stdio.h> before us.
4641         (clearerr_unlocked, feof_unlocked, ferror_unlocked,
4642         fflush_unlocked, fgets_unlocked, fputc_unlocked, fputs_unlocked,
4643         fread_unlocked, fwrite_unlocked, getc_unlocked, getchar_unlocked,
4644         putc_unlocked, putchar_unlocked): Define to the unlocked counterpart
4645         if not declared, so that we can use getpass.c code from libc without
4646         rewriting it.
4647         (flockfile, ftrylockfile, funlockfile): New macros.
4648
4649 2003-10-06  Bruno Haible  <bruno@clisp.org>
4650
4651         * version-etc-2.h: Remove file.
4652         * version-etc-2.c: Remove file.
4653
4654 2003-09-25  Jim Meyering  <jim@meyering.net>
4655             Bruno Haible  <bruno@clisp.org>
4656
4657         This lets translators provide better translations for the
4658         "Written by ..." part of --version output.
4659         * version-etc.h: Include stdarg.h.
4660         (version_etc_copyright): Declare as readonly.
4661         (version_etc): Make this function variadic with a NULL-terminated list
4662         of author name strings.
4663         (version_etc_va): New declaration.
4664         * version-etc.c: Include stdarg.h, stdlib.h.
4665         (version_etc_copyright): Declare as readonly.
4666         (version_etc_va): New function. Provide a different translatable string
4667         for each possible number of authors < 10. Abbreviate when there are 10
4668         authors or more.
4669         (version_etc): Make this function variadic. Call version_etc_va.
4670         Suggestion from Gary V. Vaughan.
4671
4672         * long-options.h (parse_long_options): Change prototype: the authors
4673         string is moved to the end and becomes variadic.
4674         * long-options.c: Include stdarg.h.
4675         (parse_long_options): Make this function variadic, too.
4676         Call version_etc_va, not version_etc.
4677
4678 2003-10-06  Bruno Haible  <bruno@clisp.org>
4679
4680         * fatal-signal.h: New file, from GNU gettext.
4681         * fatal-signal.c: New file, from GNU gettext.
4682
4683 2003-10-04  Karl Berry  <karl@gnu.org>
4684
4685         * argp*: update from libc.
4686
4687 2003-10-01  Larry Jones  <lawrence.jones@eds.com>
4688
4689         * getpass.c (getpass): Use a no-op fseek when switching from input to
4690         output mode on the same stream.
4691
4692 2003-09-29  Paul Eggert  <eggert@twinsun.com>
4693
4694         * strftime.c (tm_diff) [! HAVE_TM_GMTOFF]:
4695         Fix arg typo in previous patch.
4696
4697 2003-09-28  Jim Meyering  <jim@meyering.net>
4698
4699         * error.c: Correct cpp indentation.
4700
4701 2003-09-27  Paul Eggert  <eggert@twinsun.com>
4702
4703         * minmax.h (MIN, MAX) [__STDC__ && defined __GNUC__ && __GNUC__ >= 2]:
4704         Omit the special code that used __typeof__, since we worry that
4705         it could be more trouble than it's worth.  See:
4706         http://mail.gnu.org/archive/html/bug-gnulib/2003-01/msg00090.html
4707         http://mail.gnu.org/archive/html/bug-gnulib/2003-01/msg00095.html
4708
4709         * free.c: New file.
4710
4711 2003-09-26  Jim Meyering  <jim@meyering.net>
4712
4713         * error.c (error_tail): Move some declarations
4714         into inner scope where the local variables are used.
4715
4716 2003-09-26  Bruno Haible  <bruno@clisp.org>
4717
4718         * stpncpy.h (gnu_stpncpy): New declaration.
4719         (stpncpy): Define as alias for gnu_stpncpy.
4720         * stpncpy.c [!_LIBC]: Define gnu_stpncpy, not stpncpy.
4721
4722 2003-09-26  Paul Eggert  <eggert@twinsun.com>
4723
4724         * error.c (SIZE_MAX) [!defined SIZE_MAX]: Define.
4725         (error_tail): Do not loop, reallocating temporary buffer, since
4726         the output cannot contain more wide characters than the input
4727         contains bytes, the size must be big enough already.  This avoids
4728         one potential size overflow calculation.  Check for size overflow
4729         when calculating temporary buffer size.  Free temporary buffer
4730         when done, if it was allocated with malloc; this plugs a memory
4731         leak.  Remove casts from void * to pointers, that are no longer
4732         needed now that we're assuming C89 or better.
4733
4734         Merge error changes from glibc.
4735
4736         * error.c, error.h: Update copyright notice header to match glibc.
4737         * error.c [defined _LIBC]: Include <errno.h>, <bits/libc-lock.h>.
4738         (error, error_at_line) [defined _LIBC && defined __libc_ptf_call]:
4739         Disable cancellation while printing error.
4740         * error.h: Prepend __ to parameter names.
4741
4742 2003-09-25  Karl Berry  <karl@gnu.org>
4743
4744         * argp-fmtstream.c, argp-help.c: update from libc.
4745
4746 2003-09-25  Bruno Haible  <bruno@clisp.org>
4747
4748         * version-etc-2.h: New file, from version-etc.h with modifications.
4749         * version-etc-2.c: New file, from version-etc.c with modifications.
4750
4751 2003-09-25  Simon Josefsson  <jas@extundo.com>
4752
4753         * xgetdomainname.h: New file.
4754         * xgetdomainname.c: New file.
4755
4756 2003-09-25  Simon Josefsson  <jas@extundo.com>
4757             Bruno Haible  <bruno@clisp.org>
4758
4759         * getdomainname.h: New file.
4760         * getdomainname.c: New file.
4761
4762 2003-09-24  Paul Eggert  <eggert@twinsun.com>
4763
4764         * linebuffer.c (freebuffer): Don't free the argument, just
4765         the buffer associated with the argument.  Bug reported by
4766         Simon Josefsson.
4767
4768 2003-09-19  Karl Berry  <karl@gnu.org>
4769
4770         * argp.h: update from libc.
4771
4772 2003-09-16  Paul Eggert  <eggert@twinsun.com>
4773
4774         * linebuffer.c (readlinebuffer): Return NULL immediately upon
4775         input error, instead of returning NULL the next time we are called
4776         (and therefore losing track of errno).
4777
4778 2003-09-15  Paul Eggert  <eggert@twinsun.com>
4779
4780         * getndelim2.c (getndelim2): Don't trash errno when a read
4781         fails, so that the caller gets the proper errno.
4782
4783         * readutmp.c (read_utmp): Likewise.
4784         Check for fstat error.  Close stream and free storage
4785         when failing.
4786
4787 2003-09-14  Bruno Haible  <bruno@clisp.org>
4788
4789         * fwriteerror.h: New file.
4790         * fwriteerror.c: New file.
4791
4792 2003-09-14  Jim Meyering  <jim@meyering.net>
4793
4794         * getloadavg.c: Correct cpp indentation.
4795         * strdup.c: Likewise.
4796         * vasnprintf.c: Likewise.
4797
4798 2003-09-12  Paul Eggert  <eggert@twinsun.com>
4799
4800         * argmatch.c, fatal.c, xgethostname.c, xmalloc.c: Include exit.h.
4801         * obstack.c [!defined _LIBC]: Likewise.
4802         * argmatch.c (EXIT_FAILURE): Remove; now done by exit.h
4803         * exitfail.c, fatal.c, xgethostname.c, xmalloc.c: Likewise.
4804         * exitfail.c: Don't include stdlib.h; no longer needed.
4805
4806         More changes to assume C89 or better.
4807
4808         * error.c (error_tail): Assume vprintf.
4809
4810         * argmatch.c (getenv): Remove decl.
4811         * progreloc.c (get_full_program_name): Define via prototype.
4812         * setenv.c (clearenv): Likewise.
4813         * stpncpy.c: Do not include <string.h> or <sys/types.h>; not
4814         needed.
4815         * strdup.c: Include <stdlib.h>, <string.h> unconditionally.
4816         (malloc, memcpy): Remove decls.
4817         * strftime.c (HAVE_LIMITS_H, STDC_HEADERS) [defined _LIBC]: Remove.
4818         (HAVE_MEMCPY) [defined emacs && !defined HAVE_BCOPY]: Remove.
4819         Include <limits.h>, <stddef.h>, <stdlib.h>, <string.h> unconditionally.
4820         (memcpy): Remove macro.
4821         (MEMCPY) [!defined COMPILE_WIDE]: Define to memcpy unconditionally.
4822         (__P): Remove.  All uses removed.
4823         (PTR): Remove.  All uses changed to void *.
4824         (CHAR_BIT, NULL): Remove.
4825         (spaces, zeros, memset_space, memset_zero)
4826         [!defined memset && !defined HAVE_MEMSET && !defined _LIBC]:
4827         Remove.
4828         (LOCALE_PARAM, LOCALE_PARAM_DECL): Remove.
4829         (memcpy_lowcase, memcpy_uppcase, tm_diff, iso_week_days):
4830         Define with prototype.
4831         Remove now-unnecessary prototype decl.
4832         (extra_args_spec): Assume ANSI C.  All uses changed.
4833         (extra_args_spec_iso): Remove.
4834         (my_strftime, emacs_strftimeu): Define via prototype.
4835         * strtod.c: Include <float.h>, <stdlib.h>, <string.h>
4836         unconditionally.
4837         (DBL_MAX, DBL_MIN, HUGE_VAL, NULL): Remove decls.
4838         * strtoimax.c: Include <stdlib.h> unconditionally.
4839         (strtoul, strtol): Remove decls.
4840         * strtol.c (STDC_HEADERS, HAVE_LIMITS_H, NULL, ULONG_MAX,
4841         LONG_MAX): Remove.
4842         Include <limits.h>, <stddef.h>, <stdlib.h>, <string.h> unconditionally.
4843         (LOCALE_PARAM_DECL): Remove.  All uses changed to LOCALE_PARAM_PROTO.
4844         (LOCALE_PARAM_PROTO): New macro.
4845         (INTERNAL, INTERNAL1, WEAKNAME): Assume ANSI C, not K&R.
4846         (INTERNAL (strtol), strtol): Define with a prototype.
4847         (PARAMS): Remove.  All uses removed.
4848         * tempname.c: Include <string.h> unconditionally.
4849         * userspec.c: Include <stdlib.h>, <string.h> unconditionally.
4850         * xgethostname.c (main): Define with a prototype.
4851         * xmalloc.c: Include "xalloc.h" first, to check interface.
4852         Include <stdlib.h> unconditionally.
4853         (calloc, malloc, realloc, free): Remove decls.
4854         * xstrtod.c: Include "xstrtod.h" first, to check interface.
4855         Include <stdlib.h> unconditionally.  Sort include file names.
4856         (strtod): Remove.
4857         (xstrtod): Define with a prototype.
4858         * xstrtol.c: Include <stdlib.h>, <string.h> unconditionally.
4859         (strtol, strtoul): Remove decls.
4860
4861 2003-09-11  Paul Eggert  <eggert@twinsun.com>
4862
4863         * strndup.c: Don't include <stdio.h>, <sys/types.h>.
4864         Include <stdlib.h>, <string.h> unconditionally.
4865         Remove now-unnecessary cast to char *.
4866         * strnlen.c: Include <string.h> unconditionally.
4867         * yesno.c (yesno): Define with a prototype.
4868
4869 2003-09-10  Bruno Haible  <bruno@clisp.org>
4870
4871         * strcspn.c: Include <string.h> unconditionally.
4872         * strpbrk.c: Include <string.h> unconditionally.
4873         * strstr.c: Include <string.h> unconditionally.
4874         * unicodeio.c: Include <string.h> unconditionally.
4875         * setenv.c: Include <stdlib.h> and <string.h> unconditionally.
4876         * unsetenv.c: Likewise.
4877         * xreadlink.c: Include <stdlib.h> unconditionally.
4878         * yesno.c: Include <stdlib.h> unconditionally.
4879         (rpmatch): Add prototype.
4880
4881 2003-09-10  Jim Meyering  <jim@meyering.net>
4882
4883         * error.c: Correct indentation of cpp directives.
4884
4885 2003-09-09  Paul Eggert  <eggert@twinsun.com>
4886
4887         More K&R removal.
4888
4889         * acosl.c (main): Use a prototype.
4890         * asinl.c, cosl.c, expl.c, frexpl.c, ldexpl.c, sinl.c,
4891         tanl.c: Likewise.
4892
4893         * getloadavg.c (getloadavg, main): Define via prototypes.
4894
4895         * getopt.h (struct option.name): Assume C89, and use 'const'.
4896         (getopt, etopt_long, getopt_long_only, _getopt_internal)
4897         [defined __GNU_LIBRARY__]: Assume C89, so we can always declare
4898         with a prototype.
4899         * getopt.c (const): Remove macro.
4900         Include <string.h> unconditionally.
4901         (my_index): Remove; all uses changed to strchr.
4902         (strlen): Remove decl.
4903         (exchange): Remove forward decl; no longer needed.
4904         (exchange, _getopt_initialize, _getopt_internal, getopt, main):
4905         Define with prototype.
4906         * getopt1.c (const): Remove macro.
4907         (getopt_long, getopt_long_only, main): Define with prototype.
4908
4909         * getugroups.c: Include <string.h> unconditionally.
4910
4911         * getusershell.c: Include <stdlib.h> unconditionally.
4912         (getusershell, setusershell, endusershell, readname, main):
4913         Define with prototypes.
4914
4915         * group-member.c: Include group-member.h first.
4916         Include <stdlib.h> unconditionally.
4917
4918         * hard-locale.c: Include hard-locale.h first.
4919         Include <stdlib.h>, <string.h> unconditionally.
4920
4921         * hash.c (free, malloc): Remove decls.
4922         Include <stdlib.h> unconditionally.
4923
4924         * human.c: Include <stdlib.h>, <string.h> unconditionally.
4925         (getenv): Do not declare.
4926
4927         * idcache.c: Include <string.h> unconditionally.
4928
4929         * long-options.c: Include long-options.h first, to test interface.
4930         Include <stdlib.h> unconditionally.
4931
4932         * makepath.c: Include makepath.h first, to test interface.
4933         Include <stdlib.h> and <string.h> unconditionally.
4934
4935         * linebuffer.c: Include <stdlib.h>.
4936         (free): Remove decl.
4937
4938         * malloc.c: Include <stdlib.h>, for malloc; don't bother with stddef.h.
4939         rpl_malloc returns void *, not char *.
4940         * realloc.c (rpl_realloc): Likewise.  Also, define with a prototype.
4941
4942         * md5.h: Include <limits.h> unconditionally.
4943         (UINT_MAX_32_BITS): Don't worry about non-__STDC__ case.
4944         (__P): Remove; all uses removed.
4945         * md5.c: Include "md5.h" first.
4946         (md5_init_ctx, md5_read_ctx, md5_finish_ctx, md5_stream,
4947         md5_buffer, md5_process_bytes, md5_process_block):
4948         Define with prototypes.
4949         * sha.h (__P): Remove all uses.  (It wasn't defined??)
4950         * sha.c: Include "sha.h" first.
4951         Include <stdlib.h>, <string.h> unconditionally.
4952
4953         * memchr.c (__ptr_t): Remove; all uses changed to void *.
4954         * memcmp.c (__ptr_t): Likewise.
4955         * memrchr.c (__ptr_t): Likewise.
4956         * memchr.c, memcmp.c, memcoll.c, memrchr.c:
4957         Include <string.h> unconditionally.
4958         * memchr.c, memrchr.c: Include <limits.h> unconditionally.
4959         * memchr.c: Include <stdlib.h> unconditionally.
4960         * memchr.c (LONG_MAX): Remove.
4961         * memrchr.c (LONG_MAX): Likewise.
4962         * memchr.c (__memchr): Define via a prototype.
4963         * memrchr.c (__memrchr): Likewise.
4964         * memcmp.c (__P): Remove, and remove all uses.
4965         (memcmp_bytes, memcmp_common_alignment, memcmp_not_common_alignment):
4966         Remove forward decls; no longer needed.
4967         * memcpy.c, memmove.c, memset.c: Include <stddef.h>.
4968         Use types required by C89 in prototype.
4969
4970         * mkdir.c: Include <stdlib.h>, <string.h> unconditionally.
4971         * savedir.c: Likewise.
4972         * mkdir.c (free): Remove decl.
4973         * rmdir.c (rmdir): Define with a prototype.
4974         * savedir.c: Include savedir.h first, to test interface.
4975
4976         * mktime.c (STDC_HEADERS): Remove.
4977         Include <stdlib.h>, <string.h> unconditionally.
4978
4979         * modechange.c: Include <stdlib.h> unconditionally.
4980         (malloc): Remove decl.
4981
4982         * mountlist.c: Include <stdlib.h>, <string.h> unconditionally.
4983         (free): Remove decl.
4984
4985         * obstack.h (PTR_INT_TYPE) [!defined __PTRDIFF_TYPE__]:
4986         Define to ptrdiff_t, without bothering to check HAVE_STDDEF_H.
4987         (This type really should be intptr_t, but that's a C99ism.)
4988         (_obstack_memcpy): Remove: all uses changed to memcpy.
4989         Include <string.h> unconditionally.
4990         (struct obstack): Assume __STDC__ for types of members
4991         chunkfun, freefun, extra_arg.
4992         (_obstack_newchunk, _obstack_free, _obstack_begin, _obstack_begin_1,
4993         _obstack_memory_used, obstack_alloc_failed_handler, obstack_init,
4994         obstack_begin, obstack_specify_allocation,
4995         obstack_specify_allocation_with_arg, obstack_chunkfun,
4996         obstack_freefun, obstack_free) [! (defined __STDC__ && __STDC__)]:
4997         Remove unprototyped decls and the macros that use them.
4998         * obstack.c (POINTER): Remove.  All uses changed to void *.
4999         (obstack_alloc_failed_handler, CALL_CHUNKFUN, CALL_FREEFUN,
5000         _obstack_begin, _obstack_begin_1, _obstack_allocated_p)
5001         (defined __STDC__ && __STDC__)]:
5002         Remove nonprototyped code.
5003         Include <stdlib.h> unconditionally.
5004         (_obstack_begin, _obstack_begin_1, _obstack_newchunk,
5005         _obstack_allocated_p, _obstack_free, obstack_free,
5006         _obstack_memory_used, print_and_abort):
5007         Define using prototypes.
5008         (obstack_1grow, obstack_1grow_fast, obstack_alloc, obstack_base,
5009         obstack_blank, obstack_blank_fast, obstack_copy, obstack_copy0,
5010         obstack_finish, obstack_grow, obstack_grow0, obstack_make_room,
5011         obstack_next_free, obstack_object_size, obstack_room) [0]:
5012         Remove unused, unprototyped code.
5013
5014         * path-concat.c: Include <stdlib.h>, <string.h> unconditionally.
5015
5016         * physmem.c (physmem_total, physmem_available, main): Define
5017         with prototypes.
5018
5019         * posixtm.c: Include <stdlib.h>, <string.h> unconditionally.
5020         (main): Define with a prototype.
5021
5022         * posixver.c (getenv): Remove decl.
5023
5024         * putenv.c (malloc): Returns void *, not char *.
5025         Include <string.h> unconditionally.
5026         (strchr, memcpy, NULL): Do not define.
5027
5028         * readtokens.c: Include readtokens.h first, to test interface.
5029         Include <stdlib.h>, <string.h> unconditionally.
5030         (init_tokenbuffer): Define with a prototype.
5031
5032         * regex.c (PARAMS): Remove.  All uses removed.
5033         All uses of _RE_ARGS removed, too.
5034         Include <stddef.h>, <stdlib.h>, <string.h>, <limits.h>
5035         unconditionally.
5036         (bzero): Assume memset exists.
5037         (memcmp, memcpy, NULL): Remove.
5038         (SIGN_EXTEND_CHAR): Remove; all uses replaced by casts to signed
5039         char, or assignments to local vars of type signed char.
5040         (init_syntax_once, PREFIX(extract_number_and_incr),
5041         PREFIX(print_partial_compiled_pattern),
5042         PREFIX(print_compiled_pattern), PREFIX(print_double_string),
5043         convert_mbs_to_wcs, print_fastmap, re_set_syntax,
5044         PREFIX(regex_grow_registers), PREFIX(regex_compile),
5045         PREFIX(store_op1), PREFIX(store_op2), PREFIX(insert_op1),
5046         PREFIX(insert_op2), PREFIX(at_begline_loc_p),
5047         PREFIX(at_endline_loc_p), group_in_compile_stack, insert_space,
5048         wcs_compile_range, byte_compile_range, truncate_wchar,
5049         PREFIX(re_compile_fastmap), re_compile_fastmap, re_set_registers,
5050         re_search, re_search_2, PREFIX(re_search_2), re_match, re_match_2,
5051         count_mbs_length, wcs_re_match_2_internal,
5052         byte_re_match_2_internal, PREFIX(group_match_null_string_p),
5053         PREFIX(alt_match_null_string_p),
5054         PREFIX(common_op_match_null_string_p), PREFIX(bcmp_translate),
5055         re_compile_pattern, re_comp, re_exec, regcomp, regexec, regerror,
5056         regfree, PREFIX(extract_number)): Define with prototype.  Remove
5057         now-unnecessary declaration, if any.
5058         (byte_compile_range, PREFIX(regex_compile), re_comp, re_exec,
5059         regcomp, regexec):
5060         Remove now-unnecessary casts among pointer types.
5061         * regex.h (_RE_ARGS): Remove.  All uses removed.
5062
5063         * rename.c: Include <stdlib.h>, <string.h> unconditionally.
5064         (free): Remove decl.
5065
5066         * rpmatch.c: Include <stdlib.h> unconditionally.
5067
5068         * same.c: Include <stdlib.h>, <string.h> unconditionally.
5069         (free): Remove decl.
5070
5071         * save-cwd.c: Include <stdlib.h> unconditionally.
5072         * xgetcwd.c: Likewise.
5073
5074         * stat.c: Include <stdlib.h>, <string.h> unconditionally.
5075         (free): Remove decl.
5076
5077         * strchrnul.c (strchrnul): Define with a prototype.
5078         Fix bug: c_in was not converted to char before searching.
5079
5080         The following changes are not K&R related:
5081
5082         * group-member.h: Include <sys/types.h>, so that this file is
5083         self-contained.
5084         * makepath.h: Likewise.
5085
5086         * getusershell.c (readname, default_index, line_size, readname):
5087         Use size_t, not int, for sizes.
5088         (readname): If the size overflows, report an error instead of
5089         looping forever.
5090
5091 2003-09-09  Derek Robert Price  <derek@ximbiot.com>
5092
5093         * getndelim2.c: Assume stdlib.h per the C89 spec.
5094
5095 2003-09-08  Paul Eggert  <eggert@twinsun.com>
5096
5097         Assume C89 or better; remove K&R cruft.
5098         A few of these changes were first proposed by Derek Robert Price
5099         in <http://mail.gnu.org/archive/html/bug-gnulib/2003-07/msg00105.html>.
5100
5101         * addext.c: Include <string.h> unconditionally.
5102         * backupfile.c: Include <string.h>, <stdlib.h> unconditionally.
5103         Don't declare getenv or malloc.
5104
5105         * alloca.c: Include <string.h>, <stdlib.h> unconditionally.
5106         (POINTER_TYPE, pointer): Remove; all uses changed to void *.
5107         (NULL): Remove.
5108         (find_stack_direction, alloca): Use prototypes.
5109
5110         * atexit.c (atexit): Define using a prototype.
5111
5112         * basename.c, dirname.c, stripslash.c:
5113         Include <string.h> unconditionally.
5114
5115         * bcopy.c: Include <stddef.h>.
5116         (bcopy): Define with prototype, using 'const' and 'void' and 'size_t'.
5117
5118         * canon-host.c: Include <stdlib.h>, <string.h> unconditionally.
5119
5120         * error.h (error, error_at_line, error_print_progname)
5121         [! (defined (__STDC__) && __STDC__)]: Remove decls.
5122         * error.c: Include error.h first, to check interface.
5123         Include <stdarg.h>, <stdlib.h>, <string.h> unconditionally.
5124         (VA_START): Remove; all uses changeed to va_start.
5125         (exit, strerror): Remove decls.
5126         (error_print_progname): Prototype uncondionally.
5127         Don't include <errno.h>; no longer needed.
5128         (private_strerror): Remove.
5129         (error_tail): Always define.
5130         (error, error_at_line): Assume C89 or better; always use prototypes.
5131         * fatal.c: Include "fatal.h" first, to test interface.
5132         Include <stdarg.h>, <stdlib.h>, <string.h> unconditionally.
5133         (VA_START): Remove; all uses changed to va_start.
5134         [! (HAVE_VPRINTF || HAVE_DOPRNT || _LIBC)]: Remove support for
5135         this case.
5136         (exit): Remove decl.
5137         (fatal): Prototype unconditionally.  Assume va_start works.
5138         Abort at end, to pacify gcc.
5139
5140         * euidaccess.c (main): Define with a prototype.
5141
5142         * exclude.c: Include <stdlib.h>, <string.h> unconditionally.
5143
5144         * exitfail.c: Include <stdlib.h> unconditionally.
5145
5146         * fnmatch_.h (__P): Remove.  All uses changed to assume
5147         prototypes.
5148         * fnmatch.c: Include fnmatch.h first, to test interface.
5149         Include <string.h>, <stddef.h>, <stdlib.h> unconditionally.
5150         (getenv): Remove decl.
5151         (fnmatch): Define using a prototype.
5152         * fnmatch_loop.c (FCT): Remove forward decl; no longer needed.
5153         (FCT): Define using a prototype.
5154
5155         * getdate.y: Include <stdlib.h>, <string.h> unconditionally.
5156
5157         * gethostname.c: Include <stddef.h>.
5158         (gethostname): Define with prototype.  Length is size_t, not int.
5159
5160 2003-09-08  Paul Eggert  <eggert@twinsun.com>
5161
5162         * getversion.c: Remove; was migrated to backupfile.c in 1997.
5163         getversion.c should have been removed then, but was accidentally
5164         preserved.
5165
5166         * utime.c [!HAVE_UTIMES_NULL]: Include <sys/stat.h>, <fcntl.h>.
5167         (utime_null): Fix typo: 'st' was sometimes called 'sb'.
5168
5169 2003-09-07  Paul Eggert  <eggert@twinsun.com>
5170
5171         * time_r.c (gmtime_r, localtime_r): Fix silly typo: missing arg to
5172         copy_tm_result.  Bug reported by Simon Josefsson in
5173         <http://mail.gnu.org/archive/html/bug-gnulib/2003-09/msg00028.html>.
5174
5175 2003-09-06  Paul Eggert  <eggert@twinsun.com>
5176
5177         * time_r.c, time_r.h: New files.
5178
5179         * mktime.c (my_mktime_localtime_r): Remove; all uses changed to
5180         __localtime_r.
5181         (__localtime_r) [!defined _LIBC]: New macro.  Include <time_r.h>.
5182         (__mktime_internal) [!defined _LIBC]: Now extern, not static.
5183
5184         * strftime.c (my_strftime_gmtime_r): Remove; all uses changed to
5185         __gmtime_r.
5186         (my_strftime_localtime_r): Remove; all uses changed to __localtime_r.
5187         (__gtime_r, __localtime_r) [!HAVE_TM_GMTOFF]: New macros.
5188         Include <time_r.h>.
5189
5190         * timegm.c: Switch to glibc implementation, with the following changes:
5191         [defined HAVE_CONFIG_H]: Include <config.h>.
5192         [!defined _LIBC]: Include "timegm.h" rather than <time.h>.
5193         (__mktime_internal) [!defined _LIBC]: New decl.
5194         (__gmtime_r) [!defined _LIBC]: New macro and function.
5195         (timegm): Use a prototype, since gnulib assumes C89.
5196         Do not bother declaring tmp to be const, as it's not really usefu.
5197         * timegm.h: Hoist "#include <time.h>" out of #ifdef.
5198         (timegm): Declare only if HAVE_DECL_TIMEGM.
5199
5200 2003-09-03  Paul Eggert  <eggert@twinsun.com>
5201
5202         * human.c (human_readable): Fix bug that rounded 10501 to 10k.
5203         Bug reported by Lute Kamstra in
5204         <http://mail.gnu.org/archive/html/bug-gnulib/2003-09/msg00003.html>.
5205
5206         * getdate.y (relative_time_table): Use tDAY_UNIT for "tomorrow",
5207         "yesterday", "today", and "now" rather than tMINUTE_UNIT.  Of
5208         course with correspondingly smaller numbers for tomorrow and
5209         yesterday.  From Tadayoshi Funaba.  Originally installed into
5210         sh-utils on 1999-08-07, but the patch got lost (I guess during the
5211         coreutils merge?).
5212
5213 2003-08-31  Simon Josefsson  <jas@extundo.com>
5214
5215         * timegm.h: New file.
5216         * timegm.c: New file.  Based on wget-1.8.2/src/http.c:mktime_from_utc.
5217
5218 2003-08-31  Karl Berry  <karl@gnu.org>
5219
5220         * argp.h: update from libc.
5221
5222 2003-08-28  Bruno Haible  <bruno@clisp.org>
5223
5224         * binary-io.h: Undefine O_BINARY before defining it. This avoids a
5225         warning on QNX, which defines O_BINARY to 000000.
5226
5227 2003-08-24  Bruno Haible  <bruno@clisp.org>
5228
5229         * binary-io.h: Include <stdio.h>, to avoid a compilation error when
5230         MSVC7 <stdio.h> is included later.
5231
5232 2003-08-20  Bruno Haible  <bruno@clisp.org>
5233
5234         * progname.h: New file, from GNU gettext.
5235         * progname.c: New file, from GNU gettext.
5236         * progreloc.c: New file, from GNU gettext.
5237
5238 2003-08-19  Bruno Haible  <bruno@clisp.org>
5239
5240         * xstrdup.c: Assume <string.h> exists.
5241
5242 2003-08-18  Jim Meyering  <jim@meyering.net>
5243
5244         * setenv.h: Indent nested cpp directive.
5245         * vasnprintf.c: Remove trailing blanks.
5246
5247 2003-08-17  Simon Josefsson  <jas@extundo.com>
5248             Bruno Haible  <bruno@clisp.org>
5249
5250         * xstrndup.h: New file.
5251         * xstrndup.c: New file.
5252
5253 2003-08-17  Bruno Haible  <bruno@clisp.org>
5254
5255         * strndup.h: New file.
5256
5257 2003-08-16  Paul Eggert  <eggert@twinsun.com>
5258
5259         * regex.h, strdup.c, strtoll.c, strtoul.c: Do not normalize white
5260         space, undoing this 2003-08-12 change:
5261         <http://mail.gnu.org/archive/html/bug-gnulib/2003-08/msg00080.html>
5262
5263 2003-08-16  Jim Meyering  <jim@meyering.net>
5264
5265         Merge from coreutils.
5266         * xstrtoimax.c: #else #if -> #elif.
5267         * xstrtoumax.c: Likewise.
5268
5269 2003-08-15  Paul Eggert  <eggert@twinsun.com>
5270
5271         * config.charset, ref-add.sin, ref-del.sin: Use three spaces,
5272         rather than tab, after '#' in shell-script copyright notices.
5273         Suggested by Bruno Haible.
5274
5275 2003-08-15  Jim Meyering  <jim@meyering.net>
5276         and Paul Eggert  <eggert@twinsun.com>
5277
5278         Merge from coreutils.
5279         * readutmp.h (HAVE_UTMPX_H): Undef if struct utmp has the ut_exit
5280         member but strut utmpx does not.  Needed for AIX 4.3.3.
5281         (UT_EXIT_E_TERMINATION, UT_EXIT_E_EXIT): Define.
5282
5283 2003-08-15  Jim Meyering  <jim@meyering.net>
5284
5285         Merge from coreutils.
5286         * xgethostname.c: Include <stdlib.h>.
5287         (xghostname): Don't exit for anything other than memory-related
5288         failure; just return NULL.
5289         * userspec.c: Include "posixver.h".
5290         (parse_user_spec): Accept `.' as a separator only
5291         in pre-POSIX-200112 mode.
5292         * strtoimax.c: Use #elif rather than #else #if.
5293         * strftime.c (my_strftime) [!_LIBC && HAVE_TZNAME && HAVE_TZSET]:
5294         Remove function, now that we can rely on a working tzset function.
5295         [!_LIBC]: Ensure that the required autoconf test has been run.
5296         [!defined _NL_CURRENT && HAVE_STRFTIME]:
5297         Use underlying_strftime for %r.
5298         * sha.c: Merge in some clean-up and optimization changes from glibc.
5299         * sha.c (sha_stream) [BLOCKSIZE]: Move definition to top of file.
5300         Ensure that it is a multiple of 64.
5301         Rearrange loop exit tests so as to avoid performing an
5302         additional fread after encountering an error or EOF.
5303         * realloc.c: Update copyright date.
5304
5305 2003-08-14  Jim Meyering  <jim@meyering.net>
5306
5307         Merge from coreutils.
5308         * obstack.h: Whitespace changes.
5309         * mountlist.c: Remove anachronistic casts of xmalloc, xrealloc,
5310         and xcalloc return values.
5311         (read_filesystem_list) [MOUNTED_GETFSSTAT]:
5312         Use MNT_NOWAIT, rather than MNT_WAIT.  Otherwise, `df DIR' could
5313         hang on OSF/1 5.1 for DIR on both local and remote file systems.
5314         Reported by (and fix confirmed by) Nelson H. F. Beebe.
5315         (read_filesystem_list) [MOUNTED_VMOUNT]: Detect any
5316         error from mntctl.
5317         Use mntctl's return value to drive the entry-processing loop, since
5318         we can't rely on the value of the vmt_length member in the last
5319         entry.  On some systems doing so could result in exhausting
5320         virtual memory.  Based in part on a patch from Mike Jetzer.
5321
5322 2003-08-14  Jim Meyering  <jim@meyering.net>
5323         and Paul Eggert  <eggert@twinsun.com>
5324
5325         Merges from coreutils, plus other fixes.
5326         * physmem.c: Merge in portability changes from gcc/libiberty
5327         to support AIX, IRIX, Tru64, and Windows.  See the ChangeLog there
5328         for credits and details.  Thanks to Kaveh Ghazi for helping
5329         to keep these files in sync.
5330         (ARRAY_SIZE): Define it.
5331         (physmem_total, physmem_available): Add comments. From Kaveh Ghazi.
5332         * memcasecmp.c: Remove unnecessary parentheses after 'defined'.
5333         (memcasecmp): Don't assume size_t fits in unsigned int.
5334         Remove casts and duplicate code.
5335         * md5.c: Include <string.h> and <stdlib.h> unconditionally.
5336         (memcpy): Remove definition.
5337         Merge in some clean-up and optimization changes from glibc.
5338         [BLOCKSIZE]: Move definition to top of file.
5339         Ensure that it is a multiple of 64.
5340         Rearrange loop exit tests so as to avoid performing an
5341         additional fread after encountering an error or EOF.
5342         * md5.h (md5_uintptr): Define.
5343         * makepath.c (CLEANUP_CWD): Report an error if we failed to
5344         return to the initial working directory.  Preserve errno
5345         for caller.
5346         * idcache.c: Include "xalloc.h".
5347         (xmalloc, xrealloc): Remove decls.
5348         (getuser): Remove casts no longer required in C89.
5349         * human.c: Include stdio.h, for sprintf.
5350         * group-member.c: Include "xalloc.h".
5351         (xmalloc, xrealloc): Remove decls.
5352         (get_group_info): Remove casts no longer required in C89.
5353         * getusershell.c (readname): Remove casts no longer required in C89.
5354         * gettimeofday.c (rpl_gmtime, rpl_tzset): New functions.
5355         * getline.c: Whitespace fix, from coreutils.
5356
5357 2003-08-13  Paul Eggert  <eggert@twinsun.com>
5358
5359         * exclude.c: Include <ctype.h>
5360         (IN_CTYPE_DOMAIN): New macro.
5361         (is_space): New fn.
5362         (add_exclude_file): If LINE_END is a space, ignore trailing spaces
5363         and empty lines.
5364
5365         * argp-help.c, argp-parse.c, config.charset, getopt.h:
5366         Undo previous (whitespace-only) change.
5367
5368 2003-08-12  Paul Eggert  <eggert@twinsun.com>
5369
5370         * argp-help.c, argp-parse.c, config.charset, getopt.h:
5371         Normalize leading white space and remove trailing white space.
5372         * ref-add.sin, ref-del.sin: Use '#' before empty line in copyright
5373         notice, as per ../config/srclist-update.
5374
5375         Merge from coreutils.
5376         * euidaccess.h: New file.
5377         * euidaccess.c: Include it.
5378         * .cppi-disable: Add printf-args.h, printf-parse.h, stdbool_.h,
5379         vasnprintf.h, vasprintf.h.  Remove strdup.c, gettext.h.
5380         * regex.h, strdup.c, strtoll.c, strtoul.c: Normalize white space.
5381
5382 2003-08-11  Bruno Haible  <bruno@clisp.org>
5383
5384         * vasnprintf.c (local_wcslen): New function, for Solaris 2.5.1.
5385         (vasnprintf): Use it instead of wcslen.
5386
5387 2003-08-11  Bruno Haible  <bruno@clisp.org>
5388
5389         * stdbool_.h (_Bool): Undo last change; instead use a negative enum
5390         value to ensure that _Bool promotes to int. Use #define for _Bool when
5391         using the Solaris C compiler. Adds comments suggested by Paul Eggert.
5392
5393 2003-08-10  Karl Berry  <karl@gnu.org>
5394
5395         * regex.h: update from libc (whitespace fix).
5396
5397 2003-08-09  Paul Eggert  <eggert@twinsun.com>
5398
5399         Merge some files from coreutils.  These changes were
5400         originally made by Jim Meyering.
5401         * acl.c: Include <sys/types.h> before <sys/stat.h>;
5402         many older Unixes require this.
5403         * alloca.c (alloca): Remove cast to argument of free;
5404         no longer needed in C89.
5405         * alloca_.h, regex.h: Fix white space to match
5406         what GNU indent does.
5407
5408 2003-08-05  Paul Eggert  <eggert@twinsun.com>
5409
5410         * bumpalloc.h: Remove.
5411
5412 2003-08-04  Paul Eggert  <eggert@twinsun.com>
5413
5414         * getloadavg.c: Change copyright notice and spacing to conform to
5415         GNU coding style.
5416
5417         Merge from coreutils.
5418         * error.c [!USE_IN_LIBIO]: Omit this case; assume USE_IN_LIBIO is 1.
5419         From glibc.
5420         * getdate.y (date): Also accept dates like May-23-2003; suggestion
5421         from Karl Berry, implemented by Jim Meyering.
5422         * getgroups.c: Include "xalloc.h" instead of declaring xalloc fns;
5423         from Dmitry V. Levin.
5424         Remove anachronistic cast of xrealloc.
5425         * fnmatch_.h (__const): Remove.  Use 'const'.
5426         * fnmatch_loop.c (NEW_PATTERN): Cast alloca return value to proper
5427         type. Otherwise, it wouldn't compile with at least /bin/cc on
5428         ymp-cray-unicos9.0.2.X.
5429         Combine two mostly-identical uses of alloca into one.
5430         Thanks to the Cray-Cyber project for access to a Cray Y-MP.
5431
5432 2003-08-04  Dave Love <d.love@dl.ac.uk>
5433
5434         [From Emacs.]
5435
5436         * getloadavg.c: Check `__unix' as well as `unix'.  Use #ifdef, not
5437         #if.  Check HAVE_LIBKSTAT as well as LOAD_AVE_TYPE.  Check
5438         F_SETFD, not FD_SETFD.  Use HAVE_STRUCT_NLIST_N_UN_N_NAME, not
5439         obsolete NLIST_NAME_UNION.
5440         [__GNU__]: Undef BSD and FSCALE.
5441         [!NLIST_STRUCT]: Remove conditional definition of NLIST_STRUCT.
5442
5443 2003-08-03  Paul Eggert  <eggert@twinsun.com>
5444
5445         * stdbool_.h (_Bool): Make it signed char, instead of
5446         an enum type, so that it's guaranteed to promote to int.  See:
5447         <http://mail.gnu.org/archive/html/bug-gnulib/2003-07/msg00124.html>
5448
5449 2003-07-31  Paul Eggert  <eggert@twinsun.com>
5450
5451         * strerror.c: Include config.h, limits.h.  Declare sprintf.
5452         (strerror): Don't assume that a printable int fits in 14 bytes.
5453
5454 2003-07-24  Derek Robert Price  <derek@ximbiot.com>
5455             Bruno Haible  <bruno@clisp.org>
5456
5457         * getline.h (getline, getdelim): Change return type to ssize_t.
5458         * getline.c (getline, getdelim): Likewise.
5459         Remove _GNU_SOURCE define; now it's defined in config.h through
5460         m4/getline.m4.
5461
5462 2003-07-22  Paul Eggert  <eggert@twinsun.com>
5463
5464         * xalloc.h (XCALLOC, XREALLOC, CCLONE): Fix under- and
5465         over-parenthesization in macros.
5466
5467         Sync with coreutils.
5468
5469         * xalloc.h (XMALLOC, XCALLOC, XREALLOC): Remove casts not
5470         required by C99.
5471
5472         Use `exit_failure' for xalloc and xmemcoll instead of their own
5473         private exit-failure variables.
5474         * xalloc.h (xalloc_exit_failure): Remove.
5475         * xmalloc.c: Likewise.  Include exitfail.h.
5476         (xalloc_die): Use exit_failure instead of xalloc_exit_failure.
5477         * xmemcoll.h (xmemcoll_exit_failure): Remove.
5478         * xmemcoll.c: Likewise.  Include exitfail.h.
5479         (xmemcoll): Use exit_failure instead of xalloc_exit_failure.
5480
5481 2003-07-18  Paul Eggert  <eggert@twinsun.com>
5482
5483         * closeout.h (close_stdout_set_status, close_stdout_status): Remove.
5484         * closeout.c: Likewise.  Include "closeout.h" right after config.h,
5485         to test that it can stand by itself.  Include "exitfail.h".
5486         Clients should set exit_failure instead.
5487         (EXIT_FAILURE): Remove; no longer needed.  Do not include <stdlib.h>.
5488
5489 2003-07-18  Andreas Schwab  <schwab@suse.de>
5490
5491         * memcoll.c (memcoll) [!HAVE_STRCOLL]: Clear errno.
5492
5493 2003-07-18  Bruno Haible  <bruno@clisp.org>
5494
5495         * getndelim2.h: New file.
5496         * getndelim2.c: Make into a module of its own. Include config.h,
5497         getndelim2.h.
5498         (getndelim2): Make non-static. Change return type to ssize_t.
5499         * getline.h: Change argument names.
5500         * getline.c: Include getndelim2.h instead of getndelim2.c.
5501         * getnline.c: Include getndelim2.h.
5502
5503 2003-07-17  Bruno Haible  <bruno@clisp.org>
5504
5505         * Makefile.am: Remove file.
5506         * Makefile.in: Remove file.
5507
5508 2003-07-17  Bruno Haible  <bruno@clisp.org>
5509
5510         * getnline.h: New file.
5511         * getnline.c: New file.
5512         * getndelim2.c: New file, extracted from getline.c.
5513         (getndelim2): Renamed from getdelim2, with added nmax argument.
5514         * getline.c: Include getndelim2.c.
5515         (getdelim2): Moved out to getndelim2.c.
5516         (getline, getdelim): Update.
5517
5518 2003-07-15    <karl@gnu.org>
5519
5520         * vasnprintf.c: update from gettext.
5521
5522 2003-07-15  Jim Meyering  <jim@meyering.net>
5523
5524         * makepath.c (make_path): Enclose diagnostic in _(...).
5525
5526 2003-07-14  Paul Eggert  <eggert@twinsun.com>
5527
5528         * asnprintf.c, asprintf.c, config.charset, gettext.h,
5529         localcharset.c, localcharset.h, mkdtemp.c, printf-args.c,
5530         printf-args.h, printf-parse.c, printf-parse.h, ref-add.sin,
5531         ref-del.sin, setenv.c, unsetenv.c, vasnprintf.c, vasnprintf.h,
5532         vasprintf.c, vasprintf.h: Regenerate.  These files are now being
5533         updated automatically by ../config/srclist-update.  This changes
5534         their license from LPGL to GPL.
5535
5536 2003-07-14  Jim Meyering  <jim@meyering.net>
5537
5538         Don't emit diagnostics.  Let callers do that.
5539         * save-cwd.c: Don't include "error.h".
5540         (save_cwd): Don't call error.  Ensure that errno is valid
5541         when returning nonzero.
5542
5543         * save-cwd.h (restore_cwd): Update prototype.
5544         * save-cwd.c (restore_cwd): Remove two parameters.
5545         Simplify.  Don't call error upon failure.  Let callers do that.
5546         (save_cwd): Mention that Irix 5.3 has the same problem as SunOS 4
5547         when auditing is enabled.  But don't bother updating the #if.
5548
5549 2003-07-14  Simon Josefsson  <jas@extundo.com>
5550
5551         * mempcpy.h: New file.
5552         * mempcpy.c: New file.
5553
5554 2003-07-14  Paul Eggert  <eggert@twinsun.com>
5555
5556         * ceill.c, expl.c, floorl.c, frexpl.c, ldexpl.c, mathl.h,
5557         sincosl.c, sqrtl.c, trigl.c, trigl.h, poll.c, poll_.h, mkstemp.c,
5558         unicodeio.c, unicodeio.h, unlocked-io.h:
5559         Switch from LGPL to GPL.
5560
5561 2003-07-11  Alexandre Duret-Lutz  <adl@gnu.org>
5562
5563         * obstack.h (__INT_TO_PTR): Revert change of 2003-03-13;
5564         it breaks C++ compilation.
5565         [!__GNUC__ || !__STDC__] (obstack_finish): Cast result to void*.
5566
5567 2003-07-10  Jim Meyering  <jim@meyering.net>
5568
5569         * vasnprintf.c: Remove trailing blanks.
5570         Make cpp indentation consistent.
5571
5572 2003-07-09  Paul Eggert  <eggert@twinsun.com>
5573
5574         * alloca_.h, euidaccess.c, getpass.c, memrchr.c, obstack.h,
5575         posixver.c, strftime.c, strnlen.c, strverscmp.c:
5576         Switch from LGPL to GPL.
5577
5578 2003-07-07  Paul Eggert  <eggert@twinsun.com>
5579
5580         * mktime.c: Fix some boundary cases and remove need for floating point.
5581
5582         Issue a compile-time diagnostic if time_t is floating point, or if
5583         two's complement arithmetic is not in effect, or if arithmetic
5584         right shift does not propagate the sign.  These assumptions were
5585         all in the original code but they weren't checked.
5586
5587         (TIME_T_MIDPOINT, verify): New macros.
5588         (__isleap): Remove; it has integer overflow problems.
5589         (leapyear): New function, without those problems.
5590         (ydhms_tm_diff): Remove; splitting into two parts.
5591         (ydhms_diff): New function, containing the arithmetic part of
5592         the old ydhms_tm_diff function.  Issue a compile-time
5593         diagnostic if we are not using C99 integer division.
5594         Avoid casts when possible.
5595         (guess_time_tm): New function, containing the checking part of
5596         the old ydhms_tm_diff function.  Return the new value, rather than
5597         the difference between it and the old.  Accept a new argument T
5598         so that *T specifies the old value.  Check for overflow in the result.
5599
5600         (__mktime_internal): Use a time_t offset, not a long int offset.
5601         This undoes the 2003-06-04 change, which is no longer needed now
5602         that we have better overflow checking.
5603         (localtime_offset): Likewise.
5604
5605         (__mktime_internal): Avoid harmful overflow on hosts where time_t
5606         and long are 64-bit but int is only 32-bit.
5607         (ydhms_diff): Use long int to store year1 and yday1.
5608         Issue a compile-time diagnostic if long int is not wide enough.
5609
5610         (__mktime_internal): Use long int to store adjusted year and yday.
5611         Use plain C rather than preprocessor commands, if that doesn't
5612         affect efficiency.
5613         Check for overflow (and try to repair) after each probe
5614         rather than checking only at the very end.  This avoids some bugs
5615         (e.g., southern hemisphere, behind GMT, and GMT offset at minimum time
5616         does not equal GMT offset at maximum time).
5617         Use integer to check for overflow rather than floating point; this
5618         is more portable to non-IEEE hosts, and is a tad faster.
5619         When we detect that we are oscillating between two values,
5620         don't check whether tm_isdst has the requested value, since
5621         we already know the answer.  When tm_isdst has the wrong value,
5622         use a different heuristic to find the right one, based on the
5623         extreme values actually observed in practice in tz2003a,
5624         rather than the (overly optimistic) "previous 3 calendar quarters".
5625
5626         (not_equal_tm, print_tm, check_result): Use "const T" rather than
5627         "T const" to accommodate glibc style.
5628         (check_result): Use less-confusing report format.  "long" -> "long int.
5629         (main): Likewise.
5630         Don't loop if the iteration overflows time_t.
5631         Allow a negative step in the iteration.
5632
5633 2003-07-01  Paul Eggert  <eggert@twinsun.com>
5634
5635         * xreadlink.c: Include <sys/types.h> unconditionally, instead of
5636         having it depend on HAVE_SYS_TYPES_H.
5637
5638 2003-06-25  Bruno Haible  <bruno@clisp.org>
5639
5640         * readlink.c: New file.
5641
5642 2003-06-20  Bruno Haible  <bruno@clisp.org>
5643
5644         Assume C89, so PARAMS isn't needed.
5645         * unicodeio.h (PARAMS): Remove.
5646         * unicodeio.c: Don't use PARAMS.
5647
5648 2003-06-18  Jim Meyering  <jim@meyering.net>
5649
5650         Merge changes from coreutils.
5651         * readutmp.c: Include <string.h> and <stdlib.h> unconditionally.
5652         Remove explicit declarations of xmalloc and realloc.
5653         Include xalloc.h.
5654         (read_utmp): Remove anachronistic cast of xmalloc.
5655
5656 2003-06-17  Paul Eggert  <eggert@twinsun.com>
5657
5658         Assume C89, so PARAMS isn't needed.
5659         * backupfile.h (PARAMS): Remove.  All uses removed.
5660         * closeout.h, dirname.h, filemode.h, fsusage.h, getdate.h, getline.h,
5661         group-member.h, hard-locale.h, hash.h, linebuffer.h, long-options.h,
5662         makepath.h, memcasecmp.h, memcoll.h, modechange.h, mountlist.h,
5663         path-concat.h, physmem.h, posixtm.h, quote.h, readutmp.h, same.h,
5664         save-cwd.h, savedir.h, stdio-safer.h, strtoimax.c, strverscmp.h,
5665         unistd-safer.h, version-etc.h, xalloc.h, xreadlink.h, xstrtod.h,
5666         xstrtol.h: Likewise.
5667         * filemode.h, hard-locale.h, memcoll.h, modechange.h, physmem.h,
5668         same.h, strverscmp.h: Do not include config.h; no longer needed.
5669         Anyway, config.h should always be included before any other file.
5670
5671 2003-06-11  Simon Josefsson  <jas@extundo.com>
5672
5673         * sysexit_.h: New file.
5674
5675 2003-05-20  Derek Price  <derek@ximbiot.com>
5676
5677         * stat.c [LSTAT]: Compile/use slash_aware_lstat only if it is necessary.
5678
5679 2003-06-10  Simon Josefsson  <jas@extundo.com>
5680
5681         * strchrnul.h: New file.
5682         * strchrnul.c: New file.
5683
5684 2003-06-10  Simon Josefsson <jas@extundo.com>
5685
5686         * argp.h: New file, from glibc.
5687         * argp-ba.c: New file, from glibc.
5688         * argp-eexst.c: New file, from glibc.
5689         * argp-fmtstream.c: New file, from glibc.
5690         * argp-fmtstream.h: New file, from glibc.
5691         * argp-fs-xinl.c: New file, from glibc.
5692         * argp-help.c: New file, from glibc.
5693         * argp-namefrob.h: New file, from glibc.
5694         * argp-parse.c: New file, from glibc.
5695         * argp-pv.c: New file, from glibc.
5696         * argp-pvh.c: New file, from glibc.
5697         * argp-xinl.c: New file, from glibc.
5698
5699 2003-06-07  Jim Meyering  <jim@meyering.net>
5700
5701         * readtokens.h: Put `Free Software Foundation, Inc.'
5702         in place of my name in the copyright comment.
5703         Remove definition and uses of __P.
5704
5705         From coreutils.
5706         * stat.c: Don't declare xmalloc explicitly.
5707         Instead, include "xalloc.h".
5708         * readtokens.c (readtokens): Remove anachronistic casts of xmalloc,
5709         xrealloc, and xcalloc return values.
5710         * xgetcwd.c (xgetcwd): Include "xgetcwd.h".
5711         Improve comment.
5712         * xgetcwd.h: Remove definition/uses of PARAMS.
5713
5714 2003-06-06  Jim Meyering  <jim@meyering.net>
5715
5716         * stdbool_.h: Renamed from stdbool.h.in.
5717
5718 2003-06-06  Jim Meyering  <jim@meyering.net>
5719
5720         Merge from coreutils.
5721         * same.c: (same_name): Declare *_basename locals to be `const'.
5722         Consolidate declarations and initializations of *_base* locals.
5723
5724         Merge from coreutils.
5725         This avoids a core dump on systems without GNU putenv,
5726         when running `env -u SOME_ALREADY_UNSET_VARIABLE'.
5727         * putenv.c (__set_errno, LOCK, UNLOCK): Define.
5728         (unsetenv): New static function, from GNU libc.
5729         (rpl_putenv): Use it.
5730
5731         * modechange.c: Remove trailing blanks.
5732
5733         Merge from coreutils.
5734         * fsusage.c: Remove declaration of statfs.
5735         It conflicted with one from OSF/1 5.1 in <sys/mount.h>.
5736
5737         * posixtm.c: Include <stdbool.h> unconditionally.
5738
5739 2003-06-05  Paul Eggert  <eggert@twinsun.com>
5740
5741         * mktime.c (__mktime_internal): When resolving a tm_isdst
5742         mismatch, look in future quarters as well as past.  This fixes a
5743         bug when processing fall-backwards gaps immediately after a long
5744         period of daylight-saving time.
5745
5746         * mktime.c: Assume freestanding C89 or better.
5747         (HAVE_LIMITS_H): Remove.  Assume it's 1.
5748         (__P): Remove; not used.
5749         (CHAR_BIT, INT_MIN, INT_MAX): Remove; <limits.h> defines them.
5750         (mktime, not_equal_tm, print_tm, check_result,
5751         main): Use prototypes.  Use const * where appropriate.
5752         (main): Fix typo in testing code that uncovered by above changes.
5753         (Local Variables): Remove -DHAVE_LIMITS_H from compile-command.
5754
5755 2003-06-04  Paul Eggert  <eggert@twinsun.com>
5756
5757         * mktime.c: Fix Debian bug 177940
5758         <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=177940>.
5759         (localtime_offset): Now long int, not time_t, because we want it
5760         to be guaranteed to be signed.  All uses changed.
5761         (__mktime_internal): If overflow would occur when adding offset,
5762         don't add it.
5763
5764         Merge 'human' changes from coreutils.  Rewrite to support
5765         locale-specific notations like thousands separators.
5766         * human.c: Simplify authorship notice.
5767         Include human.h immediately after config.h.
5768         <sys/types.h>, <stdio.h>: Do not include; no longer needed.
5769         <limits.h>: Do not include, since human.h does.
5770         (SIZE_MAX, UINTMAX_MAX): New macros.
5771         <strings.h>: Include if HAVE_STRINGS_H, not if !HAVE_STRING_H.
5772         <locale.h>: Include if HAVE_LOCALE_H and HAVE_LOCALECONV.
5773         (HUMAN_READABLE_SUFFIX_LENGTH_MAX): New macro.
5774         (power_letter): Renamed from suffixes.
5775         (generate_suffix_backwards): Remove.
5776         (adjust_value): Now takes int style (because of human.h changes)
5777         and long double value (for greater precision on some platforms).
5778         (group_number): New function.
5779         (human_readable): Use it.  Use integer options, not enum.
5780         Put the options before the sizes in the arg list.
5781         Support all the new options.
5782         The old human_readable function has been removed;
5783         use inttostr.h instead.
5784         (human_readable, default_block_size, humblock):
5785         Use uintmax_t, not int, for block sizes.
5786         (human_readable_inexact, block_size_types): Remove.
5787         (block_size_opts): New constant.
5788         (human_options): Renamed from human_block_size, with new signature
5789         that allows block sizes up to UINTMAX_MAX.  All callers changed.
5790         * human.h: Add copyright and authorship notice.
5791         Include <limits.h> and <stdbool.h> unconditionally.
5792         (PARAMS): Remove.  All uses removed.
5793         (LONGEST_HUMAN_READABLE): Add support for thousands separator.
5794         (enum human_inexact_style): Remove tag; now a nameless enum.
5795         (human_floor, human_ceiling, human_round_to_even): Now have
5796         values 2, 0, 1 rather than -1, 1, 0.
5797         (human_group_digits, human_suppress_point_zero, human_autoscale,
5798         human_base_1024, human_SI, human_B): New constants.
5799         (human_readable_inexact, human_block_size): Remove.
5800         (human_readable): Size args are now uintmax_t, not int.
5801         (human_options): New decl.
5802
5803         * exclude.c: (new_exclude, add_exclude): Remove casts that are
5804         unnecessary now that we assume C89 or better.  This change
5805         imported from coreutils.
5806
5807         * mktime.c (__mktime_internal): Do not reject negative timestamps
5808         arbitrarily.  This is the same patch as 2003-05-28, but it got lost
5809         in the 2003-05-30 sync from glibc.
5810
5811         .h files should stand alone, but we shouldn't include <sys/types.h>
5812         if we can get away with just <stddef.h>.
5813
5814         * __fpending.h, addext.c, backupfile.c, exclude.c, getline.c,
5815         malloc.c, putenv.c, realloc.c, strcasecmp.c: Include <stddef.h>
5816         rather than <sys/types.h>, as we merely need size_t.
5817         * dirname.h, memcoll.h, xalloc.h, xmemcoll.h: Include <stddef.h>,
5818         to get size_t.
5819         * hash.h, linebuffer.h, readtokens.h, stdio-safer.h, version-etc.h:
5820         Include <stdio.h>, to get FILE.
5821         * memcasecmp.c: Don't include <sys/types.h>, as we can assume
5822         memcasecmp.h has included <stddef.h> and all we need is size_t.
5823         * memcoll.c: Include "memcoll.h", which gets us size_t and checks
5824         our interface, instead of including <sys/types.h>
5825
5826 2003-06-02  Paul Eggert  <eggert@twinsun.com>
5827
5828         [from coreutils]
5829         Fix some minor time-related bugs with POSIX time arguments.
5830         Some valid time stamps were being rejected (notably -1, and
5831         time stamps before 1900 on 64-bit hosts).  And some invalid
5832         time stamps were being accepted, e.g. September 31.
5833
5834         * posixtm.h (posixtime): Return bool instead of time_t, so
5835         that we can return (time_t) -1 successfully.
5836         * posixtm.c: Likewise.
5837         [HAVE_STDBOOL_H]: Include <stdbool.h>.
5838         (bool, false, true) [!HAVE_STDBOOL_H]: New type.
5839         (t): Remove static var.
5840         (year, posix_time_parse): Now takes struct tm * arg to modify, instead
5841         of static var.  All uses changed.
5842         (year): Do not reject years before 1900; they can occur with
5843         64-bit time_t.
5844         (posix_time_parse): Do not check for out-of-range components;
5845         that is now the caller's responsibility, since our checks were
5846         only approximations.
5847         (posixtime): Use mktime to check for out-of-range components,
5848         since it knows them exactly.
5849         If mktime returns (time_t) -1, check whether an error actually occurred
5850         by invoking localtime on -1.
5851         (main) [TEST_POSIXTIME]: Check for input data errors, and report
5852         posixtime failures better.
5853         Improve the test data (in comments only).
5854
5855 2003-05-30    <karl@gnu.org>
5856
5857         * mktime.c: update from libc.
5858
5859 2003-05-30  Bruno Haible  <bruno@clisp.org>
5860
5861         * config.charset: Upgrade to gettext-0.12.1 and libiconv-1.9.1.
5862         * localcharset.h: Likewise.
5863         * localcharset.c: Likewise.
5864
5865 2003-05-28  Paul Eggert  <eggert@twinsun.com>
5866
5867         Assume the headers required for C89 freestanding compilers.
5868         * addext.c, backupfile.c, fsusage.c, human.c, pathmax.h,
5869         rpmatch.c, userspec.c, xreadlink.c, xstrtol.c: Include <limits.h>
5870         without checking for HAVE_LIMITS_H.
5871         * backupfile.c, fsusage.c, hash.c, human.c, safe-read.c, userspec.c,
5872         xstrtol.c (CHAR_BIT) : Don't define, since <limits.h> is guaranteed
5873         to do that.
5874         * fatal.c: Include <stdarg.h> without checking for __STDC__.
5875         * exclude.c: Include <stdbool.h> unconditionally.
5876         * tempname.c: Include <stddef.h> unconditionally.
5877         * hash.c: Include <limits.h>, since we no longer define CHAR_BIT.
5878         * modechange.c, rpmatch.c (NULL): Don't define, since
5879         <stddef.h> does that.
5880         * quote.c: Dont include <stddef.h> or <sys/types.h>; not needed.
5881         * safe-read.c (INT_MAX): Don't define, since <limits.h> does that.
5882         * safe-read.c (TYPE_MINIMUM, TYPE_MAXIMUM): Remove; no longer needed.
5883         * xstrtol.c: Likewise.
5884         * safe-read.c: Remove TYPE_SIGNED; no longer needed.
5885         * savedir.c: Include <stddef.h> instead of defining NULL.
5886
5887         * addext.c (addext): Use assignment rather than cast, to avoid
5888         warnings on some platforms.
5889
5890         * mktime.c (__mktime_internal): Do not reject negative timestamps
5891         arbitrarily.
5892
5893 2003-05-10  Bruno Haible  <bruno@clisp.org>
5894
5895         * linebreak.c (iconv_string_length): Don't return -1 just because the
5896         string is longer than 4 KB.
5897
5898 2003-05-12  Jim Meyering  <jim@meyering.net>
5899
5900         * strftime.c (my_strftime): Let the `-' (no-pad) flag affect
5901         the space-padded-by-default conversion specifiers, %e, %k, %l.
5902
5903 2003-05-03  Bruno Haible  <bruno@clisp.org>
5904
5905         Upgrade to Unicode-4.0.
5906         * linebreak.c (nonspacing_table_data): Change width of U+00AD,
5907         U+0350..U+0357, U+035D..U+035F, U+0600..U+0603, U+0610..U+0615,
5908         U+0656..U+0658, U+0A01, U+0AE2..U+0AE3, U+0CBC, U+17B4..U+17B5,
5909         U+17DD, U+1920..U+1922, U+1927..U+192B, U+1932, U+1939..U+193B
5910         from 1 to 0. Change width of U+0CBF, U+0CC6, U+180E from 0 to 1.
5911         (uc_width): Change width of U+4DC0..U+4DFF from 2 to 1. Change width
5912         of U+2A6D7..U+2F7FF, U+2FA1E..U+2FFFD, U+30000..U+3FFFD from 1 to 2.
5913         Change width of U+E0100..U+E01EF from 1 to 0.
5914
5915 2003-04-25  Bruno Haible  <bruno@clisp.org>
5916
5917         * copy-file.c: Include <stddef.h>, for size_t.
5918
5919 2003-04-25  Jim Meyering  <jim@meyering.net>
5920
5921         * copy-file.c (copy_file_preserving): Declare buf_size to be
5922         of type size_t, not int.
5923
5924 2003-04-11  Jim Meyering  <jim@meyering.net>
5925
5926         Merge changes from Coreutils.
5927
5928         2003-03-22  Jim Meyering  <jim@meyering.net>
5929
5930         * strftime.c (widen): Cast alloca return value to proper type.
5931
5932         2003-01-19  Ulrich Drepper  <drepper@redhat.com>
5933
5934         From GNU libc.
5935         * strftime.c (my_strftime): Handle very large width
5936         specifications for numeric values correctly.  Improve checks for
5937         overflow.
5938
5939         2003-01-19  Jim Meyering  <jim@meyering.net>
5940
5941         * strftime.c (widen) [COMPILE_WIDE]: Merge nearly-identical definitions.
5942         (nl_get_alt_digit) [! defined my_strftime]: Define.
5943         (my_strftime) [_NL_CURRENT]: Merge nearly-identical uses of
5944         _nl_get_alt_digit and _nl_get_walt_digit.
5945
5946         * strftime.c (my_strftime): Merge in locale-related changes from libc.
5947         These changes have no effect outside of _LIBC.
5948
5949 2003-04-10  Bruno Haible  <bruno@clisp.org>
5950
5951         * findprog.h: New file, from GNU gettext.
5952         * findprog.c: New file, from GNU gettext.
5953
5954 2003-04-05  Jim Meyering  <jim@meyering.net>
5955
5956         Merge changes from Coreutils.
5957
5958         * exclude.h (PARAMS): Remove definition and uses.
5959         * exclude.c: Remove uses of `PARAMS'.
5960
5961         * dirname.c [TEST_DIRNAME]: Update build instructions for test.
5962         Add test-cases for DOS filenames. Declare program_name.
5963         (main): Set up program_name.  Patch by Rich Dawe.
5964
5965         * mountlist.c (read_filesystem_list) [MOUNTED_VMOUNT]: Detect any
5966         error from mntctl.
5967         Use mntctl's return value to drive the entry-processing loop, since
5968         we can't rely on the value of the vmt_length member in the last
5969         entry.  On some systems doing so could result in exhausting
5970         virtual memory.  Based in part on a patch from Mike Jetzer.
5971
5972 2003-04-04  Bruno Haible  <bruno@clisp.org>
5973
5974         * linebreak.h: New file, from GNU gettext.
5975         * linebreak.c: New file, from GNU gettext with slight modifications.
5976         * lbrkprop.h: New file, from GNU gettext.
5977
5978 2003-04-03  Bruno Haible  <bruno@clisp.org>
5979
5980         * utf8-ucs4.h: New file, from GNU gettext.
5981         * utf16-ucs4.h: New file, from GNU gettext.
5982         * ucs4-utf8.h: New file, from GNU gettext.
5983         * ucs4-utf16.h: New file, from GNU gettext.
5984
5985 2003-04-02  Bruno Haible  <bruno@clisp.org>
5986
5987         * binary-io.h: New file, from GNU gettext.
5988
5989 2003-04-01  Bruno Haible  <bruno@clisp.org>
5990
5991         * pathname.h: New file, from GNU gettext.
5992         * concatpath.c: New file, from GNU gettext.
5993
5994 2003-03-30  Bruno Haible  <bruno@clisp.org>
5995
5996         * copy-file.c (copy_file_preserving): Don't set owner if the function
5997         chown() doesn't exist.
5998
5999 2003-03-28  Bruno Haible  <bruno@clisp.org>
6000
6001         * copy-file.h: New file, from GNU gettext.
6002         * copy-file.c: New file, from GNU gettext.
6003
6004 2003-03-18  Jim Meyering  <jim@meyering.net>
6005
6006         * quote.c (quote_n): Fix typo in comment.
6007
6008 2003-03-14  Jim Meyering  <jim@meyering.net>
6009
6010         Merge changes from Coreutils.
6011         * obstack.h (obstack_object_size): Declare temporary, __o,
6012         to be const, in order to avoid warnings.
6013         (obstack_room): Likewise.
6014         (obstack_empty_p): Likewise.
6015
6016 2003-03-13  Paul Eggert  <eggert@twinsun.com>
6017
6018         Merge changes from Bison.
6019         * obstack.h: (__INT_TO_PTR) [__STDC__]: Cast result to
6020         (void *) to avoid diagnostic with native c89 on SGI IRIX 6.5
6021         when compiling Bison 1.875's `bitset bset = obstack_alloc
6022         (bobstack, bytes);'.  Problem reported by Nelson H. F. Beebe.
6023         * hash.c: Include <stdbool.h> unconditionally.
6024
6025 2003-03-09  Paul Eggert  <eggert@twinsun.com>
6026
6027         * argmatch.c (EXIT_FAILURE): Define if the system doesn't.
6028         Reported by Bruce Becker; see:
6029         http://mail.gnu.org/archive/html/bug-bison/2003-03/msg00017.html
6030
6031 2003-03-03  Paul Eggert  <eggert@twinsun.com>
6032             Bruno Haible  <bruno@clisp.org>
6033
6034         * mbswidth.h: Include <wchar.h>. Needed for UnixWare 7.1.1.
6035         Reported by John Hughes, see
6036         http://mail.gnu.org/archive/html/bug-bison/2003-02/msg00030.html
6037
6038 2003-02-19  Paolo Bonzino  <bonzini@gnu.org>
6039
6040         * poll_.h: New file.
6041         * poll.c: New file.
6042
6043 2003-02-18  Paolo Bonzino  <bonzini@gnu.org>
6044
6045         * mathl.h: New file.
6046         * acosl.c: New file.
6047         * asinl.c: New file.
6048         * atanl.c: New file.
6049         * ceill.c: New file.
6050         * cosl.c: New file.
6051         * expl.c: New file.
6052         * floorl.c: New file.
6053         * frexpl.c: New file.
6054         * ldexpl.c: New file.
6055         * logl.c: New file.
6056         * sincosl.c: New file.
6057         * sinl.c: New file.
6058         * sqrtl.c: New file.
6059         * tanl.c: New file.
6060         * trigl.c: New file.
6061         * trigl.h: New file.
6062
6063 2003-02-17  Bruno Haible  <bruno@clisp.org>
6064
6065         * mkdtemp.h: New file, from GNU gettext.
6066         * mkdtemp.c: New file, from GNU gettext.
6067
6068 2003-01-31  Bruno Haible  <bruno@clisp.org>
6069
6070         * rename.c: #undef rename before defining rpl_rename.
6071         * strnlen.c: #undef strnlen, define rpl_strnlen instead of strnlen.
6072
6073 2003-01-30  Bruno Haible  <bruno@clisp.org>
6074
6075         * printf-args.h: New file, from GNU gettext.
6076         * printf-args.c: New file, from GNU gettext.
6077         * printf-parse.h: New file, from GNU gettext.
6078         * printf-parse.c: New file, from GNU gettext.
6079         * vasnprintf.h: New file, from GNU gettext.
6080         * vasnprintf.c: New file, from GNU gettext.
6081         * asnprintf.c: New file, from GNU gettext.
6082         * vasprintf.h: New file, from GNU gettext with modifications.
6083         * vasprintf.c: New file, from GNU gettext.
6084         * asprintf.c: New file, from GNU gettext.
6085
6086 2003-01-29  Bruno Haible  <bruno@clisp.org>
6087
6088         * stpncpy.h: New file, from GNU gettext with modifications.
6089         * stpncpy.c: New file, from GNU gettext with modifications.
6090
6091 2003-01-28  Bruno Haible  <bruno@clisp.org>
6092
6093         * c-ctype.h: New file, from GNU gettext, with changes suggested by
6094         Paul Eggert.
6095         * c-ctype.c: New file, from GNU gettext, with changes suggested by
6096         Paul Eggert.
6097
6098 2003-01-27  Bruno Haible  <bruno@clisp.org>
6099
6100         * xsetenv.h: New file, from GNU gettext.
6101         * xsetenv.c: New file, from GNU gettext.
6102
6103 2003-01-23  Bruno Haible  <bruno@clisp.org>
6104
6105         * minmax.h: New file, from GNU gettext, with comments from Paul Eggert.
6106
6107 2003-01-22  Bruno Haible  <bruno@clisp.org>
6108
6109         * exit.h: New file, from GNU gettext.
6110
6111 2003-01-11  Bruno Haible  <bruno@clisp.org>
6112
6113         * stpcpy.h (stpcpy): Use ANSI C function declarations.
6114         * strcase.h (strcasecmp, strncasecmp): Likewise.
6115
6116 2003-01-14  Jim Meyering  <jim@meyering.net>
6117
6118         * same.c (same_name): Tweak a comment.
6119
6120 2003-01-11  Bruno Haible  <bruno@clisp.org>
6121
6122         * same.c (same_name): Reorder tests so as to avoid calling stat()
6123         when a string comparison is sufficient.
6124
6125 2003-01-11  Bruno Haible  <bruno@clisp.org>
6126
6127         * readtokens.c (readtoken): Cast character to 'unsigned char', not
6128         'unsigned int'.
6129
6130 2003-01-11  Bruno Haible  <bruno@clisp.org>
6131
6132         * hash-pjw.c: Add comment about low quality of this function.
6133
6134 2003-01-12  Paul Eggert  <eggert@twinsun.com>
6135
6136         Finish renaming getstr -> getdelim2 and readline -> readlinebuffer,
6137         to avoid collisions with libcurses and libreadline.
6138
6139         * Makefile.am (libfetish_a_SOURCES): Remove getstr.c, getstr.h.
6140         * getstr.h, getstr.c: Remove.
6141         * getline.c: Include "getline.h", to check interface.
6142         Move body of old getstr.c here: this defines MIN_CHUNK and
6143         declares getdelim2, which is renamed from getstr.
6144         (getline, getdelim): Adjust to renaming of getstr -> getdelim2.
6145
6146         * linebuffer.c (readlinebuffer): Renamed from readline.
6147         All uses changed.
6148         * linebuffer.h: Likewise.
6149         (readline): Remove backward-compatibility macro.
6150
6151 2003-01-12  Jim Meyering  <jim@meyering.net>
6152
6153         * makepath.c: Don't test HAVE_ERRNO_H.  It's not necessary.
6154
6155 2003-01-10  Bruno Haible  <bruno@clisp.org>
6156
6157         * alloca_.h: New file.
6158         * getdate.y: Unconditionally include alloca.h.
6159         * makepath.c: Likewise.
6160         * setenv.c: Likewise.
6161         * userspec.c: Likewise.
6162
6163 2003-01-09  Bruno Haible  <bruno@clisp.org>
6164
6165         * stdbool.h.in: New file.
6166
6167 2003-01-08  Bruno Haible  <bruno@clisp.org>
6168
6169         * safe-read.c: Include specification header first, to ensure its
6170         selfcontainedness.
6171         * full-write.c: Likewise.
6172
6173 2003-01-08  Jim Meyering  <jim@meyering.net>
6174
6175         * full-write.c: Undefine and define-away `const' after inclusion
6176         of errno.h, not before.  Suggestion from Bruno Haible.
6177
6178 2003-01-07  Jim Meyering  <jim@meyering.net>
6179
6180         * full-write.c: Rework so that it may serve to define full_read, too.
6181         * full-read.c: Simply #define FULL_READ and include full-write.c.
6182
6183 2003-01-06  Jim Meyering  <jim@meyering.net>
6184
6185         * version-etc.c: Update year in translatable copyright string.
6186
6187 2002-12-25  Bruno Haible  <bruno@clisp.org>
6188
6189         * strtoimax.c: Include <stdint.h> as an alternative to <inttypes.h>.
6190         * xstrtol.h: Likewise.
6191         * xstrtoimax.c: Likewise.
6192         * xstrtoumax.c: Likewise.
6193         * human.h: Likewise.
6194
6195         * tempname.c: Include <inttypes.h> too. Avoids a compilation error
6196         on systems that have <inttypes.h> but not <stdint.h>.
6197
6198 2002-12-31  Paul Eggert  <eggert@twinsun.com>
6199
6200         * memcoll.c (memcoll): Fall back on a simple algorithm using
6201         memcmp if strcoll doesn't work.
6202
6203 2002-12-23  Bruno Haible  <bruno@clisp.org>
6204
6205         * localcharset.h: New file.
6206         * localcharset.c: Include it.
6207         * unicodeio.c: Likewise.
6208
6209 2002-12-22  Bruno Haible  <bruno@clisp.org>
6210
6211         * utime.c (utime_null): No need to call ftruncate if the file was
6212         nonempty.
6213
6214 2002-12-23  Bruno Haible  <bruno@clisp.org>
6215
6216         * memcoll.c (STRCOLL): New macro.
6217         (memcoll): Use it.
6218
6219 2002-12-22  Bruno Haible  <bruno@clisp.org>
6220
6221         * getstr.h (getstr): Define, to avoid clash with libcurses.
6222         * linebuffer.h (readline): Define, to avoid clash with libreadline.
6223
6224 2002-12-22  Bruno Haible  <bruno@clisp.org>
6225
6226         * getdate.y (get_date): Test HAVE_STRUCT_TM_TM_ZONE, not HAVE_TM_ZONE.
6227
6228 2002-12-23  Bruno Haible  <bruno@clisp.org>
6229
6230         * getline.h: Include <stddef.h>, for size_t.
6231
6232         * unicodeio.h: Include <stddef.h>, for size_t.
6233         * unicodeio.c: Don't include <stddef.h>.
6234
6235 2002-12-17  Bruno Haible  <bruno@clisp.org>
6236
6237         * canon-host.c (strdup): Remove unused declaration.
6238
6239         * fsusage.c: Include full_read.h.
6240         (get_fs_usage): Use full_read instead of safe_read.
6241
6242         * utime.c (utime_null): Use SAFE_READ_ERROR.
6243
6244 2002-12-11  Bruno Haible  <bruno@clisp.org>
6245
6246         * setenv.h: Rewritten to cope with systems that have setenv() but not
6247         unsetenv().
6248         * setenv.c, unsetenv.c: Taken from glibc-2.2.4 with the following
6249         modifications:
6250
6251         2002-12-11  Bruno Haible  <bruno@clisp.org>
6252
6253                 * setenv.c (alloca): Fall back to malloc.
6254                 (freea): New macro.
6255                 (setenv): Use freea() to free memory allocated with alloca().
6256
6257         2002-11-13  Bruno Haible  <bruno@clisp.org>
6258
6259                 * setenv.c (compar_fn_t, __add_to_environ, setenv): Use ANSI C
6260                 function declarations.
6261                 * unsetenv.c (unsetenv): Likewise.
6262
6263         2002-03-04  Bruno Haible  <bruno@clisp.org>
6264
6265                 Portability to AIX 4.3.3.
6266                 * unsetenv.c: New file, extracted from setenv.c.
6267                 * setenv.c: Move the unsetenv() function to unsetenv.c.
6268
6269         2001-12-20  Bruno Haible  <bruno@clisp.org>
6270
6271                 * setenv.c (__add_to_environ): Don't call realloc(NULL,...),
6272                 use malloc instead. For SunOS 4.
6273
6274         2001-12-11  Bruno Haible  <bruno@clisp.org>
6275
6276                 * setenv.c: Declare alloca.
6277                 (compar_fn_t): New typedef.
6278                 (KNOWN_VALUE, STORE_VALUE): Use it.
6279
6280         * Makefile.am (libfetish_a_SOURCES): Add setenv.c, unsetenv.c,
6281         setenv.h.
6282
6283 2002-12-10  Paul Eggert  <eggert@twinsun.com>
6284
6285         Port exclude.c and exclude.h to more non-GNU systems, e.g. Solaris 7.
6286         * exclude.h (EXCLUDE_ANCHORED, EXCLUDE_INCLUDE, EXCLUDE_WILDCARDS):
6287         Choose values that are less likely to collide with system fnmatch
6288         options.
6289         * exclude.c (FNM_CASEFOLD, FNM_LEADING_DIR): Define to 0 if not
6290         defined (e.g., a pure POSIX system).
6291         (EXCLUDE_macros_do_not_collide_with_FNM_macros): Use FNM_PATHNAME
6292         instead of FNM_FILE_NAME, for compatibility with pure POSIX sytems.
6293
6294 2002-12-06  Jim Meyering  <jim@meyering.net>
6295
6296         * error.c: Be consistent: change `#ifndef _LIBC' to `#if !_LIBC'.
6297
6298         Merge in changes from libc's misc/error.c, in preparation
6299         for the merge of gnulib's changes back into libc.
6300
6301         * error.c (_): Define only if not already defined.
6302         Move definition to follow all #include directives.
6303         Include unlocked-io.h only if !_LIBC.
6304         [_LIBC]: Include <libio/libioP.h>.
6305         [USE_IN_LIBIO]: Include <libio/iolibio.h>
6306         (fflush): Tweak definition to use INTUSE.
6307         (putc): Define.
6308
6309 2002-12-05  Paul Eggert  <eggert@twinsun.com>
6310
6311         * alloca.c [defined emacs]: Include "lisp.h".
6312         (xalloc_die) [defined emacs]: New macro.
6313         (free) [defined emacs && defined EMACS_FREE]: Define to EMACS_FREE.
6314         [! defined emacs]: Include <xalloc.h>.
6315         (POINTER_TYPE) [!defined POINTER_TYPE]: New macro.
6316         (pointer): Typedef to POINTER_TYPE *.
6317         (malloc): Remove decl; we now always use xmalloc.
6318         (alloca): Use old-style definition, since Emacs needs this.
6319         Check for arithmetic overflow when computing combined size.
6320
6321 2002-12-04  Paul Eggert  <eggert@twinsun.com>
6322
6323         Do not generate unlocked-io.h automatically, since it's easier to
6324         maintain it by hand.
6325
6326         * unlocked-io.h: New file, from GNU diffutils,
6327         but with proper copyright notice and attribution.
6328         * gen-uio: Remove.
6329         * Makefile.am: Add copyright notice.
6330         (libfetish_a_SOURCES): Add unlocked-io.h.
6331         (BUILT_SOURCES, all-local): Remove unlocked-io.h.
6332         (DISTCLEANFILES, io_functions): Remove macros.
6333         (EXTRA_DIST): Remove gen_uio.
6334         (unlocked-io.h): Remove rule.
6335
6336 2002-12-04  Jim Meyering  <jim@meyering.net>
6337
6338         Reflect the fact that stat.c and lstat.c are no longer generated.
6339         * Makefile.am (BUILT_SOURCES): Remove stat.c and lstat.c.
6340         (DISTCLEANFILES): Likewise.
6341         (EXTRA_DIST): Likewise.
6342         (all_local): Don't depend on stat.c or lstat.c.
6343         (stat.c, lstat.c): Remove rules.
6344         (EXTRA_DIST): Remove xstat.in.
6345
6346         * xstat.in: Remove file.  Contents moved into stat.c.
6347         * stat.c: New file.  Contents mostly from xstat.in.
6348         * stat.c: Rework so that it may serve to define rpl_lstat, too.
6349         * lstat.c: New file. Simply #define LSTAT and include stat.c.
6350
6351         * safe-read.c: Rework so that it may serve to define safe_write, too.
6352         * safe-write.c: Simply #define SAFE_WRITE and include safe-read.c.
6353
6354 2002-12-03  Jim Meyering  <jim@meyering.net>
6355
6356         * safe-read.c, safe-write.c: Change variable names and comments, but
6357         not semantics, to minimize the differences between these two files.
6358         (safe_read): Change comment to mention SAFE_READ_ERROR.
6359
6360         * safe-read.c (IS_EINTR): Define.
6361         (safe_read): Use IS_EINTR in place of in-function cpp directives.
6362
6363 2002-12-02  Bruno Haible  <bruno@clisp.org>
6364
6365         * safe-write.c (CHAR_BIT, TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM):
6366         Define, taken from safe-read.c.
6367         (INT_MAX): Provide fallback.
6368         (safe_write): Rewrite to iterate IFF the write fails with EINTR.
6369         * safe-write.h (SAFE_WRITE_ERROR): Define.
6370
6371         * safe-read.c (EINTR): Remove definition.
6372         (safe_read): Don't use EINTR if it is absent.
6373
6374 2002-12-02  Jim Meyering  <jim@meyering.net>
6375
6376         * safe-read.c (EINTR): Define.
6377         (CHAR_BIT, TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM): Define.
6378         (INT_MAX): Provide fallback.
6379         (safe_read): Rewrite to iterate IFF the read fails with EINTR.
6380
6381         * safe-read.h (SAFE_READ_ERROR): Define.
6382
6383 2002-12-01  Jim Meyering  <jim@meyering.net>
6384
6385         * safe-read.c: (safe_read): Also exit the loop when read returns zero.
6386         (CHAR_BIT, TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM, INT_MAX): Define.
6387
6388 2002-11-27  Paul Eggert  <eggert@twinsun.com>
6389
6390         * hash.c (hash_lookup, hash_get_first, hash_get_next, hash_find_entry,
6391         hash_rehash): Replace `if (limit <= value) abort ();' with
6392         `if (! (value < limit)) abort ();', for readability.
6393
6394 2002-11-26    <karl@gnu.org>
6395
6396         * strdup.c: copy from libc again, with jim's ok.
6397         * .cppi-disable: re-add strdup.c
6398
6399 2002-11-25    <karl@gnu.org>
6400
6401         * strtoll.c: copy from libc, meaning we now #include <strtol.c>
6402         instead of "strtol.c".
6403
6404 2002-11-25  Jim Meyering  <jim@meyering.net>
6405
6406         * mktime.c: Sync from libc, now that it has the latest fix.
6407
6408 2002-11-24    <karl@gnu.org>
6409
6410         * error.c, getopt.c, getopt.h, getopt1.c, obstack.c, regex.c,
6411         regex.h, strdup.c, strtoll.c, tempname.c: change license to gpl.
6412
6413 2002-11-24  Jim Meyering  <jim@meyering.net>
6414
6415         Update from coreutils:
6416
6417         * mktime.c: Merge in changes from libc.
6418
6419         Avoid a link-time failure on some Linux systems.
6420         * mktime.c (STATIC): Define to be empty (_LIBC) or `static' (otherwise).
6421         (__mon_yday): Declare with the STATIC attribute.
6422         (__mktime_internal): Likewise.
6423         Based on a report from Greg Schafer.
6424
6425 2002-11-23  Jim Meyering  <jim@meyering.net>
6426
6427         * sig2str.c (str2signum, sig2str): Avoid a warning from gcc:
6428         Use `unsigned', not `int', as type of index.
6429
6430         * xstat.in [@BEGIN_LSTAT_ONLY@]: Include <string.h>.
6431
6432         * fsusage.c: Remove unneeded parentheses around operands of `defined'.
6433
6434 2002-11-22  Paul Eggert  <eggert@twinsun.com>
6435
6436         * hash.c: Avoid use of <assert.h>, as the GNU Coding Standards
6437         hint that one should use `if (! x) abort ();' rather than `assert
6438         (x);', and anyway it's one less thing to worry about configuring.
6439         (hash_lookup, hash_get_first, hash_get_next, hash_find_entry,
6440         hash_rehash, hash_insert): Use abort rather than assert.
6441
6442 2002-11-22  Paul Eggert  <eggert@twinsun.com>
6443
6444         * quotearg.h: Allow multiple inclusion by surrounding with
6445         "#ifndef QUOTEARG_H_".  Include <stddef.h>, for size_t,
6446         so that we can be included first.
6447         (PARAMS): Remove; we now assume C89 or later.  All uses removed.
6448         * quotearg.c: Include quotearg.h immediately after config.h.
6449         No need to include stddef.h or sys/types.h any more.
6450         Surround local include files with "", not "<>".
6451         Assume HAVE_LIMITS_H unconditionally, as we assume C89.
6452         Similarly, assume HAVE_C_BACKSLASH_A, CHAR_BIT, UCHAR_MAX, UINT_MAX,
6453         HAVE_STDLIB_H, HAVE_STRING_H, STDC_HEADERS.
6454         (HAVE_MBSINIT): Undef if !HAVE_MBRTOWC.
6455         (mbsinit): Define to 1 if !defined mbsinit && !HAVE_MBSINIT.
6456         (ISPRINT): Remove; no longer needed now that we assume C89.
6457
6458         (clone_quoting_options, quotearg_buffer, quotearg_n_options):
6459         Preserve errno.
6460
6461         (quotearg_buffer_restyled, quotearg_n, quotearg_n_style,
6462         quotearg_char): Use SIZE_MAX rather than
6463         (size_t) -1 when we are talking about "infinity".
6464
6465         (quotearg_buffer_restyled): Fix bug when quoting trigraphs.
6466
6467 2002-11-22  Bruno Haible  <bruno@clisp.org>
6468
6469         * safe-read.h: Assume C89. Add comments.
6470         (safe_read): Change return type to size_t.
6471         * safe-read.c (safe_read): Change return type to size_t. Handle byte
6472         counts > SSIZE_MAX correctly.
6473         * safe-write.h: New file.
6474         * safe-write.c: New file.
6475         * full-read.h: New file.
6476         * full-read.c: New file.
6477         * full-write.h: Assume C89. Add comments.
6478         * full-write.c: Include safe-write.h.
6479         (full_write): Rewritten to use safe_write.
6480         Suggested by Jim Meyering and Paul Eggert.
6481
6482 2002-11-21  Bruno Haible  <bruno@clisp.org>
6483
6484         Remove case insensitive option matching.
6485         * argmatch.h (argcasematch): Remove declaration.
6486         (ARGCASEMATCH): Remove macro.
6487         (__xargmatch_internal): Remove case_sensitive argument.
6488         (XARGMATCH): Update.
6489         (XARGCASEMATCH): Remove macro.
6490         * argmatch.c (argmatch): Renamed from __argmatch_internal. Remove
6491         case_sensitive argument.
6492         (argcasematch): Remove function.
6493         (__xargmatch_internal): Remove case_sensitive argument.
6494         (main): Use XARGMATCH instead of XARGCASEMATCH.
6495
6496         * xmalloc.c: Change compile-time error message. Add comment about
6497         required autoconf version.
6498
6499 2002-11-21  Jim Meyering  <jim@meyering.net>
6500
6501         * strdup.c (strdup): Tweak comment and initial #if/#include.
6502
6503         Merge in changes from the coreutils.
6504
6505         2002-09-25  Paul Eggert  <eggert@twinsun.com>
6506         * fsusage.c [! HAVE_INTTYPES_H && HAVE_STDINT_H] Include <stdint.h>.
6507         (UINTMAX_MAX) [!defined UINTMAX_MAX]: New macro.
6508         (PROPAGATE_ALL_ONES): Work even if X is unsigned and narrower than
6509         int.  Work more efficiently if X is the same width as uintmax_t.
6510         Do not compare X to -1, to avoid bogus compiler warning.
6511         (get_fs_usage): (uintmax_t) -1 -> UINTMAX_MAX to avoid a cast.
6512         Don't assume that f_frsize and f_bsize are the same type.
6513
6514         * mountlist.c: #undef MNT_IGNORE before defining it, to avoid warning
6515         on FreeBSD.
6516
6517         * makepath.c (make_path): Restore umask *before* creating the final
6518         component.
6519         (make_path): Minor reformatting.
6520
6521         * xmalloc.c: Adjust to work with new autoconf macros, AC_FUNC_MALLOC
6522         and AC_FUNC_REALLOC: test #ifndef HAVE_MALLOC/HAVE_REALLOC.
6523
6524         * mountlist.h (ME_DUMMY): Don't count entries of type `auto' as dummy
6525         ones.  At least on GNU/Linux systems, `auto' means something else.
6526         From Michael Stone.
6527
6528 2002-11-20  Paul Eggert  <eggert@twinsun.com>
6529
6530         Merge argmatch cleanups from Bison.  Assume C89.
6531
6532         * argmatch.c: Include config.h here, not in argmatch.h.
6533         Include stdlib.h, for EXIT_FAILURE.
6534         Always include <string.h>, since we assume C89.
6535         (EXIT_FAILURE): Remove pre-C89 bug workaround.
6536         * argmatch.h: Do not include <config.h> or <sys/types.h>.
6537         Include <stddef.h> instead, since it's all we need for size_t.
6538         (PARAMS): Remove.  All uses removed.
6539         (ARRAY_CARDINALITY): Do not bother to #undef.
6540         (ARRAY_CARDINALITY, ARGMATCH, ARGCASEMATCH, invalid_arg,
6541         ARGMATCH_VALID, XARGMATCH, XARGCASEMATCH):
6542         Remove unnecessary parentheses.
6543         (ARGMATCH_VALID, XARGMATCH, XARGCASEMATCH):
6544         Insert necessary parentheses.
6545         (ARGMATCH_CONSTRAINT, ARGMATCH_VERIFY): New macros.
6546         (ARGMATCH_ASSERT): Use ARGMATCH_CONSTRAINT.
6547
6548 2002-11-19  Bruno Haible  <bruno@clisp.org>
6549
6550         * mbswidth.c: Include mbswidth.h right at the beginning.
6551         * mbswidth.h: Include <stddef.h>, for size_t.
6552
6553         * mbswidth.h (PARAMS): Remove macro.
6554         (mbswidth, mbsnwidth): Use ANSI C function declarations.
6555         * mbswidth.c (mbswidth, mbsnwidth): Likewise.
6556
6557         * gcd.h (PARAMS): Remove macro.
6558         (gcd): Use ANSI C function declarations.
6559         * gcd.c (gcd): Likewise.
6560
6561 2002-11-15  Bruno Haible  <bruno@clisp.org>
6562
6563         * strcspn.c: Include <stddef.h>.
6564         (strcspn): Use ANSI C function declaration. Change return type to
6565         size_t. Use NULL.
6566         * strpbrk.c: Minimize diffs to glibc. Include <stddef.h>.
6567         (strpbrk): Use NULL.
6568         * strpbrk.h (PARAMS): Remove macro.
6569         (strpbrk): Use ANSI C function declaration.
6570         * strstr.c: Don't include <sys/types.h>.
6571         * strstr.h (PARAMS): Remove macro.
6572         (strstr): Use ANSI C function declarations.
6573
6574 2002-11-06  Bruno Haible  <bruno@clisp.org>
6575
6576         * gcd.h (gcd): Change argument type to 'unsigned long'.
6577         * gcd.c (gcd): Likewise.
6578
6579 2002-11-05  Bruno Haible  <bruno@clisp.org>
6580
6581         * gcd.h: New file, from gettext-0.11.5.
6582         * gcd.c: New file, from gettext-0.11.5.
6583
6584 2002-11-05  Bruno Haible  <bruno@clisp.org>
6585
6586         * error.c [!_LIBC]: Include gettext.h instead of <libintl.h>.
6587         * getopt.c [!_LIBC]: Include gettext.h instead of <libintl.h>.
6588         * obstack.c [!_LIBC]: Include gettext.h instead of <libintl.h>.
6589         * regex.c [!_LIBC]: Include gettext.h instead of <libintl.h>.
6590
6591         * argmatch.c: Include gettext.h instead of <locale.h> and <libintl.h>.
6592         * makepath.c: Include gettext.h instead of <locale.h> and <libintl.h>.
6593
6594         * closeout.c: Include gettext.h instead of <libintl.h>.
6595         * human.c: Include gettext.h instead of <libintl.h>.
6596         * quotearg.c: Include gettext.h instead of <libintl.h>.
6597         * rpmatch.c: Include gettext.h instead of <libintl.h>.
6598         * unicodeio.c: Include gettext.h instead of <libintl.h>.
6599         * userspec.c: Include gettext.h instead of <libintl.h>.
6600         * version-etc.c: Include gettext.h instead of <libintl.h>.
6601         * xmalloc.c: Include gettext.h instead of <libintl.h>.
6602         (textdomain): Remove definition.
6603         * xmemcoll.c: Include gettext.h instead of <libintl.h>.
6604
6605         * long-options.c: Remove include of <libintl.h> and definition of _.
6606         * same.c: Remove include of <libintl.h> and definition of _.
6607
6608 2002-11-04  Bruno Haible  <bruno@clisp.org>
6609
6610         * stpcpy.h: New file, from GNU gettext-0.11.5.
6611         * strcase.h: New file, from GNU gettext-0.11.5.
6612         * strpbrk.h: New file, from GNU gettext-0.11.5.
6613         * strstr.h: New file, from GNU gettext-0.11.5.
6614         * xgetcwd.h: New file, from GNU gettext-0.11.5.
6615
6616 2002-05-09  Bruno Haible  <bruno@clisp.org>
6617
6618         * config.charset: Update for newest glibc. Add canonical names
6619         ISO-8859-14, KOI8-T, TCVN5712-1, GEORGIAN-PS.
6620
6621 2002-05-09  Bruno Haible  <bruno@clisp.org>
6622
6623         * localcharset.c (get_charset_aliases): Add more Windows specific
6624         aliases.
6625
6626 2002-05-08  Owen Taylor  <otaylor@redhat.com>
6627
6628         * config.charset: A few additions for Solaris.
6629
6630 2001-12-05  Bruno Haible  <bruno@clisp.org>
6631
6632         * localcharset.c (locale_charset): Don't return an empty string.
6633
6634 2001-10-23  Bruno Haible  <haible@clisp.cons.org>
6635
6636         * config.charset: msdos in uk_UA uses CP1125.
6637
6638 2001-08-05  Bruno Haible  <haible@clisp.cons.org>
6639
6640         Make it possible to build libcharset with CC=gcc CFLAGS="-x c++".
6641         * localcharset.c (locale_charset): Declare as extern "C".
6642
6643 2002-02-15  Bruno Haible  <bruno@clisp.org>
6644
6645         * config.charset [msdosdjgpp]: For Russian, use CP866.
6646
6647 2002-02-11  Bruno Haible  <bruno@clisp.org>
6648
6649         * config.charset: Add support for NetBSD.
6650
6651 2002-09-25    <karl@gnu.org>
6652
6653         * strdup.c: copy from libc/string (via ../config/srclist*).
6654         * getopt*: copy from libc/posix.
6655         * gettext.h: copy from gettext.
6656         * .cppi-disable: add strdup.c, gettext.h.
6657
6658 2002-07-01  Jim Meyering  <meyering@lucent.com>
6659
6660         * c-stack.c: Include sys/time.h.
6661         From Volker Borchert.
6662
6663 2002-06-11  Paul Eggert  <eggert@twinsun.com>
6664
6665         * fnmatch.c, fnmatch_loop.c (WIDE_CHAR_SUPPORT):
6666         New macro.  Use it uniformly instead of
6667         (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H).
6668         It also uses HAVE_BTOWC, to fix a porting bug on Solaris 2.5.1
6669         reported by Vin Shelton.
6670
6671 2002-06-22  Jim Meyering  <meyering@lucent.com>
6672
6673         * fnmatch.c (ISASCII, ISPRINT): Undefine, to avoid warning about
6674         redefinition due to Solaris 2.6's definition in /usr/include/sys/euc.h.
6675
6676 2002-06-22  Paul Eggert  <eggert@twinsun.com>
6677
6678         * c-stack.h (segv_handler, c_stack_action) [! defined SA_SIGINFO]:
6679         Do not assume SA_SIGINFO behavior.
6680         Bug reported by Jim Meyering on NetBSD 1.5.2.
6681
6682 2002-06-22  Jim Meyering  <meyering@lucent.com>
6683
6684         * c-stack.c, c-stack.h: New files, from diffutils-2.8.2.
6685
6686         * exitfail.c, exitfail.h: Likewise.
6687         * Makefile.am (libfetish_a_SOURCES): Add exitfail.c and exitfail.h.
6688
6689         * Makefile.am (libfetish_a_SOURCES): Add fnmatch_.h in place
6690         of fnmatch.h.
6691         (EXTRA_DIST): Add fnmatch_loop.c.
6692         (libfetish_a_SOURCES): Add c-stack.c and c-stack.h.
6693
6694         * fnmatch_loop.c: New file, from diffutils-2.8.2.
6695         * fnmatch.c: Update from diffutils-2.8.2.
6696         * fnmatch_.h: New file.  From diffutils-2.8.2.
6697         * fnmatch.h: Remove file.
6698
6699 2002-06-18  Paul Eggert  <eggert@twinsun.com>
6700
6701         * file-type.h: Report an error if neither S_ISREG nor
6702         S_IFREG is defined, instead of using a test specific to glibc
6703         2.2.  This should be safe, since POSIX requires S_ISREG and
6704         Unix Version 7 had S_IFREG.  We don't need to check for
6705         <sys/types.h> since we don't use any symbols that it defines.
6706
6707 2002-06-15  Jim Meyering  <meyering@lucent.com>
6708
6709         * file-type.h (FILE_TYPE_H): Guard entire contents with #ifndef.
6710         For GNU libc 2.2 and newer, ensure that <sys/types.h> and <sys/stat.h>
6711         have been included before this file.
6712
6713 2002-06-13  Richard Dawe  <richdawe@bigfoot.com>
6714
6715         * Makefile.am (lstat.c, stat.c, .sin.sed): Use t-$@, rather than $@-t,
6716         so that each temporary file name is unique and valid in the first
6717         8 characters, for operation under DOS.
6718
6719 2002-06-15  Jim Meyering  <meyering@lucent.com>
6720
6721         Work even with DJGPP 2.03, which lacks support for symlinks.
6722         From Richard Dawe.
6723         * xstat.in (S_ISLNK): Define to 0 if neither S_ISLNK nor S_IFLNK
6724         is defined.
6725         * lchown.c (S_ISLNK): Likewise.
6726
6727 2002-06-14  Jim Meyering  <meyering@lucent.com>
6728
6729         * file-type.h: Use the version from diffutils-2.8.2.
6730         * file-type.c: Likewise.
6731
6732 2002-05-27  Jim Meyering  <meyering@lucent.com>
6733
6734         Fix a problem seen only on nonconforming systems whereby ls.c's
6735         use of localtime, and then of gettimeofday would cause trouble:
6736         the localtime call used to initialize rpl_gettimeofday's save
6737         mechanism would clobber ls's current local time information so
6738         that in any long listing the first file would always be listed
6739         with date 1970-01-01.  Analysis by Volker Borchert.
6740
6741         * gettimeofday.c (localtime): Undefine.
6742         (rpl_localtime): New function.
6743
6744 2002-05-22  Jim Meyering  <meyering@lucent.com>
6745
6746         * Makefile.am (libfetish_a_SOURCES): Add file-type.c and file-type.h.
6747         * file-type.h: New file.
6748         * file-type.c (file_type): New file/function.  Extracted from diffutils.
6749
6750 2002-04-29  Paul Eggert  <eggert@twinsun.com>
6751
6752         * hard-locale.c: Upgrade to version used in GNU Diffutils 2.8.1.
6753
6754 2002-04-28  Paul Eggert  <eggert@twinsun.com>
6755
6756         * sig2str.h (SIGNUM_BOUND): Do not use WTERMSIG, to avoid
6757         depending on <sys/wait.h> and WTERMSIG.  Default to 64 instead
6758         of 127, since 64 is the largest conceivable number for ancient
6759         nonstandard hosts.
6760         * sig2str.c: Do not include <sys/wait.h>; no longer needed.
6761
6762 2002-04-28  Jim Meyering  <meyering@lucent.com>
6763
6764         * sig2str.c (WTERMSIG): Remove definition (unused).
6765
6766 2002-04-28  Paul Eggert  <eggert@twinsun.com>
6767
6768         * sig2str.h, sig2str.c: New files.
6769         * Makefile.am (libfetish_a_SOURCES): Add sig2str.h.
6770
6771 2002-04-24  Jim Meyering  <meyering@lucent.com>
6772
6773         * gettext.h: New file, from Gettext.
6774         * Makefile.am (INCLUDES): Remove -I../intl.
6775         (libfetish_a_SOURCES): Add gettext.h.
6776
6777 2002-04-16  Jim Meyering  <meyering@lucent.com>
6778
6779         * readutmp.h (UT_TYPE): Remove definition (now in who.c).
6780         (HAVE_STRUCT_XTMP_UT_EXIT, HAVE_STRUCT_XTMP_UT_ID): Define.
6781         (HAVE_STRUCT_XTMP_UT_PID, HAVE_STRUCT_XTMP_UT_TYPE): Define.
6782
6783 2002-04-12  Jim Meyering  <meyering@lucent.com>
6784
6785         * dirfd.h (dirfd): Elide prototype if dirfd is a macro.
6786
6787 2002-03-10  Jim Meyering  <meyering@lucent.com>
6788
6789         * makepath.c (make_path): Remove a comma from a diagnostic.
6790         Suggestion from Santiago Vila.
6791
6792 2002-03-08  Jim Meyering  <meyering@lucent.com>
6793
6794         * rename.c: Mention that this wrapper is needed also on
6795         mips-dec-ultrix4.4 systems.
6796
6797 2002-03-02  Jim Meyering  <meyering@lucent.com>
6798
6799         * gettime.c (gettime): Test HAVE_CLOCK_GETTIME,
6800         not HAVE_CLOCK_SETTIME.
6801
6802 2002-02-27  Paul Eggert  <eggert@twinsun.com>
6803
6804         * nanosleep.h: Rename to....
6805         * timespec.h: New name for nanosleep.h.  All uses changed.
6806
6807         * gettime.c: New file.
6808         * settime.c: New file.
6809         * stime.c: Remove.
6810
6811         * Makefile.am (libfetish_a_SOURCES): Add gettime.c, settime.c,
6812         timespec.h.  Remove nanosleep.h.
6813
6814 2002-02-25  Paul Eggert  <eggert@twinsun.com>
6815
6816         * acl.c, acl.h: New files.
6817         * Makefile.am (libfetish_a_SOURCES): Add acl.h, acl.c.
6818
6819 2002-02-24  Jim Meyering  <meyering@lucent.com>
6820
6821         * strnlen.c (strnlen): Define-away/undef so that an inconsistent
6822         prototype in string.h (on at least AIX4.3.2.0 w/gcc-2.95.3) doesn't
6823         cause trouble.  Reported by Nelson Beebe.
6824
6825 2002-02-23  Paul Eggert  <eggert@twinsun.com>
6826
6827         * path-concat.c (xpath_concat): Reorder code to pacify
6828         compilers that don't know that xalloc_die never returns.
6829
6830 2002-02-20  Jim Meyering  <meyering@lucent.com>
6831
6832         * getdate.c: Regenerate using bison-1.33.
6833
6834 2002-02-15  Paul Eggert  <eggert@twinsun.com>
6835
6836         * posixver.c, posixver.h: New files.
6837         * Makefile.am (libfetish_a_SOURCES): Add them.
6838
6839 2002-02-02  Paul Eggert  <eggert@twinsun.com>
6840             Bruno Haible  <bruno@clisp.org>
6841
6842         * unicodeio.h (print_unicode_char): Add exit_on_error argument.
6843         (fwrite_success_callback): New declaration.
6844         * unicodeio.c (unicode_to_mb): New function, extracted from
6845         print_unicode_char. Call failure callback instead of error.
6846         (fwrite_success_callback): New function.
6847         (exit_failure_callback): New function.
6848         (fallback_failure_callback): New function.
6849         (print_unicode_char): Call unicode_to_mb.
6850
6851 2002-01-26  Jim Meyering  <meyering@lucent.com>
6852
6853         * Makefile.am (getdate$U.o): Depend on unlocked-io.h.
6854
6855 2002-01-22  Jim Meyering  <meyering@lucent.com>
6856
6857         * Makefile.am (Makefile): Don't depend on $(BUILT_SOURCES).
6858         Otherwise, some versions of automake would omit the rule that makes
6859         Makefile from Makefile.in.
6860
6861 2001-01-21  Paul Eggert  <eggert@twinsun.com>
6862
6863         * xmemcoll.h, xmemcoll.c: New files.
6864         * Makefile.am (libfetish_a_SOURCES): Add them.
6865         * memcoll.c: Include errno.h, and declare errno if not defined.
6866         (memcoll): Set errno to zero if there is no error.
6867
6868         * quotearg.c (quotearg_buffer_restyled):
6869         Fix bug with quoting buffers containing NUL when backslashing escapes.
6870         This bug was exposed by the other changes in this patch.
6871         (quotearg_n_options): New arg ARGSIZE.
6872         All callers changed.
6873         (quoting_options_from_style): New function.
6874         (quotearg_n_style): Use it.
6875         (quotearg_n_style_mem): New function.
6876
6877         * quotearg.h (quotearg_n_style_mem): New function.
6878
6879 2002-01-16  Jim Meyering  <meyering@lucent.com>
6880
6881         * getdate.y: Add three semicolons, each just before a closing brace.
6882         Bison (as of version 1.31) no longer papers over that mistake.
6883
6884 2002-02-14  Paul Eggert  <eggert@twinsun.com>
6885
6886         * backupfile.c (ISDIGIT): Comment fix.
6887         * getdate.y (ISDIGIT): Likewise.
6888         * posixtm.c (ISDIGIT, year): Likewise.
6889         * strverscmp.c (ISDIGIT): Likewise.
6890         * userspec.c (ISDIGIT): Likewise.
6891
6892 2002-01-05  Jim Meyering  <meyering@lucent.com>
6893
6894         * version-etc.c (version_etc_copyright): Update copyright year.
6895
6896 2001-01-19  Paul Eggert  <eggert@twinsun.com>
6897
6898         * closeout.c (close_stdout_status): If ferror (stdout), do
6899         not silently exit merely because the output buffer happens to
6900         have nothing pending.
6901
6902 2001-12-18  Paul Eggert  <eggert@twinsun.com>
6903
6904         See the big note in ../ChangeLog.
6905         * human.c (suffixes): Prefer K to k for 1024.
6906         (generate_suffix_backwards): New function.
6907         (human_readable_inexact): Use it.
6908         * xstrtol.c (__xstrtol): If there is no number but there
6909         is a valid suffix, assume 1.  "MB" now means decimal, "MiB" binary.
6910         Accept 'K' as well as 'k'.
6911
6912 2001-12-15  Jim Meyering  <meyering@lucent.com>
6913
6914         * regex.h (__restrict_arr): Update from libc.
6915
6916         * mountlist.h (ME_REMOTE): Recognize file systems of type smbfs
6917         as `remote' if the name starts with `//'.  Suggested by Michael Stone.
6918         (STREQ): Define.
6919
6920 2001-12-10  Jim Meyering  <meyering@lucent.com>
6921
6922         * linebuffer.c: Remove explicit declarations of xmalloc and xrealloc,
6923         Instead, include "xalloc.h".
6924         (initbuffer): Don't cast xmalloc return value to char*.
6925         (readline): Reword comment.
6926         Don't cast xrealloc return value to char*
6927         Return NULL, not 0.
6928
6929 2001-12-09  Jim Meyering  <meyering@lucent.com>
6930
6931         * modechange.c (mode_compile): Add cast to avoid pedantic warning about
6932         `signed and unsigned type in conditional expression'.
6933         * posixtm.c (posix_time_parse): Likewise.
6934
6935         * xreadlink.c (xreadlink): Add cast to avoid a pedantic warning.
6936
6937         * readtokens.c (readtoken): Declare an index to be of type unsigned
6938         to avoid a pedantic warning.
6939
6940         * getstr.c: Don't include assert.h.
6941         (getstr): Remove warning-evoking assertions.
6942         Return -1 if offset parameter is out of bounds.
6943         Change the type of a local from int to size_t.
6944
6945         * strftime.c (my_strftime_localtime_r): Include this function
6946         definition in the `#if ! HAVE_TM_GMTOFF' block.
6947
6948         * xgethostname.c: Remove declarations of xmalloc and xrealloc.
6949         Include xalloc.h instead.
6950
6951 2001-12-02  Jim Meyering  <meyering@lucent.com>
6952
6953         * tempname.c: Don't declare getenv, thus reverting the change of
6954         2001-11-18.  It's no longer necessary, now that stdlib.h is always
6955         included.
6956
6957         * regex.c [!__BOUNDED_POINTERS__]: Define away __bounded,
6958         __unbounded, and __ptrvalue.  Reported by Uwe H. Steinfeld.
6959
6960 2001-11-30  Akim Demaille  <akim@epita.fr>
6961
6962         * xstrdup.c: Include xalloc.h, so that xstrdup is declared
6963         before being defined.
6964
6965 2001-11-27  Paul Eggert  <eggert@twinsun.com>
6966
6967         * quotearg.h (quotearg_n, quotearg_n_style):
6968         First arg is int, not unsigned.
6969         * quotearg.c (quotearg_n, quotearg_n_style): Likewise.
6970         (SIZE_MAX, UINT_MAX): New macros.
6971         (quotearg_n_options): Abort if N is negative.
6972         Avoid overflow check on hosts where size_t is 64 bits and int
6973         is 32 bits, as overflow is impossible there.
6974         Fix off-by-one typo that caused unnecessary reallocation.
6975
6976 2001-11-27  Jim Meyering  <meyering@lucent.com>
6977
6978         * tempname.c: Merge with version from libc.
6979         * regex.c: Likewise.
6980
6981         * tempname.c: Include stdlib.h unconditionally.  On some old systems
6982         for which STDC_HEADERS is 0, it was not included, resulting in a
6983         warning about an integer-to-pointer conversion problem with getenv.
6984         Reported by Volker Borchert.
6985
6986 2001-11-26  Jim Meyering  <meyering@lucent.com>
6987
6988         * gtod.h: Remove file.
6989         * Makefile.am (libfetish_a_SOURCES): Remove gtod.h.
6990         * gettimeofday.c: Don't include gtod.h.
6991         (GTOD_init): Remove function.
6992         (rpl_gettimeofday): Do its job here instead, rather than aborting.
6993         Suggestion from Volker Borchert.
6994
6995 2001-11-23  Jim Meyering  <meyering@lucent.com>
6996
6997         * hash.h (struct hash_table): Don't define here.  Merely declare it.
6998         * hash.c (struct hash_table): Define it here instead.
6999
7000 2001-11-22  Jim Meyering  <meyering@lucent.com>
7001
7002         * hash.h: Bracket contents of file with #ifndef HASH_H_ ... #endif.
7003
7004 2001-11-18  Paul Eggert  <eggert@twinsun.com>
7005
7006         * tempname.c (TMP_MAX): Remove; no longer needed.
7007         (TEMPORARIES): New macro.
7008         (__gen_tempname): Use TEMPORARIES rather than TMP_MAX.  This
7009         removes an artificial limitation (e.g. HP-UX 10.20, where
7010         TMP_MAX is 17576).
7011
7012 2001-11-18  Jim Meyering  <meyering@lucent.com>
7013
7014         * tempname.c [!HAVE_DECL_GETENV]: Declare getenv to avoid warning
7015         on SunOS 4.
7016
7017         * Makefile.am (Makefile): Depend on $(BUILT_SOURCES), so those
7018         files will be created before anything else.
7019
7020 2001-11-17  Jim Meyering  <meyering@lucent.com>
7021
7022         * modechange.c (mode_adjust): Fix error introduced on 1999-04-26
7023         that made e.g., `chmod a=,o=w,g=o F' cause F to be group readable
7024         rather than group writable.  Patch by Juan F. Codagnone.
7025
7026         * readtokens.c: Remove explicit declarations of xmalloc and xrealloc,
7027         Instead, include "xalloc.h".
7028
7029         * mountlist.c: Include unlocked-io.h after all system headers.
7030         Remove explicit declarations of xmalloc, xrealloc,
7031         and xstrdup.  Instead, include "xalloc.h".
7032
7033         * argmatch.c, closeout.c, error.c, exclude.c: Include unlocked-io.h.
7034         * fatal.c, getdate.y, getpass.c, getstr.c, getusershell.c: Likewise.
7035         * mountlist.c, posixtm.c, readtokens.c, readutmp.c: Likewise.
7036
7037         * regex.c, sha.c, version-etc.c, yesno.c: Likewise.
7038         Reported by Padraig Brady.
7039
7040         * mkstemp.c: #undef mkstemp.
7041         Include config.h.
7042         (rpl_mkstemp): Rename from mkstemp.
7043         Protoize.
7044
7045 2001-11-16  Jim Meyering  <meyering@lucent.com>
7046
7047         * physmem.c [HAVE_SYS_PSTAT_H]: Include <sys/pstat.h>.
7048         (physmem_total) [HAVE_PSTAT_GETSTATIC]: If sysconf couldn't be used to
7049         determine the amount of total physical memory, use pstat_getstatic.
7050         HPUX-11 doesn't define _SC_PHYS_PAGES.
7051         (physmem_available) [HAVE_PSTAT_GETSTATIC && HAVE_PSTAT_GETDYNAMIC]:
7052         If sysconf couldn't be used to determine the amount of available
7053         physical memory, use both pstat_getstatic and pstat_getdynamic.
7054         Based on a patch from Bob Proulx.
7055
7056 2001-11-05  Jim Meyering  <meyering@lucent.com>
7057
7058         * xstat.in (slash_aware_lstat): Correct a misleading comment.
7059
7060 2001-11-03  Jim Meyering  <meyering@lucent.com>
7061
7062         * argmatch.h (ARGMATCH_TO_ARGUMENT): Remove casts of first two args
7063         in argmatch_to_argument call.
7064
7065         * dirfd.c (dirfd): Reflect the fact that DIR_TO_FD now takes an
7066         argument.
7067
7068         * hash.c (hash_clear): Fix a bug that could lead to an infloop or
7069         e.g., a fault due to an attempt to free a NULL pointer.
7070
7071 2001-11-01  Jim Meyering  <meyering@lucent.com>
7072
7073         * dirfd.c, dirfd.h: New files.
7074         * Makefile.am (libfetish_a_SOURCES): Add dirfd.h.
7075
7076         * hash.c (hash_print) [TESTING]: Clean up.
7077
7078 2001-10-22  Paul Eggert  <eggert@twinsun.com>
7079
7080         * hard-locale.c (alloca): Define to __builtin_alloca if __GNUC__,
7081         to avoid a warning if -Wall.
7082
7083 2001-10-21  Paul Eggert  <eggert@twinsun.com>
7084
7085         * regex.c (uintptr_t): Remove macro and decl; it's config.h's job.
7086
7087 2001-10-21  Jim Meyering  <meyering@lucent.com>
7088
7089         * obstack.c (_): Honor the setting of ENABLE_NLS.  Otherwise,
7090         this code would end up calling gettext even in packages built
7091         with --disable-nls.
7092         * getopt.c (_): Likewise.
7093         * regex.c (_): Likewise.
7094
7095 2001-10-20  Paul Eggert  <eggert@twinsun.com>
7096
7097         * error.c (strerror_r): Do not declare unless !_LIBC.
7098         Do not check for HAVE_DECL_STRERROR_R missing unless STRERROR_R_CHAR_P.
7099         Use strerror_r that is only a macro, even if it is not a function.
7100         (strerror): Check for HAVE_DECL_STRERROR before declaring.
7101         (private_strerror): Use prototypes, not old-style function definition.
7102         (print_errno_message): New function.
7103         Support the POSIX 'int'-flavored strerror_r, as well as the traditional
7104         char*-flavored one.
7105         (error_tail, error, error_at_line): Use it.
7106
7107 2001-10-11  Jim Meyering  <meyering@lucent.com>
7108
7109         * argmatch.c (argmatch_invalid): Use quotearg_n_style (0, ...
7110         and quote_n (1, ... to avoid clobbering a buffer.
7111
7112 2001-10-05  Jim Meyering  <meyering@lucent.com>
7113
7114         * Makefile.am: (libfetish_a_SOURCES): Add hash-pjw.c and hash-pjw.h.
7115         * hash-pjw.c: New file (factored out of fileutils' remove.c).
7116         * hash-pjw.h: New file.
7117
7118 2001-09-30  Jim Meyering  <meyering@lucent.com>
7119
7120         * mountlist.c [MOUNTED_GETFSSTAT]:
7121         Include <sys/ucred.h>, for Apple Darwin.
7122         Include sys/mount.h and sys/fs_types.h only if available.
7123         (FS_TYPE): Define.
7124         (read_filesystem_list): Use FS_TYPE.
7125
7126 2001-09-29  Paul Eggert  <eggert@twinsun.com>
7127
7128         * exclude.c (excluded_filename): 0 -> false, since it's
7129         a boolean context.
7130
7131 2001-09-28  Paul Eggert  <eggert@twinsun.com>
7132
7133         Fix bug reported by Petter Reinholdtsen for HP-UX 10.20, which
7134         #defines strtoimax.  Also treat the other strto* functions
7135         like strtoimax.
7136
7137         * xstrtol.c (strtol): Do not declare if HAVE_DECL_STRTOL.
7138         (strtoul): Do not declare if HAVE_DECL_STRTOUL.
7139         (strtoimax, strtoumax): Do not declare if already defined as a macro.
7140
7141 2001-09-26  Jim Meyering  <meyering@lucent.com>
7142
7143         Most macros in unlocked-io.h had the wrong number of arguments.
7144         * gen-uio: New script.
7145         (USE_UNLOCKED_IO): Define to 1 if not already defined.
7146         * unlocked-io.hin: Remove file.
7147         * Makefile.am (unlocked-io.h): Rewrite to use a separate script,
7148         rather than trying to embed it here.
7149         (EXTRA_DIST): Add gen-uio.  Remove unlocked-io.hin
7150         Reported by Padraig Brady.
7151
7152 2001-09-25  Volker Borchert  <bt@teknon.de>
7153
7154         * gettimeofday.c (rpl_gettimeofday): Declare local variable `result'.
7155
7156 2001-09-23  Jim Meyering  <meyering@lucent.com>
7157
7158         * mountlist.c: Remove useless parentheses in #if directives.
7159         (MOUNTED) [!defined MOUNTED]: Define to _PATH_MOUNTED, for when
7160         the deprecated MOUNTED symbol is no longer defined in mntent.h.
7161
7162 2001-09-22  Jim Meyering  <meyering@lucent.com>
7163
7164         * localcharset.c: Update from latest gettext.
7165         * config.charset: Likewise.
7166
7167 2001-09-20  Jim Meyering  <meyering@lucent.com>
7168
7169         * xstrtol.c (strtoimax): Guard declaration with
7170         `#if !HAVE_DECL_STRTOIMAX', rather than just `#ifndef strtoimax'.
7171         The latter fails because some systems (at least rs6000-ibm-aix4.3.3.0)
7172         have their own, conflicting declaration of strtoimax in sys/inttypes.h.
7173         (strtoumax): Likewise, for completeness (it wasn't necessary).
7174
7175 2001-09-06  Paul Eggert  <eggert@twinsun.com>
7176
7177         * strtoimax.c (HAVE_LONG_LONG):
7178         Redefine to HAVE_UNSIGNED_LONG_LONG if unsigned.
7179         (strtoimax): Use sizeof (long), not sizeof strtol (ptr, endptr, base),
7180         to work around bug in IBM C compiler.
7181
7182 2001-09-16  Jim Meyering  <meyering@lucent.com>
7183
7184         * mkdir.c: New file.
7185
7186 2001-09-04  Paul Eggert  <eggert@twinsun.com>
7187
7188         * xgetcwd.c: Revert some of the previous change; intead,
7189         fix the HAVE_GETCWD_NULL code to behave more like the
7190         !HAVE_GETCWD_NULL code used to.
7191
7192         Include "xalloc.h".
7193         (xgetcwd): Do not return NULL when memory is exhausted; instead,
7194         invoke xalloc_die.
7195
7196 2001-09-04  Paul Eggert  <eggert@twinsun.com>
7197
7198         * xreadlink.c (xreadlink): Omit size_t* arg.  All uses changed.
7199         Use ssize_t, not int, to store result of readlink.
7200         Check for ssize_t overflow as well as size_t overflow,
7201         as POSIX says the result of readlink is implementation-defined
7202         when ssize_t overflows.
7203         Remove unnecessary cast to char*.
7204         Use free+malloc instead of realloc, as the storage doesn't need
7205         to be preserved and it's clearer and can be more efficient that way.
7206         (SIZE_MAX, SSIZE_MAX): New macros, if <limits.h> doesn't declare.
7207         * xreadlink.h (xreadlink): Update prototype.
7208
7209 2001-09-03  Paul Eggert  <eggert@twinsun.com>
7210
7211         * exclude.c (fnmatch_no_wildcards): Fix confusion between
7212         usage of FNM_CASEFOLD and FNM_LEADING_DIR.  The bug was
7213         spotted by Jim Meyering.
7214
7215 2001-09-03  Jim Meyering  <meyering@lucent.com>
7216
7217         * xreadlink.c (xreadlink): Preserve errno around `free' during failure.
7218
7219 2001-09-03  Paul Eggert  <eggert@twinsun.com>
7220
7221         * xgetcwd.c: Fix the !HAVE_GETCWD_NULL code to behave more
7222         like the HAVE_GETCWD_NULL code.
7223         Include pathmax.h if not HAVE_GETCWD.
7224         Do not include xalloc.h.
7225         (INITIAL_BUFFER_SIZE): New symbol.
7226         Do not use xmalloc / xrealloc, since the caller is responsible for
7227         handling errors.  Preserve errno around `free' during failure.
7228         Do not overrun buffer when using getwd.
7229
7230 2001-09-03  Paul Eggert  <eggert@twinsun.com>
7231
7232         * xgetcwd.c (xgetcwd): Use HAVE_GETCWD_NULL, not (defined
7233         __GLIBC__ && __GLIBC__ >= 2), to decide whether to use getcwd (NULL, 0).
7234
7235 2001-09-02  Jim Meyering  <meyering@lucent.com>
7236
7237         * error.c: Update from GNU libc.
7238
7239 2001-09-01  Jim Meyering  <meyering@lucent.com>
7240
7241         * xreadlink.c: New file.
7242         * xreadlink.h: New file.
7243         * Makefile.am (libfetish_a_SOURCES): Add xreadlink.c and xreadlink.h.
7244
7245         * regex.c (uintptr_t) [!_LIBC]: Define to private_uintptr_t, so it
7246         doesn't conflict with sparc Solaris 7's definition in
7247         /usr/include/sys/int_types.h.
7248
7249         * exclude.c: Use `""', not `<>' to #include non-system header files.
7250         (fnmatch_no_wildcards): Rewrite not to use function names, strcasecmp
7251         and strncasecmp as r-values.  Unixware didn't have declarations.
7252
7253 2001-08-31  Jim Meyering  <meyering@lucent.com>
7254
7255         * xgetcwd.c (xgetcwd): Reorganize to avoid some duplication.
7256         Use an initial, malloc'd, buffer of length 128 rather than
7257         a statically allocated one of length 1024.
7258
7259 2001-08-30  Paul Eggert  <eggert@twinsun.com>
7260
7261         * xgetcwd.c: Don't include pathmax.h.
7262         Include stdlib.h and unistd.h if available.
7263         Include xalloc.h.
7264         (xmalloc, xstrdup, free): Remove decls.
7265         (xgetcwd): Don't assume sizes fit in unsigned.
7266         Check for overflow when computing sizes.
7267         Simplify reallocation code.
7268
7269 2001-08-28  Paul Eggert  <eggert@twinsun.com>
7270
7271         * Makefile.am (libfetish_a_SOURCES): Remove strtoxmax.c.
7272
7273         * strtoimax.c: Renamed from strtoxmax.c, removing the
7274         old strtoimax.c.
7275
7276         Also, make the following further changes to make this file's
7277         configuration more similar to that of strtol.c:
7278         (UNSIGNED): Renamed from STRTOUXMAX_UNSIGNED.  All uses changed.
7279         (strtoumax, uintmax_t, strtoull, strtol): Remove.
7280         (intmax_t, strtoimax, strtol, strtoll): New macros, if UNSIGNED.
7281         (strtoimax): Renamed from strtoumax.  All uses of unsigned values
7282         changed to signed values.
7283
7284         And make the following changes as well:
7285         Fix copyright notice, as 1999 was missing.
7286         (verify): New macro.
7287         (strtoimax): Check sizes at compile-time, not run-time.
7288         Prefer strtol to strtoll if both work.
7289         (main): Remove; it was not that useful and was a pain to maintain.
7290
7291         * strtoumax.c: Include strtoimax.c, not strtouxmax.c.
7292
7293 2001-08-30  Paul Eggert  <eggert@twinsun.com>
7294
7295         * savedir.c (savedir): Remove size parameter, as POSIX says that
7296         a directory's st_size can have an arbitrary value, so the old
7297         usage could waste an arbitrary amount of memory.  All uses
7298         changed.
7299         * savedir.h: Update prototype.
7300
7301 2001-08-30  Paul Eggert  <eggert@twinsun.com>
7302
7303         * xstrtol.c (strtoimax): New decl.
7304
7305 2001-08-28  Paul Eggert  <eggert@twinsun.com>
7306
7307         * xstrtol.h: Add copyright notice.
7308         (_DECLARE_XSTRTOL): Improve quality of diagnostic for
7309         LONGINT_INVALID_SUFFIX_CHAR.
7310
7311 2001-08-30  Paul Eggert  <eggert@twinsun.com>
7312
7313         * quotearg.c: BSD/OS 4.1 wchar.h requires FILE and struct
7314         tm to be declared.
7315
7316 2001-08-30  Paul Eggert  <eggert@twinsun.com>
7317
7318         * hash.c: Remove '2001' from copyright notice.
7319
7320 2001-08-30  Paul Eggert  <eggert@twinsun.com>
7321
7322         * full-write.h: New file.
7323         * Makefile.am (libfetish_a_SOURCES): Add full-write.h.
7324         * full-write.c: Correct credits, as cccp.c no longer
7325         exists and anyway it was so heavily changed from the old cccp
7326         code as to be unrecognizable.  Include full-write.h.
7327         (full_write) Return size_t, with short writes meaning failure.
7328         All callers changed.  This fixes a bug with large buffers
7329         on 64-bit hosts.
7330         * utime.c: Include full-write.h.
7331
7332 2001-08-30  Paul Eggert  <eggert@twinsun.com>
7333
7334         Merge 'exclude' changes from tar 1.13.22.
7335         This fixes one or two unlikely storage allocation overflow bugs,
7336         but doesn't change user-visible behavior otherwise.
7337
7338 2001-08-30  Paul Eggert  <eggert@twinsun.com>
7339
7340         * exclude.c (bool): Declare, perhaps by including stdbool.h.
7341         (<sys/types.h>): Include only if HAVE_SYS_TYPES_H.
7342         (<stdlib.h>, <string.h>, <strings.h>, <inttypes.h>, <stdint.h>):
7343         Include if available.
7344         (<xalloc.h>): Include
7345         (SIZE_MAX): Define if <stdint.h> or <inttypes.h> doesn't.
7346         (verify): New macro.  Use it to verify that EXCLUDE macros do not
7347         collide with FNM macros.
7348         (struct patopts): New struct.
7349         (struct exclude): Use it, as exclude patterns now come with options.
7350         (new_exclude): Support above changes.
7351         (new_exclude, add_exclude_file):
7352         Initial size must now be a power of two to simplify overflow checking.
7353         (free_exclude, fnmatch_no_wildcards): New function.
7354         (excluded_filename): No longer requires options arg, as the options
7355         are determined by add_exclude.  Now returns bool, not int.
7356         (excluded_filename, add_exclude):
7357         Add support for the fancy new exclusion options.
7358         (add_exclude, add_exclude_file): Now takes int options arg.
7359         Check for arithmetic overflow when computing sizes.
7360         (add_exclude_file): xrealloc might modify errno, so don't
7361         realloc until after errno might be used.
7362
7363         * exclude.h (EXCLUDE_ANCHORED, EXCLUDE_INCLUDE,EXCLUDE_WILDCARDS):
7364         New macros.
7365         (free_exclude): New decl.
7366         (add_exclude, add_exclude_file): Now takes int options arg.
7367         (excluded_filename): No longer requires options arg, as the options
7368         are determined by add_exclude.  Now returns bool, not int.
7369
7370 2001-08-30  Paul Eggert  <eggert@twinsun.com>
7371
7372         * alloca.c (alloca): Arg is of type size_t, not unsigned.
7373
7374 2001-08-27  Jim Meyering  <meyering@lucent.com>
7375
7376         * Makefile.am (libfetish_a_SOURCES): Add strtoxmax.c
7377
7378         * version-etc.c (N_): Remove definition.
7379         Revert most of last change.
7380         Instead, simply don't mark the `Copyright...' string for translation.
7381         Based on advice from Paul Eggert.
7382
7383         * strtoxmax.c: Tweak comment.
7384
7385 2001-08-26  Jim Meyering  <meyering@lucent.com>
7386
7387         * version-etc.c (version_etc_copyright_fmt): Replace literal year
7388         of copyright with `%s' so translators don't get an untranslated
7389         message in 2002.
7390         (COPYRIGHT_YEAR): Define.
7391         (version_etc): Use fprintf rather than fputs.
7392         Suggestion from Ulrich Drepper.
7393
7394         * Makefile.am (libfetish_a_SOURCES): Add xstrtoimax.c.
7395
7396         * strtoll.c: New file, from GNU libc.
7397         * xstrtoimax.c: New file.
7398
7399         * xstrtol.h: Add xstrtoimax.
7400         * strtoumax.c: New file.  Simply include "strtoumax.c".
7401         * strtoimax.c: New file.  Likewise, but first define STRTOUXMAX_SIGNED.
7402
7403         * strtoumax.c: Factor to work both for unsigned and signed types, ...
7404         * strtoxmax.c: ... then renamed to this.
7405
7406 2001-08-13  Paul Eggert  <eggert@twinsun.com>
7407
7408         * Makefile.am (unlocked-io.h): Do not append "_unlocked" twice.
7409         Port to Solaris 8, where 'sed' requires a space after the 'r'
7410         command, and where sh dislikes "$/".  Clean up the spacing a bit.
7411         Redirect output to $tmp just once.
7412
7413 2001-08-12  Paul Eggert  <eggert@sic.twinsun.com>
7414
7415         * addext.c (<errno.h>): Include.
7416         (errno): Declare if not defined.
7417         (addext): Work correctly when pathconf returns -1 and leaves
7418         errno alone because there is no limit.  Also, work even if
7419         pathconf returns a value greater than SIZE_MAX.
7420
7421 2001-08-12  Jim Meyering  <meyering@lucent.com>
7422
7423         * xgetcwd.c (xgetcwd) [defined __GLIBC__ && __GLIBC__ >= 2]:
7424         Simply `return getcwd (NULL, 0);'.
7425         [! (defined __GLIBC__ && __GLIBC__ >= 2)]:
7426         Use 1300 as initial value for length, not PATH_MAX.
7427
7428         * pathmax.h: Clean up cpp syntax.
7429
7430 2001-08-12  Jim Meyering  <meyering@lucent.com>
7431
7432         * gettimeofday.c: New file.
7433         * gtod.h: New file.
7434         * Makefile.am (libfetish_a_SOURCES): Add gtod.h.
7435
7436 2001-08-04  Jim Meyering  <meyering@lucent.com>
7437
7438         * error.h (__attribute__): Remove `|| __STRICT_ANSI__' from #if stmt,
7439         to get in sync with glibc.
7440
7441 2001-08-03  Paul Eggert  <eggert@twinsun.com>
7442
7443         The following changes are from gettext 0.10.39 as maintained by
7444         Bruno Haible.
7445
7446         * mbswidth.h (MBSW_REJECT_UNPRINTABLE, MBSW_REJECT_INVALID):
7447         Renamed from MBSW_ACCEPT_UNPRINTABLE and MBSW_ACCEPT_INVALID
7448         with inverted sense.  All uses changed.
7449
7450         * mbswidth.c: Don't include <limits.h>.
7451         Include <stdlib.h> and <string.h> unconditionally.
7452         (iswcntrl, mbsinit, ISCNTRL): New macros.
7453         (mbsnwidth): Use K&R style function declarations.
7454         Don't bother checking for MB_LEN_MAX == 1, since the compiler
7455         can optimize it when MB_CUR_MAX == 1.
7456         The width of control characters is zero, not 1.
7457
7458 2001-07-15  Jim Meyering  <meyering@lucent.com>
7459
7460         * Makefile.am (EXTRA_DIST): Add unlocked-io.hin.
7461         (BUILT_SOURCES): Add unlocked-io.h.
7462         (io_functions): Define.
7463         (unlocked-io.h): New rule.
7464         (DISTCLEANFILES): Add unlocked-io.h.
7465         (all-local): Depend on unlocked-io.h, to ensure it is created.
7466
7467         * unlocked-io.hin: New file
7468
7469         * regex.c: Update from glibc.
7470
7471 2001-07-05  Jim Meyering  <meyering@lucent.com>
7472
7473         * Makefile.am (noinst_HEADERS): Remove definition, per new automake
7474         recommendation.
7475         (libfetish_a_SOURCES): Put all .h files here instead.
7476         Remove a thus-exposed (better checks in automake) duplicate and
7477         two unnecessary .h files.
7478
7479 2001-06-11  Jim Meyering  <meyering@lucent.com>
7480
7481         * regex.c: Update from GNU libc.
7482
7483 2001-05-27  Jim Meyering  <meyering@lucent.com>
7484
7485         * readutmp.h (UT_TYPE): Define.
7486
7487 2001-05-24  Jim Meyering  <meyering@lucent.com>
7488
7489         * argmatch.c: Include "quote.h".
7490         (argmatch_invalid): Remove explicit `' quotes.  Instead, use the
7491         quote function.  Reported by Göran Uddeborg.
7492
7493 2001-05-20  Alexandre Duret-Lutz  <duret_g@epita.fr>
7494
7495         * dirname.c (dir_name): Compute append_dot using path, not newpath
7496         which is not yet declared.
7497
7498 2001-05-11  Paul Eggert  <eggert@twinsun.com>
7499
7500         * Makefile.am (libfetish_a_SOURCES):
7501         Add strftime.c, since we now compile it on all hosts.
7502
7503         * strftime.c (my_strftime):
7504         Define to nstrftime if emacs, but only if my_strftime is not defined.
7505         (extra_args, extra_args_spec, extra_args_spec_iso): Rename from
7506         ut_argument, ut_argument_spec, ut_argument_spec_iso, respectively.
7507         Add one more extra argument: a nanoseconds value.
7508         All uses changed.
7509         (ns): New macro.
7510         (my_strftime function): Add %N format.
7511         (emacs_strftimeu): Renamed from emacs_strftime,
7512         with extra ut argument.
7513
7514 2001-05-11  Paul Eggert  <eggert@twinsun.com>
7515
7516         dirname code cleanup.  base_name now behaves more compatibly
7517         with POSIX basename when given file names that have trailing
7518         slashes, and similarly for dir_name.  Add new primitives
7519         base_len and dir_len.  Put the directory-name-related decls
7520         into dirname.h.
7521
7522         * addext.c (ISSLASH, base_name): Remove; now in dirname.h.
7523         * backupfile.c (base_name): Likewise.
7524         * basename.c (FILESYSTEM_PREFIX_LEN, PARAMS, ISSLASH): Likewise.
7525         * dirname.c (FILESYSTEM_PREFIX_LEN, ISSLASH): Likewise.
7526         * makepath.c (strip_trailing_slashes): Likewise.
7527         * path-concat.c (DIRECTORY_SEPARATOR, FILESYSTEM_PREFIX_LEN, ISSLASH):
7528         Likewise.
7529         * rename.c (strip_trailing_slashes): Likewise.
7530         * same.c (base_name): Likewise.
7531         * stripslash.c (ISSLASH): Likewise.
7532
7533         * addext.c: Include <dirname.h> after size_t is defined.
7534         * backupfile.c: Likewise.
7535
7536         * addext.c (addext): Use base_len to trim redundant
7537         trailing slashes instead of doing it ourselves.
7538         But do not trim the last slash if it is not redundant.
7539
7540         * backupfile.c (find_backup_file_name,
7541         max_backup_version): Use base_len instead of rolling it ourselves.
7542         Handle the case of "" and (on DOS) "C:" correctly.
7543
7544         * basename.c: Do not include <stdio.h>, <assert.h>; no longer needed.
7545         Include <string.h>, <dirname.h>.
7546         (base_name): Allow file names ending in slashes, other than names
7547         that are all slashes.  In this case, return the basename followed
7548         by the slashes.  This is more general, and can be used in places
7549         where the original base_name purposely had an assertion failure.
7550         (base_len): New function.
7551
7552         * dirname.c: Include <string.h> instead of <stdlib.h>.
7553         Do not include <assert.h>; no longer needed.
7554         Include xalloc.h.
7555         (memrchr): Remove decl.
7556         (dir_name_r): Remove.
7557         (dir_len): Renamed from dirlen.  All callers changed.
7558         Rewrite in terms of base_name, for simplicity and consistency.
7559         (dir_name): Never return NULL.  All callers changed.
7560         Do not include <stdlib.h> in test program; no longer needed.
7561         return 0; is fine for test program.
7562
7563         * dirname.h (DIRECTORY_SEPARATOR, ISSLASH, FILESYSTEM_PREFIX_LEN):
7564         New macros.
7565         (base_name, base_len, dir_len, strip_trailing_slashes): New decls.
7566
7567         * path-concat.c (path_concat): Use base_len to compute
7568         base length, not strlen; this means we cannot rely on memcpy
7569         to null-terminate.
7570
7571         * same.c (STREQ): Remove.
7572         (same_name): Handle the case where the basename ends in trailing '/'.
7573
7574         * stripslash.c (strip_trailing_slashes): Return nonzero if
7575         a slash was stripped.  Do not strip the last slash after a
7576         file system prefix.
7577
7578 2001-04-08  Jim Meyering  <meyering@lucent.com>
7579
7580         * getdate.y (get_date): Set tm_isdst to -1 to ensure that it is
7581         recomputed; that's necessary when the offset spans a DST transition.
7582         Patch by David J. MacKenzie.  Reported by Hon-Yin Kok.
7583
7584 2001-04-02  Jim Meyering  <meyering@lucent.com>
7585
7586         * regex.h, regex.c: Update from GNU libc.
7587
7588 2001-03-19  Paul Eggert  <eggert@twinsun.com>
7589
7590         * version-etc.c (version_etc_copyright): Update to 2001.
7591
7592 2001-03-16  Paul Eggert  <eggert@twinsun.com>
7593
7594         * tempname.c (uint64_t): Define to uintmax_t if
7595         not defined, and if UINT64_MAX is not defined.
7596         Required at least for Vax Ultrix4.3, which doesn't define uint64_t.
7597         Reported by John David Anglin.
7598
7599 2001-03-10  Bruno Haible  <haible@clisp.cons.org>
7600
7601         * localcharset.c (locale_charset): Allow wildcard syntax. Also resolve
7602         alias if codeset is empty.
7603         * config.charset (BeOS): Use wildcard syntax.
7604
7605 2001-03-13  Jim Meyering  <meyering@lucent.com>
7606
7607         * path-concat.c (path_concat) [FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX]:
7608         Don't insert a backslash when concatenating e.g., `C:' and `foo'.
7609         From Bruno Haible.
7610
7611 2001-03-06  Bruno Haible  <haible@clisp.cons.org>
7612
7613         * localcharset.c (locale_charset): Don't use setlocale(LC_CTYPE,NULL).
7614         Don't return NULL.
7615         * unicodeio.c (print_unicode_char): Simplify accordingly.
7616
7617 2001-03-06  Bruno Haible  <haible@clisp.cons.org>
7618
7619         * config.charset: Update for FreeBSD 4.2 and OSF/1 5.1. Add
7620         support for DOS/DJGPP.
7621
7622 2001-02-28  Paul Eggert  <eggert@twinsun.com>
7623
7624         * Makefile.am (libfetish_a_SOURCES):
7625         Add dup-safer.c, fopen-safer.c.
7626         (noinst_HEADERS): Add stdio-safer.h, unistd-safer.h.
7627
7628         * dup-safer.c, fopen-safer.c, stdio-safer.h, unistd-safer.h: New files.
7629
7630 2001-02-25  Paul Eggert  <eggert@twinsun.com>
7631
7632         The mkstemp replacement is taken from glibc 2.2.2, with some
7633         portability fixes for use outside glibc, as follows:
7634
7635         * tempname.c (struct_stat64): New macro.
7636         (direxists, __gen_tempname): Use it.
7637         This avoids a portability problem with Solaris 8.
7638
7639         * tempname.c (<config.h>): Include if HAVE_CONFIG_H.
7640         (<stddef.h>, <stdint.h>, <string.h>):
7641         Include only if STDC_HEADERS || _LIBC.
7642         (<fcntl.h>): Include only if HAVE_FCNTL_H || _LIBC.
7643         (<unistd.h>): Include only if HAVE_UNISTD_H || _LIBC.
7644         (<sys/time.h>): Include only if HAVE_SYS_TIME_H || _LIBC.
7645         (__set_errno): Define this macro if <errno.h> doesn't.
7646         (P_tmpdir, TMP_MAX, __GT_FILE, __GT_BIGFILE, __GT_DIR, __GT_NOCREATE):
7647         Define these macros if <stdio.h> doesn't.
7648         (S_ISDIR, S_IRUSR, S_IWUSR, S_IXUSR):
7649         Define these macros if <sys/stat.h>
7650         doesn't.  Ignore <sys/stat.h> S_ISDIR if STAT_MACROS_BROKEN.
7651         (stat64, __getpid, __gettimeofday, __mkdir, __open, __open64, lxstat64,
7652         __xstat64): Define if not _LIBC.
7653         (__secure_getenv): Define if ! (HAVE___SECURE_GETENV || _LIBC).
7654         (__gen_tempname): Invoke gettimeofday only if
7655         HAVE_GETTIMEOFDAY || _LIBC;
7656         otherwise, fall back on plain "time".
7657         Use macros like S_IRUSR | S_IWUSR rather than octal values like 0600.
7658
7659         * mkstemp.c (__GT_FILE): Define to zero if not defined.
7660
7661         * mkstemp.c, tempname.c: New files, taken from glibc 2.2.2.
7662
7663 2001-02-17  Jim Meyering  <meyering@lucent.com>
7664
7665         * strtoul.c: Sync from GNU libc.  Use double quotes, not <...>
7666         around included file name.
7667
7668         * strnlen.c (__strnlen): Merge in a change from GNU libc.
7669
7670         * strftime.c: Update from GNU libc (the only changes were to comments).
7671
7672 2001-02-13  Bruno Haible  <haible@clisp.cons.org>
7673
7674         * mbswidth.h (mbswidth): Also define as macro, to avoid prototype clash.
7675
7676 2001-02-17  Paul Eggert  <eggert@twinsun.com>
7677
7678         * mbswidth.c, quotearg.c (mbrtowc, mbsinit):
7679         Remove workaround macros for hosts that have mbrtowc but not
7680         mbstate_t, as we now insist on proper declarations for both
7681         before using mbrtowc.
7682
7683 2001-02-17  Jim Meyering  <meyering@lucent.com>
7684
7685         * regex.c: Update from libc.
7686
7687 2001-02-16  Paul Eggert  <eggert@twinsun.com>
7688
7689         * alloca.c (malloc): Undef before defining, since stdlib.h
7690         may have defined it.  Needed for Encore Umax-3.0.9.16b systems.
7691         Reported by Mark Hounschell via Paul Eggert.
7692
7693 2001-01-30  Bruno Haible  <haible@clisp.cons.org>
7694
7695         * config.charset: Update for FreeBSD 4.2.
7696
7697 2001-01-26  Jim Meyering  <meyering@lucent.com>
7698
7699         * quotearg.c: Include stddef.h.
7700         * quote.c: Include stddef.h.
7701         Reported by Axel Kittenberger.
7702
7703         * xmalloc.c [HAVE_DONE_WORKING_MALLOC_CHECK]: Enclose error-evoking
7704         line in double quotes so that it evokes a better diagnostic.
7705         [HAVE_DONE_WORKING_REALLOC_CHECK]: Likewise.
7706         Reported by Axel Kittenberger.
7707
7708 2001-01-15  Bruno Haible  <haible@clisp.cons.org>
7709
7710         * unicodeio.c (print_unicode_char): Cast the second iconv() arg,
7711         to avoid a warning.  Add back 'const' to inptr.
7712
7713 2001-01-16  Jim Meyering  <meyering@lucent.com>
7714
7715         * basename.c: Include <stdio.h>, needed by assert on SunOS 4.
7716         From Bruno Haible.
7717
7718 2001-01-14  Jim Meyering  <meyering@lucent.com>
7719
7720         * rename.c: New file.  From Volker Borchert.
7721         Include stdlib.h, string.h or strings.h, and xalloc.h.
7722         Use strip_trailing_slashes rather than open-coding it.
7723
7724 2001-01-03  Paul Eggert  <eggert@twinsun.com>
7725
7726         * strftime.c: Sync with glibc time/strftime.c 1.81.
7727
7728 2001-01-03  Jim Meyering  <meyering@lucent.com>
7729
7730         * unicodeio.c (print_unicode_char): Remove `const' from declaration of
7731         local `inptr' to avoid warning with some system declarations of iconv.
7732
7733 2000-12-29  Paul Eggert  <eggert@twinsun.com>
7734
7735         * modechange.c: Do not assume that mode_t uses the
7736         traditional octal encoding.  E.g. "chmod 1 FOO" should set
7737         the other-execute bit of FOO even if S_IXOTH != 1.
7738
7739         (SUID, SGID, SVTX, RUSR, WUSR, XUSR, RGRP, WGRP, XGRP, ROTH,
7740         WOTH, XOTH, ALLM): New macros.
7741         (S_ISUID, S_ISGID, S_ISVTX, S_IRUSR, S_IWUSR, S_IXUSR,
7742          S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH, S_IXOTH):
7743         Use them.
7744         (S_ISGID): Fix typo; it was defaulting to the same value as S_ISUID.
7745         (S_IRWXU, S_IRWXG, S_IRWXO): Specify defaults in terms of the above.
7746         (mode_compile):
7747         No need to use uintmax_t; unsigned long is long enough.
7748         Don't bother to get suffix since we don't use it.
7749
7750 2000-12-24  Jim Meyering  <meyering@lucent.com>
7751
7752         * hash.c (is_prime): Return explicit boolean values.
7753         (hash_get_first): Return NULL to appease Irix5.6's 89.
7754         Reported by Nelson Beebe.
7755
7756 2000-10-31  Bruno Haible  <haible@clisp.cons.org>
7757
7758         * localcharset.c (locale_charset): Add support for Win32.
7759
7760 2000-12-18  Paul Eggert  <eggert@twinsun.com>
7761
7762         * physmem.h, physmem.c: New files.
7763
7764         * Makefile.am (libfetish_a_SOURCES): Add physmem.c.
7765         (noinst_HEADERS): Add physmem.h.
7766
7767         * xstrtol.c (__xstrtol): Add undocumented suffixes 'g' and
7768         't' for compatibility with Solaris 8 sort.
7769
7770 2000-12-18  Bruno Haible  <haible@clisp.cons.org>
7771
7772         * config.charset: Add support for BeOS.
7773
7774 2000-12-16  Jim Meyering  <meyering@lucent.com>
7775
7776         * getusershell.c [!SHELLS_FILE && __DJGPP__]: Define
7777         SHELLS_FILE to a file name that's useful on djgpp systems.
7778         Include stdlib.h.
7779         (ADDITIONAL_DEFAULT_SHELLS): Define.
7780         (default_shells): Prepend ADDITIONAL_DEFAULT_SHELLS.
7781         Based mostly on a patch from Prashant TR.
7782
7783 2000-12-16  Jim Meyering  <meyering@lucent.com>
7784
7785         This bug had a serious impact on chown: `chown N:M FILE' (for integer
7786         N and M) would have treated it like `chown N:N FILE'.
7787
7788         * userspec.c (parse_user_spec): Fix typo: s/u/g/.
7789
7790 2000-10-31  Bruno Haible  <haible@clisp.cons.org>
7791
7792         * config.charset: Add ISO-8859-3, BIG5HKSCS, GB18030, JOHAB, VISCII,
7793         CP874, CP949, CP950, CP1250, CP1253, CP1254, CP1255, CP1256, CP1257
7794         to the list of canonical encodings. Rename EUC-CN to GB2312.
7795
7796 2000-12-08  Andreas Schwab  <schwab@suse.de>
7797
7798         * mbswidth.c (mbsnwidth): Don't loop endlessly when called with an
7799         invalid mulitbyte sequence and with the MBSW_ACCEPT_INVALID flag set.
7800
7801 2000-12-07  Jim Meyering  <meyering@lucent.com>
7802
7803         * stripslash.c (ISSLASH): Define.
7804         (strip_trailing_slashes): Use ISSLASH rather than comparing against `/'.
7805         From Prashant TR.
7806
7807         * dirname.c (FILESYSTEM_PREFIX_LEN): Define.
7808         (dir_name_r): Declare this function as static.
7809         [BACKSLASH_IS_PATH_SEPARATOR]: Fix a bug that'd
7810         manifest itself on a name containing a mix of slashes and
7811         backslashes.
7812         Make this function work with names starting with a DOS-style
7813         drive letter and colon prefix.
7814         (dir_name): Append `.' if necessary.
7815         Based mostly on patches from Prashant TR and Eli Zaretskii.
7816
7817         * dirname.h (dir_name_r): Remove prototype.
7818
7819 2000-12-05  Jim Meyering  <meyering@lucent.com>
7820
7821         * dirname.c (dir_name_r): Add `const' in a few local declarations.
7822
7823 2000-12-04  Jim Meyering  <meyering@lucent.com>
7824
7825         * path-concat.c: [!HAVE_DECL_MALLOC]: Declare malloc.
7826         Also include memory.h, stdlib.h, unistd.h if appropriate.
7827         Reported by Andreas Jaeger (conflicting declaration of malloc).
7828
7829 2000-12-02  Jim Meyering  <meyering@lucent.com>
7830
7831         * closeout.h: Make idempotent, to avoid some obscure warnings.
7832
7833 2000-12-01  Paul Eggert  <eggert@twinsun.com>
7834
7835         * memrchr.c: Include <config.h> before any system include file.
7836
7837 2000-11-29  Paul Eggert  <eggert@twinsun.com>
7838
7839         * dirname.c (dir_name_r): Fix typo: int -> size_t.
7840
7841 2000-11-26  Jim Meyering  <meyering@lucent.com>
7842
7843         * memcoll.c: Include sys/types.h.  From Werner Almesberger.
7844
7845 2000-11-22  Paul Eggert  <eggert@twinsun.com>
7846
7847         * strftime.c (my_strftime): Do not invoke mbrlen with a
7848         size of (size_t) -1; it's not portable.
7849
7850 2000-11-17  Akim Demaille  <akim@epita.fr>
7851
7852         * obstack.h: Formatting changes.
7853         (obstack_grow, obstack_grow0): Don't cast WHERE at all: that would
7854         prevent type checking.
7855         (obstack_ptr_grow, obstack_ptr_grow_fast): When assigning, don't
7856         cast the value to (void *): assigning a `foo *' to a `void *'
7857         variable is valid.
7858         (obstack_int_grow, obstack_int_grow_fast): Don't cast AINT to int.
7859
7860 2000-11-17  Jim Meyering  <meyering@lucent.com>
7861
7862         * strstr.c: Update from GNU libc.
7863
7864 2000-11-16  Jim Meyering  <meyering@lucent.com>
7865
7866         * strverscmp.c: Incorporate weak-alias-related changes from glibc.
7867
7868 2000-11-11  Jim Meyering  <meyering@lucent.com>
7869
7870         * error.c: Add a couple #includes, merging from GNU libc version.
7871
7872 2000-11-10  Jim Meyering  <meyering@lucent.com>
7873
7874         * obstack.h: Update from GNU libc.
7875         * obstack.c: Likewise.
7876
7877 2000-11-06  Paul Eggert  <eggert@twinsun.com>
7878
7879         * getusershell.c (setusershell): Use rewind rather than
7880         fseek/fseeko, to avoid configuration hassles with fseeko.
7881         Don't bother opening SHELLS_FILE if shellstream is NULL;
7882         it's not necessary.
7883
7884 2000-11-05  Jim Meyering  <meyering@lucent.com>
7885
7886         * makepath.h (make_dir): Declare.
7887         * makepath.c (make_dir): Remove `static' attribute.
7888         Tweak a comment.
7889
7890 2000-11-04  Alexandre Duret-Lutz  <duret_g@epita.fr>
7891
7892         * hash.c (hash_get_next): Fix a thinko:  when ENTRY is the
7893         last one in a bucket, advance to the next bucket.
7894
7895 2000-11-02  Vesselin Atanasov  <vesselin@bgnet.bg>
7896
7897         * fnmatch.c: Do not comment out all the code if we are using
7898         the GNU C library, because in some cases we are replacing buggy
7899         code in the GNU C library itself.
7900
7901 2000-10-30  Paul Eggert  <eggert@twinsun.com>
7902
7903         * error.h, getline.h, modechange.h:
7904         Remove "2000" from Copyright line, as the file hasn't been
7905         changed this year other than in the copyright notice.
7906
7907         * xalloc.h: Add "2000" to Copyright line, as this file
7908         was changed this year.
7909
7910 2000-10-30  Paul Eggert  <eggert@twinsun.com>
7911
7912         * fnmatch.c (FOLD): Do not assume that characters are unsigned.
7913         (fnmatch): Fix some FNM_FILE_NAME and FNM_LEADING_DIR bugs,
7914         e.g. fnmatch("d*/*1", "d/s/1", FNM_FILE_NAME) incorrectly yielded zero.
7915
7916 2000-10-29  Greg Louis  <glouis@dynamicro.on.ca>
7917
7918         * regex.h (__restrict_arr): Move definition out of #ifndef block.
7919         Required because egcs-2.91.66 (aka 1.1.2) defines __restrict, but
7920         doesn't define __restrict_arr.
7921
7922 2000-10-29  Jim Meyering  <meyering@lucent.com>
7923
7924         * xstat.in: Fix grammar in comment.
7925
7926 2000-10-28  Jim Meyering  <meyering@lucent.com>
7927
7928         * memchr.c: Update from libc.
7929         Adjust for portability:
7930         [HAVE_STDLIB_H]: Include stdlib.h.
7931         [HAVE_BP_SYM_H || _LIBC]: Guard inclusion of bp-sym.h.
7932         Undef __memchr, too.
7933         [!weak_alias]: Define __memchr to memchr.
7934
7935         * regex.c: Update from libc.
7936         * regex.h: Likewise.
7937         * getopt1.c: Likewise.
7938         * memcmp.c: Likewise.
7939
7940         * getusershell.c (setusershell) [HAVE_FSEEKO]: Use fseeko.
7941         Avoid using fseek, when possible -- it's broken by design.
7942         Patch by Ulrich Drepper.
7943
7944 2000-10-26  Jim Meyering  <meyering@lucent.com>
7945
7946         * strftime.c: Update from libc.
7947
7948 2000-10-25  Jim Meyering  <meyering@lucent.com>
7949
7950         * obstack.c: Update from libc.
7951
7952 2000-10-23  Jim Meyering  <meyering@lucent.com>
7953
7954         * hard-locale.c (hard_locale): Revert last change -- it was simply
7955         wrong.  That set_locale call must not have any side effects.
7956         From Paul Eggert.
7957
7958 2000-10-22  Jim Meyering  <meyering@lucent.com>
7959
7960         * md5.c (md5_process_block) [OP]: Use `rol', not CYCLIC.
7961         [CYCLIC]: Remove now-unused definition.
7962
7963         * save-cwd.c (O_DIRECTORY): Define, if needed.
7964         (save_cwd) [HAVE_FCHDIR]: Use O_DIRECTORY when opening ".".
7965         Suggestion from Ulrich Drepper.
7966
7967 2000-10-21  Jim Meyering  <meyering@lucent.com>
7968
7969         * dirname.c (dir_name_r): New function, factored out of dir_name.
7970         (dir_name): Use dir_name_r.
7971         * dirname.h (dir_name_r): Declare it.
7972
7973 2000-10-21  Jim Meyering  <meyering@lucent.com>
7974
7975         * dirname.c (memrchr): Declare if necessary.
7976         (dir_name): Remove the restriction that there be no
7977         trailing slashes.  Now, this code skips past them, effectively
7978         ignoring them.
7979         [TEST_DIRNAME] (main): New unit tests.
7980
7981         * memrchr.c: New file from GNU libc.
7982         Undef __memrchr, too.
7983         [!weak_alias]: Define __memrchr to memrchr.
7984         Guard weak_alias use with `#ifdef weak_alias'.
7985
7986 2000-10-17  Jim Meyering  <meyering@lucent.com>
7987
7988         * quote.h (PARAMS): Define and use.
7989         Reported by Akim Demaille.
7990
7991         * getopt.c: Update from libc.
7992
7993 2000-10-16  Jim Meyering  <meyering@lucent.com>
7994
7995         * hard-locale.c (hard_locale): Use "", not 0 as 2nd arg to setlocale.
7996         From Jan Fedak.
7997
7998 2000-09-25  Jim Meyering  <meyering@lucent.com>
7999
8000         * md5.h (rol): Define (from GnuPG).
8001
8002         * sha.c: Give credit (GnuPG) where due.
8003         (M): Use rol rather than open-coding it.
8004         Add a FIXME comment.
8005
8006 2000-09-21  Jim Meyering  <meyering@lucent.com>
8007
8008         * userspec.c (parse_user_spec): Remove debugging printf I'd added.
8009         Reported by Michael Stone.
8010
8011 2000-09-20  Jim Meyering  <meyering@lucent.com>
8012
8013         * Makefile.am (libfetish_a_SOURCES): Add sha.c.
8014         (noinst_HEADERS): Add sha.h.
8015         Based on code from Scott G. Miller and from GnuPG.
8016
8017 2000-09-15  Jim Meyering  <meyering@lucent.com>
8018
8019         * regex.c: Update from libc.
8020
8021 2000-09-10  Jim Meyering  <meyering@lucent.com>
8022
8023         * getopt.c (_getopt_internal): Update from glibc.
8024
8025 2000-09-09  Jim Meyering  <meyering@lucent.com>
8026
8027         * quotearg.c: Rename ISASCII to IN_CTYPE_DOMAIN, so people don't
8028         think it should be used as a general replacement for isascii.
8029         * fnmatch.c: Likewise.
8030         * mbswidth.c: Likewise
8031         * regex.c: Likewise.
8032
8033         Don't use atoi.
8034         * userspec.c: Include sys/param.h and limits.h.
8035         Include xstrtol.h.
8036         (CHAR_BIT, TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM): Define.
8037         (UID_T_MAX, GID_T_MAX, MAXUID, MAXGID): Define.
8038         (parse_user_spec): Use xstrtoul, not atoi when converting numeric
8039         UID, GID.  Check range.
8040
8041 2000-09-06  Jim Meyering  <meyering@lucent.com>
8042
8043         * getopt.c (_getopt_internal): Update from glibc.
8044
8045 2000-08-30  Jim Meyering  <meyering@lucent.com>
8046
8047         * strftime.c: Merge in changes from GNU libc.
8048
8049 2000-08-26  Jim Meyering  <meyering@lucent.com>
8050
8051         * closeout.c: Include "__fpending.h".
8052         (close_stdout_status): Return right away if there's nothing to flush.
8053
8054         * Makefile.am (noinst_HEADERS): Add __fpending.h.
8055         * __fpending.c: New file.
8056         * __fpending.h: New file.
8057
8058 2000-08-07  Paul Eggert  <eggert@twinsun.com>
8059
8060         Standardize on "memory exhausted" instead of "Memory exhausted"
8061         or "virtual memory exhausted".
8062         * obstack.c (print_and_abort): Use "memory exhausted", not
8063         "virtual memory exhausted".
8064         * same.c (same_name): Invoke xalloc_die instead of printing
8065         our own message.
8066         * userspec.c (parse_user_spec): Likewise.
8067         * bumpalloc.h: comment fix
8068         * same.c, userspec.c: Include xalloc.h.
8069
8070         * xalloc.h (xalloc_msg_memory_exhausted): Now char const[],
8071         not char *const and pointing to a constant array.
8072         * xmalloc.c (xalloc_msg_memory_exhausted): Likewise.
8073         (xrealloc): Comment fix.
8074
8075         * userspec.c (parse_user_spec):
8076         Don't translate a message until just before returning,
8077         to avoid unnecessary translation.
8078
8079 2000-08-07  Jim Meyering  <meyering@lucent.com>
8080
8081         * addext.c, argmatch.c, argmatch.h, backupfile.h, bumpalloc.h,
8082         chown.c, diacrit.h, dirname.h, dup2.c, exclude.h, fileblocks.c,
8083         fnmatch.c, fnmatch.h, fsusage.c, fsusage.h, getdate.h,
8084         getgroups.c, gethostname.c, getopt.h, group-member.c,
8085         hard-locale.c, hash.h, isdir.c, lchown.c, linebuffer.c,
8086         linebuffer.h, long-options.h, malloc.c, md5.c, md5.h, memchr.c,
8087         memcmp.c, memcoll.c, memset.c, mktime.c, modechange.h, obstack.h,
8088         pathmax.h, realloc.c, rmdir.c, safe-read.c, save-cwd.c, stime.c,
8089         stpcpy.c, strcasecmp.c, strcspn.c, strdup.c, stripslash.c,
8090         strstr.c, strtod.c, strtol.c, strtoul.c, strtoull.c, strtoumax.c,
8091         utime.c, version-etc.h, xalloc.h, xstrdup.c, xstrtoumax.c,
8092         yesno.c: Back out Copyright date changes for each file with no change
8093         this year.  This eases coordination with other programs using the same
8094         source code modules.  From Paul Eggert.
8095
8096 2000-08-03  Greg McGary  <greg@mcgary.org>
8097
8098         * regex.c (SET_HIGH_BOUND, MOVE_BUFFER_POINTER,
8099         ELSE_EXTEND_BUFFER_HIGH_BOUND): New macros.
8100         (EXTEND_BUFFER): Use them.
8101
8102 2000-08-01  Jim Meyering  <meyering@lucent.com>
8103
8104         * dirname.c (ISSLASH): Define.
8105         (BACKSLASH_IS_PATH_SEPARATOR): Define.
8106         (dir_name) [BACKSLASH_IS_PATH_SEPARATOR]: Handle the case in which
8107         both `\' and `/' may be use as path separators.
8108         Based on a patch from Prashant TR.
8109
8110 2000-07-31  Paul Eggert  <eggert@twinsun.com>
8111
8112         * quotearg.c (quotearg_n_options): Don't make the initial
8113         slot vector a constant, since it might get modified.
8114
8115 2000-07-31  Jim Meyering  <meyering@lucent.com>
8116
8117         * xmalloc.c: Use `virtual memory exhausted', not `Memory exhausted'.
8118         * obstack.c (print_and_abort): Likewise.
8119
8120 2000-07-30  Paul Eggert  <eggert@twinsun.com>
8121
8122         * quotearg.c (quotearg_n_options): Preallocate a slot 0
8123         buffer, so that the caller can always quote one small
8124         component of a "memory exhausted" message in slot 0.
8125         From a suggestion by Jim Meyering.
8126
8127 2000-07-30  Jim Meyering  <meyering@lucent.com>
8128
8129         * makepath.c (make_path): Quote the other instance, too.
8130
8131         * quotearg.c (N_STATIC_SLOTVECS): Define.
8132         (STATIC_BUF_SIZE): Define.
8133         (quotearg_n_options): Use only statically allocated storage when
8134         N < N_STATIC_SLOTVECS and the length of the quoted result is smaller
8135         than STATIC_BUF_SIZE.
8136
8137 2000-07-29  Jim Meyering  <meyering@lucent.com>
8138
8139         * diacrit.c (diacrit_diac): Use __MSDOS__ in favor of MSDOS.
8140         * dirname.c (dir_name): Likewise.
8141
8142         * basename.c (base_name): Use ISSLASH rather than comparing against `/'.
8143
8144         * dirname.c (dir_name) [MSDOS]: Declare `lim' to be const.
8145         (dir_name): Assert that there are no trailing slashes.
8146
8147 2000-07-18  Bruno Haible  <haible@clisp.cons.org>
8148
8149         * mbswidth.h (mbswidth): Add a flags argument.
8150         (mbswidth): New declaration.
8151         (MBSW_ACCEPT_INVALID, MBSW_ACCEPT_UNPRINTABLE): New macros.
8152         * mbswidth.c (mbswidth): Add a flags argument.
8153         (mbsnwidth): New function.
8154
8155 2000-07-24  Jim Meyering  <meyering@lucent.com>
8156
8157         * mbswidth.c: Remove useless #else.  From Bruno Haible.
8158
8159 2000-07-23  Paul Eggert  <eggert@twinsun.com>
8160
8161         * mbswidth.c (_XOPEN_SOURCE):
8162         Don't define; this causes problems on Solaris 7.
8163         (wcwidth) [!HAVE_DECL_WCWIDTH]: Declare.
8164
8165 2000-07-23  Paul Eggert  <eggert@twinsun.com>
8166
8167         * quotearg.c:
8168         Include <wchar.h> even if ! (HAVE_MBRTOWC && 1 < MB_LEN_MAX),
8169         so that mbstate_t is always defined.
8170
8171         Do not inspect MB_LEN_MAX, since it's incorrectly defined to
8172         be 1 in at least one GCC installation, and this configuration
8173         error is likely to be common.  Ignoring MB_LEN_MAX hurts
8174         performance on hosts that have mbrtowc but have only unibyte
8175         locales, but I assume these hosts are rare.
8176
8177 2000-07-23  Paul Eggert  <eggert@twinsun.com>
8178
8179         * quotearg.c: Streamline by invoking multibyte code only if needed.
8180         <wchar.h>: Include only if HAVE_MBRTOWC && 1 < MB_LEN_MAX.
8181         (MB_CUR_MAX): Redefine to 1 if ! (HAVE_MBRTOWC && 1 < MB_LEN_MAX).
8182         (quotearg_buffer_restyled): If a unibyte locale, don't bother to
8183         invoke multibyte primitives.
8184
8185 2000-07-23  Jim Meyering  <meyering@lucent.com>
8186
8187         * basename.c (base_name): Add an assertion.
8188
8189 2000-07-15  Bruno Haible  <clisp.cons.org>
8190
8191         * quotearg.c: When the system forces us to redefine mbstate_t,
8192         shadow its mbsinit function.
8193
8194 2000-07-16  Bruno Haible  <haible@clisp.cons.org>
8195
8196         * mbswidth.h: New file.
8197         * mbswidth.c: New file.
8198         * Makefile.am (libfetish_a_SOURCES): Add mbswidth.c.
8199         (noinst_HEADERS): Add mbswidth.h.
8200
8201 2000-07-17  Bruno Haible  <haible@clisp.cons.org>
8202
8203         * config.charset: Add support for FreeBSD. Improve support for HP-UX
8204         and IRIX 6.
8205
8206 2000-07-15  Jim Meyering  <meyering@lucent.com>
8207
8208         * makepath.c: Include quote.h.
8209         (make_path): Convert "`%s'" in format strings to "%s", and wrap each
8210         corresponding argument in a `quote (...)' call.
8211         Give better diagnostics.
8212
8213         * Makefile.am (libfetish_a_SOURCES): Add quote.c.
8214         (noinst_HEADERS): Add quote.h.
8215
8216         * quote.c (quote, quote_n): New file.  Two functions taken verbatim
8217         from tar's src/misc.c.
8218         * quote.h: New file.  Prototypes for same.
8219
8220 2000-07-10  Paul Eggert  <eggert@twinsun.com>
8221
8222         From a suggestion by Bruno Haible.
8223         * quotearg.c (mbrtowc): Do not use HAVE_WCHAR_H in the definition.
8224         Use defined mbstate_t, not HAVE_MBSTATE_T_OBJECT,
8225         to decide whether to define the BeOS workaround macro;
8226         this adjusts to the change to AC_MBSTATE_T.
8227
8228 2000-07-13  Paul Eggert  <eggert@twinsun.com>
8229
8230         * quotearg.h (enum quoting style): New enum clocale_quoting_style.
8231
8232         * quotearg.c (quoting_style_args, quoting_style_vals,
8233         quotearg_buffer_restyled): Add support for
8234         clocale_quoting_style.  Undo previous change to
8235         locale_quoting_style behavior, and undo the "{LEFT QUOTATION MARK}"
8236         and "{RIGHT QUOTATION MARK}" msgids.
8237
8238 2000-07-05  Paul Eggert  <eggert@twinsun.com>
8239
8240         The old behavior of quoting `like this' doesn't look good with
8241         newer, ISO-style fonts.  See:
8242         http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html
8243
8244         Instead, quote "like this" by default.  Let the translator
8245         tailor the locale-specific quoting behavior by providing
8246         translations for {LEFT QUOTATION MARK} and {RIGHT QUOTATION MARK}.
8247
8248         * quotearg.c (N_): New macro.
8249         (gettext_default): New function.
8250         (quotearg_buffer_restyled): Use
8251         gettext_default ("{LEFT QUOTATION MARK}", "\"") for left quote, and
8252         gettext_default ("{RIGHT QUOTATION MARK}", "\"") for right quote.
8253
8254 2000-07-09  Jim Meyering  <meyering@lucent.com>
8255
8256         * Most files: Update copyright dates to include 2000.
8257
8258 2000-07-08  Jim Meyering  <meyering@lucent.com>
8259
8260         * xgethostname.c (ENAMETOOLONG): Define to an unlikely value
8261         if not defined.
8262         (xgethostname): Remove now-unnecessary #ifdef.
8263         Move declaration of `err' into loop where it's used.
8264
8265 2000-07-05  Bruno Haible  <haible@clisp.cons.org>
8266
8267         * xgethostname.c (xgethostname): Protect against the SunOS 5.5 bug
8268         by allocating a larger buffer. Test the gethostname return value for
8269         being >= 0, not == 0, for BeOS.  Don't exhaust memory if gethostname
8270         returns an error and ENAMETOOLONG isn't defined.
8271
8272 2000-07-05  Paul Eggert  <eggert@twinsun.com>
8273         and Bruno Haible  <haible@clisp.cons.org>
8274
8275         * quotearg.c (mbrtowc): Declare returned type, since BeOS doesn't.
8276
8277 2000-07-05  Bruno Haible  <haible@clisp.cons.org>
8278
8279         * quotearg.c (struct quoting_options): Simplify quote_these_too
8280         dimension.
8281
8282 2000-07-03  Jim Meyering  <meyering@lucent.com>
8283
8284         * strndup.c: [!HAVE_DECL_STRNLEN]: Declare strnlen.
8285         Reported by Bruno Haible.
8286
8287 2000-07-04  Jim Meyering  <meyering@lucent.com>
8288
8289         * quotearg.c: Make inclusion of <wchar.h> independent of whether
8290         HAVE_MBRTOWC is set.  Required at least for irix-5.6, which
8291         lacks mbrtowc.
8292
8293 2000-07-03  Paul Eggert  <eggert@twinsun.com>
8294         and Bruno Haible  <haible@clisp.cons.org>
8295
8296         * quotearg.c (mbrtowc):
8297         Assign to *pwc, and return 1 only if result is nonzero.
8298         (iswprint): Use ISPRINT when substituting our own mbrtowc.
8299
8300 2000-07-03  Jim Meyering  <meyering@lucent.com>
8301
8302         * readutmp.h: [HAVE_UTMPX_H]: Include <utmp.h> if HAVE_UTMP_H.
8303         This is necessary to get a definition of e.g., UTMP_FILE on HP-UX 10.20.
8304         From Bob Proulx.
8305
8306 2000-07-02  Jim Meyering  <meyering@lucent.com>
8307
8308         * quotearg.c (mbstate_t): Don't define here.
8309
8310 2000-07-02  Jim Meyering  <meyering@lucent.com>
8311
8312         * nanosleep.c (SIGCONT): Define if not already defined.
8313
8314 2000-06-17  Bruno Haible  <haible@clisp.cons.org>
8315
8316         * mountlist.c: Use MOUNTED_FS_STAT_DEV instead of MOUNTED_NEXT_DEV,
8317         per change in ../m4/ls-mntd-fs.m4.
8318         (read_filesystem_list): Ignore symbolic links.
8319
8320 2000-06-29  Jim Meyering  <meyering@lucent.com>
8321
8322         * same.c: Include <string.h> or <strings.h>, as appropriate,
8323         for declaration of strcmp.
8324
8325         * long-options.c: Include <stdlib.h>, for declaration of exit.
8326
8327         * mountlist.c (fsp_to_string) [HAVE_F_FSTYPENAME_IN_STATFS]:
8328         Avoid warning by casting result to `char *' to remove `const'.
8329
8330 2000-06-17  Bruno Haible  <haible@clisp.cons.org>
8331
8332         * Makefile.am (libfetish_a_SOURCES): Remove readutmp.c.
8333
8334 2000-06-26  Paul Eggert  <eggert@twinsun.com>
8335
8336         savedir now sets errno on failure and invokes xmalloc to get memory.
8337         Fix a couple of other minor bugs while we're at it.
8338
8339         * savedir.c (<unistd.h>): Do not include; there's no need.
8340         (NAMLEN): Remove macro.
8341         (malloc, realloc): Remove decls.
8342         (stpcpy): Likewise.
8343         ("xalloc.h"): Include.
8344         (NAME_SIZE_DEFAULT): New macro.
8345         (savedir): Use xmalloc / xrealloc to allocate memory.
8346         Use NAME_SIZE_DEFAULT if name_size is negative or overflows to zero.
8347         Skip "" directory entries.
8348         Use strlen to calculate directory entry length, since the old method
8349         is rarely used these days and isn't worth supporting.
8350         Don't use a pointer after freeing it.
8351         Check for integer overflow when calculating allocation size.
8352         Use memcpy to copy entries, instead of stpcpy.
8353         Set errno properly when returning NULL.
8354         Check for readdir error.
8355
8356 2000-06-26  Jim Meyering  <meyering@lucent.com>
8357
8358         * posixtm.c [HAVE_STDLIB_H]: Include stdlib.h, for decl of abort.
8359
8360 2000-06-17  Bruno Haible  <haible@clisp.cons.org>
8361
8362         * getusershell.c (xmalloc, xrealloc): Remove functions.
8363         Include xalloc.h.
8364         Don't include <stdlib.h>.  Don't declare malloc, realloc.
8365
8366 2000-06-23  Bruno Haible  <haible@clisp.cons.org>
8367
8368         * unicodeio.c (print_unicode_char): Work around ansi2knr deficiency.
8369
8370 2000-06-24  Jim Meyering  <meyering@lucent.com>
8371
8372         * error.c [!HAVE_DECL_STRERROR_R]: Declare strerror_r.
8373
8374 2000-06-21  Jim Meyering  <meyering@lucent.com>
8375
8376         * getpass.c: New file, from Bruno Haible.  Required for BeOS.
8377
8378 2000-06-19  Paul Eggert  <eggert@twinsun.com>
8379
8380         * quotearg.c: Include <wctype.h> after <wchar.h>, for Solaris 2.5.
8381         (mbrtowc, mbstate_t): Define substitutes if
8382         HAVE_MBRTOWC && HAVE_WCHAR_H && !HAVE_MBSTATE_T_OBJECT.
8383         (iswprint): Define to 1 if !defined iswprint && !HAVE_ISWPRINT,
8384         not if ! (HAVE_MBRTOWC && HAVE_WCHAR_H).
8385
8386 2000-06-17  Bruno Haible  <haible@clisp.cons.org>
8387
8388         * xgetcwd.c (xgetcwd): If the required pathname length is smaller
8389         than 1024, return a memory chunk of least possible size, instead
8390         of size PATH_MAX + 2. In the loop, increment the size proportionally.
8391         Use free/xmalloc instead of xrealloc to avoid copying for very long
8392         paths.
8393
8394 2000-06-17  Bruno Haible  <haible@clisp.cons.org>
8395
8396         * canon-host.c (canon_host): Use malloc and memcpy to copy an
8397         address, not strdup.  Include <stdlib.h> and don't declare free().
8398
8399 2000-06-17  Bruno Haible  <haible@clisp.cons.org>
8400
8401         * path-concat.c (path_concat): Don't access dir[-1] if dir is
8402         the empty string.
8403
8404 2000-06-21  Jim Meyering  <meyering@lucent.com>
8405
8406         * Makefile.am (libfetish_a_SOURCES): Add getstr.c.
8407         (noinst_HEADERS): Add getstr.h.
8408
8409         * getline.c (getstr): Move into a separate file.
8410         * getstr.c (getstr): New file, extracted from getline.c, with
8411         the following changes: new parameter, delim2; both delim[12]
8412         parameters have type `int', not `char'.  The latter would lose
8413         with 8-bit delimiters.
8414         * getstr.h: New file.
8415
8416 2000-06-19  Jim Meyering  <meyering@lucent.com>
8417
8418         * getloadavg.c [HAVE_NLIST_H] (NLIST_STRUCT): Define.
8419
8420 2000-06-18  Jim Meyering  <meyering@lucent.com>
8421
8422         * mkdir.c: Remove file, due mainly to copyright incompatibility.
8423         Besides, these days every porting target provides a mkdir function.
8424
8425         * strnlen.c: Include memory.h, string.h, and/or strings.h as needed.
8426         (this snippet comes from src/system.h).
8427
8428 2000-06-15  Paul Eggert  <eggert@twinsun.com>
8429
8430         * human.c (adjust_value): New function.
8431         (human_readable_inexact): Apply rounding style even when
8432         printing approximate values.
8433
8434 2000-06-14  Paul Eggert  <eggert@twinsun.com>
8435
8436         * human.c (human_readable_inexact): Allow an input block
8437         size that is not a multiple of the output block size, and vice versa.
8438         Reported by Piergiorgio Sartor.
8439
8440 2000-06-14  Paul Eggert  <eggert@twinsun.com>
8441
8442         * getdate.y (get_date): Apply relative times after time
8443         zone indicator, not before.  Reported by Todd A. Jacobs.
8444
8445 2000-06-13  Jim Meyering  <meyering@lucent.com>
8446
8447         * Makefile.am (all-local): Depend on lstat.c and stat.c.
8448
8449         * xstat.in [!HAVE_DECL_FREE]: Declare free in lstat.c.
8450
8451 2000-06-12  Paul Eggert  <eggert@twinsun.com>
8452
8453         * xstat.in: Include <stdlib.h> in lstat, to declare "free".
8454
8455 2000-06-04  Paul Eggert  <eggert@twinsun.com>
8456
8457         * strnlen.c: Include <config.h> if HAVE_CONFIG_H.
8458
8459 2000-06-04  Jim Meyering  <meyering@lucent.com>
8460
8461         * getugroups.c (getugroups): Cast -1 to gid_t, for systems like
8462         SunOS 4.1.4 for which gid_t is an unsigned type.
8463
8464 2000-06-03  Jim Meyering  <meyering@lucent.com>
8465
8466         * strnlen.c [!HAVE_DECL_MEMCHR]: Declare memchr.
8467
8468 2000-05-26  Bruno Haible  <haible@clisp.cons.org>
8469
8470         * Makefile.am (install-exec-local): On systems with glibc-2.1 or
8471         newer, don't install charset.alias.
8472         * config.charset: Change the Linux/glibc rules so they become empty
8473         on glibc-2.1 or newer.
8474
8475 2000-06-02  Jim Meyering  <meyering@lucent.com>
8476
8477         * mountlist.c: Back out last change.  Instead, do this...
8478         * mountlist.c (read_filesystem_list) [MOUNTED_VMOUNT]: Set the me_dummy
8479         member using the same `ignore'-testing code.
8480         * mountlist.h (ME_DUMMY): Add `autofs' to the list of ignored
8481         fs_type strings.
8482         From Mark D. Roth.
8483
8484 2000-05-29  Jim Meyering  <meyering@lucent.com>
8485
8486         * mountlist.c (read_filesystem_list) [MOUNTED_VMOUNT]: Ignore mounts
8487         with the `ignore' attribute.  Based on a patch from Mark D. Roth.
8488
8489 2000-05-22  Jim Meyering  <meyering@lucent.com>
8490
8491         * makepath.c: Remove old, now-unnecessary `#ifdef __MSDOS__' block.
8492
8493 2000-05-18  Jim Meyering  <meyering@lucent.com>
8494
8495         * hash.c (hash_rehash): Fix a nasty bug: copy the free entry list
8496         back, too, since it may have been modified by allocate_entry.
8497         (hash_delete): Rewrite to use neither the assignment operator
8498         nor the comma operator in an if-expression.
8499
8500 2000-05-15  Paul Eggert  <eggert@twinsun.com>
8501
8502         * closeout.c:
8503         <sys/stat.h>, <sys/types.h>, <unistd.h>, (STDOUT_FILENO):
8504         Remove; no longer needed.
8505         "quotearg.h": Add include.
8506         (file_name): Do not bother to explicitly initialize to NULL; it's less
8507         efficient on some hosts.
8508         (close_stdout_status): Remove test as to whether stdout was already
8509         closed; it breaks for the case "echo x | sort >&-".
8510         Quote file name colons.
8511         Do not assume that _("write error") lacks format strings.
8512
8513 2000-05-15  Jim Meyering  <meyering@lucent.com>
8514
8515         * version-etc.c (version_etc_copyright): Update the copyright string
8516         used in all --version output.
8517
8518 2000-05-14  Jim Meyering  <meyering@lucent.com>
8519
8520         * closeout.c (close_stdout_set_file_name): New function.
8521         (close_stdout_status): Use new file-scoped global.
8522         Return right away if fstat says the stdout file descriptor is invalid.
8523         * closeout.h (close_stdout_set_file_name): Declare.
8524
8525 2000-05-10  Jim Meyering  <meyering@lucent.com>
8526
8527         * closeout.c [default_exit_status]: New file-scoped variable.
8528         (close_stdout_set_status): New function.
8529         * closeout.h (close_stdout_set_status): Declare.
8530
8531 2000-05-08  Jim Meyering  <meyering@lucent.com>
8532
8533         * long-options.c: Don't include closeout.h.
8534         (parse_long_options): Don't call close_stdout for --version.
8535
8536 2000-05-06  Jim Meyering  <meyering@lucent.com>
8537
8538         * strnlen.c: Undefine __strnlen and strnlen.
8539         [!weak_alias]: Define __strnlen to strnlen.
8540
8541         * atexit.c: New file, from libiberty.
8542
8543 2000-05-06  Jim Meyering  <meyering@lucent.com>
8544
8545         * closeout.c (close_stdout_status): Also check for errors on the
8546         stderr stream.
8547
8548 2000-05-05  Bruno Haible  <haible@clisp.cons.org>
8549
8550         * localcharset.c (get_charset_aliases): Use malloc, realloc and memcpy
8551         instead of xmalloc, xrealloc, path_concat.
8552         (locale_charset): Treat empty environment variables as absent.
8553         (DIRECTORY_SEPARATOR, ISSLASH): New macros.
8554
8555 2000-05-04  Jim Meyering  <meyering@lucent.com>
8556
8557         * getopt.c: Update from glibc.
8558         * obstack.c: Likewise.
8559         * obstack.h: Likewise.
8560         * regex.c: Likewise.  NB: K&R compiler support is dropped for this file
8561
8562         * regex.h: Likewise.
8563         * strndup.c: Likewise.
8564         * strnlen.c: New file, from glibc.
8565
8566 2000-05-01  Jim Meyering  <meyering@lucent.com>
8567
8568         * full-write.c (full_write): Remove `FIXME' part of comment.
8569
8570 2000-04-29  Jim Meyering  <meyering@lucent.com>
8571
8572         * path-concat.c: Declare strdup only if it's not defined.
8573         * canon-host.c: Likewise.
8574
8575 2000-04-28  Jim Meyering  <meyering@lucent.com>
8576
8577         * rpmatch.c [HAVE_LIMITS_H]: Include limits.h before regex.h to avoid
8578         redefinition warning on some systems (HPUX).  Otherwise, regex.h is
8579         included first, then limits.h is included by locale.h by libintl.h.
8580         From John David Anglin.
8581
8582 2000-04-25  Jim Meyering  <meyering@lucent.com>
8583
8584         * makepath.c (S_IRWXUGO): Define.
8585         (make_path): Always perform explicit chmod if MODE specifies any
8586         of the `special' permission bits.  Prompted by a bug report against
8587         install from Mate Wierdl and Joost van Baal.
8588
8589 2000-04-18  Jim Meyering  <meyering@lucent.com>
8590
8591         * README: New file.
8592
8593         * getpagesize.h [!getpagesize && HAVE_OS_H && B_PAGE_SIZE]: Define
8594         getpagesize.  For BeOS.  Based on a patch from Bruno Haible.
8595
8596 2000-04-17  Jim Meyering  <meyering@lucent.com>
8597
8598         * strftime.c (my_strftime) [strftime]: Declare strftime here, since
8599         the definition of it to rpl_strftime also defined-away the system's
8600         declaration.
8601
8602 2000-04-15  Jim Meyering  <meyering@lucent.com>
8603
8604         Use `C' to denote so-called `contiguous' files, the same way
8605         that tar does.
8606         * filemode.c (S_ISCTG) [!S_ISCTG && S_IFCTG]: Define.
8607         (ftypelet): Use S_ISCTG.
8608         From Michael Deutschmann.
8609
8610 2000-04-14  Jim Meyering  <meyering@lucent.com>
8611
8612         * strftime.c (my_strftime) [#ifdef strftime]: Declare strftime.
8613
8614 2000-04-08  Jim Meyering  <meyering@lucent.com>
8615
8616         * Makefile.am (charset.alias): Use t-$@, not $@-t so the DOS 8.3
8617         names don't conflict.  Reported by Eli Zaretskii.
8618
8619 2000-03-28  Bruno Haible  <haible@clisp.cons.org>
8620
8621         * unicodeio.c (print_unicode_char): Avoid triggering Solaris iconv
8622         bug.  Deal with the different error behavior of Irix iconv.
8623
8624 2000-04-07  Jim Meyering  <meyering@lucent.com>
8625
8626         * putenv.c: Move inclusion of errno.h so it follows that of sys/types.h,
8627         to work around system header problems on AIX 3.2.5.  From Bruno Haible.
8628
8629 2000-04-05  Jim Meyering  <meyering@lucent.com>
8630
8631         Portability tweaks required for ultrix4.3.
8632         * readutmp.h [HAVE_UTMPX_H && !HAVE_DECL_GETUTENT]: Declare getutent.
8633         * readutmp.c: Include sys/types.h before sys/stat.h.
8634         * canon-host.c: Declare strdup.
8635         * path-concat.c: Likewise.
8636         From John David Anglin.
8637
8638 2000-04-04  Jim Meyering  <meyering@lucent.com>
8639
8640         Be more DOS 8.3-friendly.
8641         * ref-add.sin: Renamed from ref-add.sed.in.
8642         * ref-del.sin: Renamed from ref-del.sed.in.
8643         * Makefile.am: Reflect renaming.
8644         Reported by Eli Zaretskii.
8645
8646         Use a temporary file name that won't clash with `charset.alias'
8647         in the DOS 8.3 name space.
8648         * Makefile.am (charset_tmp): Define.
8649         (install-exec-local): Use $(charset_tmp) instead of $(charset_alias)-t.
8650         (uninstall-local): Likewise.
8651         Reported by Eli Zaretskii.
8652
8653 2000-03-29  Paul Eggert  <eggert@twinsun.com>
8654
8655         * time/strftime.c (my_strftime): Make sure we call the system
8656         strftime, not ourselves, when invoking the underlying strftime.
8657
8658 2000-03-24  Jim Meyering  <meyering@lucent.com>
8659
8660         * Makefile.am (EXTRA_DIST): Add ref-add.sed.in and ref-del.sed.in.
8661         (charset_alias): Define.
8662         (install-exec-local): Factor out common code.
8663         (uninstall-local): Split lines longer than 80.
8664         (ref-add.sed, ref-del.sed): Remove rules... (do the following instead)
8665         (SUFFIXES): Define.
8666         (.sed.in.sed): New rule.  Don't redirect directly to $@.
8667         (CLEANFILES): Add ref-add.sed and ref-del.sed.
8668
8669 2000-03-19  Bruno Haible  <haible@clisp.cons.org>
8670
8671         * config.charset: Output a line containing "Packages using this file".
8672         * ref-add.sed.in, ref-del.sed.in: New files.
8673         * Makefile.am (install-exec-local, uninstall-local, ref-add.sed,
8674         ref-del.sed): New rules.
8675
8676 2000-03-17  Jim Meyering  <meyering@lucent.com>
8677
8678         * unicodeio.c (<string.h>): Include only #if HAVE_STRING_H.
8679         Otherwise, include <strings.h>
8680
8681 2000-03-17  Bruno Haible  <haible@clisp.cons.org>
8682
8683         * unicodeio.c (utf8_wctomb): New function.
8684         (print_unicode_char): Pass the Unicode character to iconv in UTF-8
8685         format instead of in UCS-4 with platform dependent endianness.
8686
8687 2000-03-07  Paul Eggert  <eggert@twinsun.com>
8688
8689         * savedir.c (savedir): Work even if directory size is
8690         negative; this can happen with some screwy NFS configurations.
8691
8692 2000-03-06  Jim Meyering  <meyering@lucent.com>
8693
8694         * localcharset.c (get_charset_aliases): Don't try to free file_name
8695         if it's NULL (because we ran out of memory).  From Bruno Haible.
8696
8697 2000-03-05  Jim Meyering  <meyering@lucent.com>
8698
8699         * localcharset.c ("path-concat.h"): Include.
8700         (get_charset_aliases): Use path_concat instead of ANSI string
8701         concatenation.
8702
8703         * unicodeio.h (PARAMS): Define.
8704         Use it to guard prototype.
8705
8706 2000-03-04  Jim Meyering  <meyering@lucent.com>
8707
8708         * Makefile.am (install-exec-local): Create $(libdir) before installing
8709         into it.
8710         (uninstall-local): Uncomment this rule so `make distcheck' works
8711         once again.
8712
8713         * unicodeio.c (<errno.h>): Include it.
8714         (errno): Declare if not defined.
8715
8716         * localcharset.c: Add Bruno's comment justifying use of volatile.
8717
8718         * config.charset: New version, incorporating remarks from a linux
8719         i18n mailing list.  From Bruno Haible.
8720
8721 2000-03-02  Jim Meyering  <meyering@lucent.com>
8722
8723         * Makefile.am (EXTRA_DIST): Add config.charset.
8724
8725 2000-03-01  Jim Meyering  <meyering@lucent.com>
8726
8727         * localcharset.c: Guard some #includes with `#if HAVE_...'.
8728         * unicodeio.c: Likewise.
8729
8730 2000-02-02  Bruno Haible  <haible@clisp.cons.org>
8731
8732         * config.charset: New file.
8733         * localcharset.c: New file.
8734         * unicodeio.h, unicodeio.c: New files.
8735         * Makefile.am (DEFS): Add -DLIBDIR=...
8736         (libfetish_a_SOURCES): Add localcharset.c and unicodeio.c.
8737         (noinst_HEADERS): Add unicodeio.h.
8738         (all-local, install-exec-local, charset.alias): New targets.
8739
8740 2000-02-28  Paul Eggert  <eggert@twinsun.com>
8741
8742         * quotearg.c (ALERT_CHAR): New macro.
8743         (quotearg_buffer_restyled): Use it.
8744
8745 2000-02-27  Jim Meyering  <meyering@lucent.com>
8746
8747         * strtoumax.c: Fix typo in decl of strtoul: s/long long/long/.
8748         Guard declaration of strtoull also with `&& HAVE_UNSIGNED_LONG_LONG'.
8749
8750         * backupfile.c: Guard inclusion of stdlib.h with `#if HAVE_STDLIB_H',
8751         not `#if STDC_HEADERS'.
8752         Declare malloc if needed.
8753
8754         * backupfile.c: Use `#if !HAVE_DECL...' instead of `#ifndef HAVE_DECL..'
8755         now that autoconf always defines the HAVE_DECL_ symbols.
8756         * human.c: Likewise.
8757         * same.c: Likewise.
8758         * strtoumax.c: Likewise.
8759
8760         * backupfile.c: Arrange for cpp to fail if the configure-time
8761         declaration check was not run.
8762         * hash.c: Likewise.
8763         * human.c: Likewise.
8764         * same.c: Likewise.
8765         * strtoumax.c: Likewise.
8766
8767         * userspec.c (parse_user_spec): If there is no `:' but there is a `.',
8768         then first look up the entire `.'-containing string as a login name.
8769
8770 2000-02-18  Paul Eggert  <eggert@twinsun.com>
8771
8772         * getdate.y: Handle two-digit years with leading zeros correctly.
8773         (textint): New typedef.
8774         (parser_control): Member year changed from int to textint.
8775         All uses changed.
8776         (YYSTYPE): Removed; replaced by %union with int and textint members.
8777         (tDAY, tDAY_UNIT, tDAYZONE, tHOUR_UNIT, tID, tLOCAL_ZONE, tMERIDIAN,
8778         tMINUTE_UNIT, tMONTH, tMONTH_UNIT tSEC_UNIT, tSNUMBER, tUNUMBER,
8779         tYEAR_UNIT, tZONE, o_merid): Now of type <intval>.
8780         (tSNUMBER, tUNUMBER): Now of type <textintval>.
8781         (date, number, to_year): Use width of number in digits, not its value,
8782         to determine whether it's a 2-digit year, or a 2-digit time.
8783         (yylex): Store number of digits of numeric tokens.
8784         Reported by John Kendall.
8785
8786         (parser_control): Changed from struct parser_control to typedef (for
8787         consistency).  All uses changed.
8788
8789         (tID): Removed; not used.
8790         (yylex): Return '?' for unknown identifiers, rather than (unused) tID.
8791
8792 2000-02-14  Paul Eggert  <eggert@twinsun.com>
8793
8794         * getpagesize.h (getpagesize): Port to VMS for Alpha;
8795         adapted from changes to grep getpagesize.h by Martin P.J. Zinser.
8796
8797 2000-02-12  Jim Meyering  <meyering@lucent.com>
8798
8799         * userspec.c (ISDIGIT): Define it.
8800         (isdigit): Remove definition.
8801         (is_number): Use ISDIGIT, not isdigit.
8802         <libintl.h>: Include.
8803         (_ and N_): Define.
8804         (parse_user_spec): Mark translatable strings.
8805
8806 2000-02-10  Jim Meyering  <meyering@lucent.com>
8807
8808         With these changes, nanosleep.[ch] are finally enough like the other
8809         lib/* replacement files to compile on a few more losing systems.
8810
8811         * nanosleep.h: Don't include config.h.
8812         Remove prototype from declaration of nanosleep.
8813         (PARAMS): Remove now-unneeded definition.
8814         * nanosleep.c: #undef nanosleep.
8815         (rpl_nanosleep): Rename from nanosleep.
8816
8817 2000-02-03  Jim Meyering  <meyering@lucent.com>
8818
8819         * readutmp.c (read_utmp): Guard with `#ifdef UTMP_NAME_FUNCTION',
8820         rather than with `#if HAVE_UTMPNAME'.
8821
8822 2000-02-01  Jim Meyering  <meyering@lucent.com>
8823
8824         * readutmp.h (UT_USER): Add parens.  From Andreas Schwab.
8825
8826 2000-01-31  Jim Meyering  <meyering@lucent.com>
8827
8828         * nanosleep.h (nanosleep): Guard declaration with
8829         `#if ! HAVE_DECL_NANOSLEEP'.
8830         Without this, OFS gets a redeclaration error for rpl_nanosleep, due to
8831         the declaration in that vendor's sys/timers.h.
8832         Reported by Christian Krackowizer.
8833
8834         * quotearg.c (ISASCII): Add #undef and move definition to follow
8835         inclusion of wctype.h to work around Solaris 2.6 namespace pollution.
8836         (ISPRINT): Likewise.
8837         Reported by Tom Tromey.
8838
8839 2000-01-30  Jim Meyering  <meyering@lucent.com>
8840
8841         * readutmp.c (extract_trimmed_name): Use UT_USER instead of hard-coding
8842         uses of ->ut_name.  The latter doesn't work with new Linux header files
8843         where only utmpx.ut_user is declared.
8844
8845         * readutmp.h (UT_USER): Define.
8846
8847 2000-01-23  Jim Meyering  <meyering@lucent.com>
8848
8849         * Makefile.am (libfetish_a_SOURCES): Remove explicit mention of
8850         obstack.c.
8851
8852 2000-01-22  Jim Meyering  <meyering@lucent.com>
8853
8854         * strtoumax.c: [! HAVE_DECL_STRTOUL]: Declare strtoul.
8855         [! HAVE_DECL_STRTOULL]: Declare strtoull.
8856         Required for some AIX systems.  Reported by Christian Krackowizer.
8857         [TESTING] (main): New function.
8858
8859         1997-10-17  Eli Zaretskii  <eliz@is.elta.co.il>
8860         * dirname.c (dir_name): Support for DOS-style file names with drive
8861         letters.
8862
8863         * quotearg.c [HAVE_WCTYPE_H]: Include <wctype.h> for decl of iswprint.
8864
8865         * strverscmp.c (ISDIGIT): Define.
8866         (strverscmp): Use ISDIGIT, not isdigit.
8867
8868 2000-01-17  Paul Eggert  <eggert@twinsun.com>
8869
8870         * nanosleep.c (nanosleep):
8871         Don't use SA_INTERRUPT to decide whether to call sigaction, as
8872         POSIX.1 doesn't require SA_INTERRUPT and some systems
8873         (e.g. Solaris 7) don't define it.  Use SA_NOCLDSTOP instead;
8874         it's been part of POSIX.1 since day 1 (in 1988).
8875
8876 2000-01-17  Jim Meyering  <meyering@lucent.com>
8877
8878         * interlock: Remove unused file.  Reported by François Pinard.
8879
8880 2000-01-16  Paul Eggert  <eggert@twinsun.com>
8881
8882         * quotearg.c (quotearg_buffer_restyled): Do not quote
8883         alert, backslash, formfeed, and vertical tab unnecessarily in
8884         shell quoting style.
8885
8886
8887 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
8888 Free Software Foundation, Inc.
8889 Copying and distribution of this file, with or without modification,
8890 are permitted provided the copyright notice and this notice are preserved.