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