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