c161814442eece70e7963ec0979033562940cb38
[gnulib.git] / lib / ChangeLog
1 2005-01-20  Paul Eggert  <eggert@cs.ucla.edu>
2
3         * save-cwd.c (save_cwd): Remove code to support the case
4         where fchdir is missing or flaky.
5
6 2005-01-20  Simon Josefsson  <jas@extundo.com>
7
8         * base64.h (isbase64): Add.
9
10         * base64.c (isb64): Rename to isbase64, use to_uchar instead of
11         using a unsigned prototype, don't inline.
12         (base64_decode): Use it.
13
14 2005-01-19  Bruno Haible  <bruno@clisp.org>
15
16         * sh-quote.h: New file, from GNU gettext.
17         * sh-quote.c: New file, from GNU gettext.
18
19 2005-01-18  Paul Eggert  <eggert@cs.ucla.edu>
20
21         Merge changes from coreutils, as described below in several
22         changelogs dated today.
23
24         * save-cwd.c: Include "save-cwd.h" before other include files.
25         (O_DIRECTORY): Remove; not needed here, since "." must be
26         a directory.  All uses removed.
27         (save_cwd): Use __sgi || __sun, not sun || __sun.  __sun is
28         universal on Suns, and we also need to test for IRIX.
29         Revamp code to use 'if' rather than '#if'.
30         Avoid unnecessary comparison of cwd->desc to 0.
31
32         * utimens.c (futimens): Robustify the previous patch, by checking
33         for known valid error numbers rather than observed invalid ones.
34
35 2005-01-18  Jim Meyering  <jim@meyering.net>
36
37         * version-etc.c (version_etc_copyright): Update copyright date.
38
39         * utimens.c (futimens): Account for the fact that futimes
40         can also fail with errno == ENOSYS or errno == ENOENT.
41         Patch from Dmitry V. Levin.
42
43         Change the name of the robust chdir function from chdir to chdir_long.
44         * save-cwd.c: Include chdir-long.h rather than chdir.h.
45         (restore_cwd): Use chdir_long, not chdir.
46         * chdir-long.c: Renamed from chdir.c.
47         * chdir-long.h: Renamed from chdir.h.
48         [!defined PATH_MAX]: Define chdir_long to chdir on systems like the Hurd.
49 2005-01-18  Bob Proulx  <bob@proulx.com>
50
51         * obstack.c [DEFAULT_ALIGNMENT]: Use an intermediate type to simplify
52         offsetof() macro construct to avoid compile failure with native HP-UX
53         11.0 ANSI C compiler.
54
55 2005-01-06  Bruno Haible  <bruno@clisp.org>
56
57         * stpncpy.c: Remove HAVE_STPNCPY and gnu_stpncpy renaming, redundant
58         because stpncpy.m4 takes care of it.
59
60 2004-01-24  Bruno Haible  <bruno@clisp.org>
61
62         * progreloc.c (xstrdup): Define as strdup if no xmalloc should be used.
63
64 2003-10-09  Bruno Haible  <bruno@clisp.org>
65
66         * progreloc.c: Include xalloc.h instead of xmalloc.h.
67
68 2005-01-06  Bruno Haible  <bruno@clisp.org>
69
70         * fwriteerror.h (fwriteerror): Change specification to include fclose.
71         * fwriteerror.c: Include <stdbool.h>.
72         (fwriteerror): At the end, close the file stream. Record whether
73         stdout was already closed.
74
75 2004-05-27  Bruno Haible  <bruno@clisp.org>
76
77         * execute.c (environ): Declare if needed.
78         * pipe.c (environ): Likewise.
79         Reported by Michael Schloh von Bennewitz <michael.schloh@cw.com>.
80
81 2005-01-04  Paul Eggert  <eggert@cs.ucla.edu>
82
83         * human.c (SIZE_MAX, UINTMAX_MAX): Move these conditional
84         definitions to be after all include files, to avoid collisions.
85         Problem reported by Bob Proulx.
86
87 2004-12-28  Paul Eggert  <eggert@cs.ucla.edu>
88
89         * error.c [!_LIBC && !ENABLE_NLS]: Do not include "gettext.h";
90         not needed.  This removes a dependency on the gettext module.
91         [defined _LIBC]: Do not include <libintl.h>; not needed.
92
93 2004-12-24  Paul Eggert  <eggert@cs.ucla.edu>
94
95         * c-strtod.c (STRTOD): Depend on HAVE_C99_STRTOLD, not
96         HAVE_DECL_STRTOLD.
97
98 2004-12-23  Paul Eggert  <eggert@cs.ucla.edu>
99
100         * argp-parse.c: Include <stddef.h>.
101         (alignof, alignto): New macros.
102         (parser_init): Don't assume that void * is aligned sufficiently
103         for struct option.
104
105         * getdate.y (YYSTACK_USE_ALLOCA): Define to 0, since there's no
106         need to extend the stack.
107         (YYINITDEPTH): New macro, so that the initial stack isn't overly
108         large.
109
110 2004-12-22  Sergey Poznyakoff  <gray@Mirddin.farlep.net>
111
112         * argp-parse.c (parser_init): Avoid arithmetics on void pointers.
113
114 2004-12-19  Paul Eggert  <eggert@cs.ucla.edu>
115
116         * alloca_.h: Conditionalize on _GNULIB_ALLOCA_H, not _ALLOCA_H.
117         Remove now-obsolete comment about AIX.
118         * getdate.y: Include <alloca.h> only if HAVE_ALLOCA.
119         (YYSTACK_USE_ALLOCA): Define to 0 if !HAVE_ALLOCA.
120         (YYMAXDEPTH): New macro.
121
122 2004-12-18  Bruno Haible  <bruno@clisp.org>
123
124         * fatal-signal.c (fatal_signals): Make non-const.
125         (init_fatal_signals): New function.
126         (uninstall_handlers, install_handlers): Ignore signals that were set to
127         SIG_IGN.
128         (at_fatal_signal): Call init_fatal_signals.
129         (init_fatal_signal_set): Likewise. Ignore signals that were set to
130         SIG_IGN.
131         Reported by Paul Eggert.
132
133 2004-12-08  Paul Eggert  <eggert@cs.ucla.edu>
134
135         * getdate.y (textint): New member "negative".
136         (time_zone_hhmm): New function.
137         Expect 14 shift-reduce conflicts, not 13.
138         (o_colon_minutes): New rule.
139         (time, zone): Use it to add support for +HH:MM, UTC+HH:MM.
140         (yylex): Set the "negative" member of signed numbers.
141
142 2004-12-04  Paul Eggert  <eggert@cs.ucla.edu>
143
144         Changes imported from coreutils.
145         * hard-locale.c: Assume <locale.h> exists.
146         Include "strdup.h".
147         (GLIBC_VERSION): New macro.
148         (hard_locale): Assume setlocale exists.
149         Rewrite to avoid #ifdef.
150         Use strdup rather than malloc + strcpy.
151         * human.c: Assume <locale.h> exists.
152         (human_readable): Assume localeconv exists.
153
154 2004-12-01  Jakub Jelinek  <jakub@redhat.com>
155
156         * mktime.c (__mktime_internal): If SEC_REQUESTED != SEC,
157         convert T2, not T.  (Imported from libc.)
158
159 2004-11-30  Paul Eggert  <eggert@cs.ucla.edu>
160
161         * getcwd.c (is_ENAMETOOLONG): New macro.
162         (__getcwd.c): Don't restore errno; glibc doesn't.
163         [HAVE_PARTLY_WORKING_GETCWD && !defined AT_FDCWD]: Try system getcwd
164         first, falling back to our code only if its results look suspicious.
165         Ensure that the resulting buffer is only as large as necessary.
166
167         * readutmp.c: Include readutmp.h first.
168         Include <errno.h>, since readutmp.h no longer does that.
169         * readutmp.h: Don't include <errno.h>,
170         <sys/param.h>, <time.h>; not needed to establish interface.
171         (errno): Remove decl.
172         (HAVE_STRUCT_XTMP_UT_TYPE): Remove; no longer needed.
173         (UT_TYPE_EQ, UT_TYPE_NOT_DEFINED, UT_TYPE_BOOT_TIME,
174         UT_TYPE_USER_PROCESS, IS_USER_PROCESS): New macros.
175
176 2004-11-28  Simon Josefsson  <jas@extundo.com>
177
178         * base64.h, base64.c: New file.
179
180 2004-11-27  Paul Eggert  <eggert@cs.ucla.edu>
181
182         * getcwd.h: New file, which I forgot to check in on 2004-11-25.
183
184 2004-11-25  Paul Eggert  <eggert@cs.ucla.edu>
185
186         Fix problems reported by Scott S. Tinsley for HP-UX 11.11 using
187         HP's ANSI C compiler.
188         * fsusage.c (statvfs) [HAVE_SYS_STATVFS_H]: Remove decl.
189         Declaring int functions causes warnings on some modern systems and
190         shouldn't be needed to compile on ancient ones.
191         * same.c (MIN) [defined MIN]: Don't define, since it's already
192         defined.
193
194         * getcwd.c: Replace by a copy of glibc/sysdeps/posix/getcwd.c, but
195         with the following changes.
196         (__set_errno): Parenthesize properly.
197         Include <stdbool.h>.
198         (MIN, MAX, MATCHING_INO): New macros.
199         (__getcwd): Define with prototype, not K&R form.
200         Use heuristics to allocate default buffer on stack if possible.
201         If AT_FDCWD is defined, use openat and fstatat to avoid O(N**2)
202         behavior, and to avoid the PATH_MAX limit when computing
203         ../../../../...
204         Use MATCHING_INO to compare inode number to file.
205         Check for arithmetic overflow in size calculations.
206         Fix bug in reallocation of dot array that caused getcwd to fail
207         on directories nested deeper than 75.
208         Be more careful about saving errno on error.
209         Do not use realloc; use only free+malloc, as this is a bit
210         more flexible and avoids a needless copy operation.
211         Do not inspect st_dev and st_ino for symbolic links; POSIX
212         doesn't specify the latter.
213         Check for closedir errors.
214         Avoid needless casts.
215         Use "#ifdef weak_alias" around weak_alias, to be like other
216         glibc code.
217         The following changes to getcwd.c have effect only when used in
218         gnulib; they have no effect inside glibc proper.
219         (#pragma alloca) [defined _AIX && !defined __GNUC__]: Remove,
220         as alloca isn't used.
221         (alloca, __alloca): Likewise.
222         [!_LIBC]: Include "getcwd.h", "mempcpy.h".
223         Include <stddef.h>, <stdlib.h>, <string.h>, <limits.h>
224         unconditionally, as gnulib assumes C89 or better.
225         Do not include <sys/param.h>.
226         (errno) [!defined __GNU_LIBRARY__ && !defined STDC_HEADERS]: Remove
227         no-longer-necessary 'extern int errno' decl; gnulib assumes C89 or
228         better.
229         (NULL) [!defined NULL]: Remove; we assume C89 or better.
230         Include <dirent.h> in a way that is compatible with modern Autoconf.
231         (_D_ALLOC_NAMELEN, _D_EXACT_NAMLEN):
232         New macros, if not already defined.
233         Include <unistd.h> if _LIBC, not if __GNU_LIBRARY__.
234         Use "_LIBC", not "defined _LIBC", for consistency.
235         (HAVE_MEMPCPY): Remove; no longer needed now that gnulib has
236         a mempcpy module.
237         (__lstat, __closedir, __opendir, __readdir) [!_LIBC]: New macros.
238         (GETCWD_RETURN_TYPE): Remove.  All uses replaced by char *.
239         * xgetcwd.c: David MacKenzie's old code was removed, so give
240         credit only to Jim Meyering and adjust the copyright dates.
241         Do not include <limits.h>, <stdio.h>, <sys/types.h>,
242         <stdlib.h>, <unistd.h>, "pathmax.h".
243         Instead, include "xgetcwd.h" (first) and "getcwd.h".
244         (INITIAL_BUFFER_SIZE): Remove.
245         (xgetcwd): Rely on getcwd, since we now depend on a reliable one.
246
247 2004-11-23  Jim Meyering  <jim@meyering.net>
248
249         * getopt_.h: Remove trailing blanks.
250
251 2004-11-23  Paul Eggert  <eggert@cs.ucla.edu>
252
253         * utimens.c (__attribute__, ATTRIBUTE_UNUSED): New macros.
254         (futimens): New function, which uses futimes if available.
255         (futimens, utimens): Support timespec==NULL, with same semantics
256         as utime and utimens.
257         * utimens.h (futimens): New decl.
258
259 2004-11-23  Jim Meyering  <jim@meyering.net>
260
261         * __fpending.c: Add comment.
262
263 2004-11-23  Sergey Poznyakoff  <gray@Mirddin.farlep.net>
264
265         * getopt_.h: Re-addition of __getopt_argv_const caused
266         redefinition warnings. To avoid them, include the defines
267         in `#if !defined __need_getopt ... #endif'. The only place
268         where __getopt_argv_const is used is in definitions
269         of getopt_long and getopt_long_only below, which are as well
270         protected by `#ifndef __need_getopt'.
271         [defined __GETOPT_PREFIX && !defined __need_getopt]: Undef
272         __need_getopt after including <stdio.h> and <unistd.h> These
273         headers might have defined it.
274
275 2004-11-20  Paul Eggert  <eggert@cs.ucla.edu>
276
277         * getopt_.h (__GETOPT_CONCAT, __GETOPT_XCONCAT, __GETOPT_ID):
278         New macros.
279         (getopt, getopt_long, getopt_long_only, optarg, opterr, optind,
280         optopt): Use them instead of invoking ## directly; otherwise, the
281         symbols will be __GETOPT_PREFIXgetopt rather than rpl_getopt.
282
283 2004-11-19  Bruno Haible  <bruno@clisp.org>
284
285         * strtok_r.c: Move comments from here...
286         * strtok_r.h: ... to here.
287
288 2004-11-17  Paul Eggert  <eggert@cs.ucla.edu>
289
290         * realloc.c (rpl_realloc): Call 'free' if n==0, since realloc
291         might fail.  Problem reported by Yoann Vandoorselaere.
292         * calloc.c (rpl_calloc): Defend against buggy calloc implementations
293         that mishandle size_t overflow.
294
295 2004-11-16  Paul Eggert  <eggert@cs.ucla.edu>
296
297         * canon-host.c: Include "strdup.h".
298         (canon_host): Use getaddrinfo if available, so that IPv6 works.
299         Use strdup instead of malloc/strcpy to duplicate strings.
300
301         * human.h (LONGEST_HUMAN_READABLE): Add 1 for space before unit.
302         (human_space_before_unit): New constant.
303         * human.c (human_readable): Support it.
304
305         * xgetcwd.c: Include <limits.h>, for PATH_MAX.
306         (xgetcwd): Set errno correctly when failing.
307         Work around Solaris 9 bug: getcwd sets errno==ERANGE even though
308         the failure is actually due to a PATH_MAX problem.
309
310         Further getopt changes to make it more likely that glibc will
311         buy the changes back.
312         * getopt.c (POSIXLY_CORRECT): New constant.
313         (getopt): Use it, so to preserve glibc semantic
314         * getopt1.c (getopt_long, getopt_long_only): Arg is char * const *
315         when compiling for libc.
316         * getopt_.h (__getopt_argv_const): Bring it back.
317         (getopt_long, getopt_long_only): Use it.
318
319         * getopt.c (_getopt_initialize, _getopt_internal_r, _getopt_internal):
320         New arg POSIXLY_CORRECT.  All callers changed.
321         (getopt): Argv is now char * const *, as per standard.
322         (_getopt_internal_r, _getopt_internal): Argv is now char **,
323         not char *__getopt_argv_const *.
324         * getopt1.c (getopt_long, _getopt_long_r, getopt_long_only,
325         _getopt_long_only_r): Likewise.
326         * getopt_.h (getopt, getopt_long, geopt_long_only): Likewise.
327         * getopt_int.h (_getopt_internal, _getopt_internal_r,
328         _getopt_long_r, _getopt_long_only_r): Likewise.
329         * getopt_.h (__getopt_argv_const): Remove.
330         (getopt): Argv is now char * const *, as per standard.
331
332         * getdate.y (tORDINAL): New token.
333         (day, relunit): Allow it for relative times.
334         (relative_time_table): Use tORDINAL for ordinals.
335
336 2004-11-15  Jim Meyering  <jim@meyering.net>
337
338         * closeout.c: Include "__fpending.h" once again.
339         Include <stdbool.h>.
340         (close_stdout): Don't fail just because stdout was closed initially,
341         since some programs don't write to stdout in the normal course of
342         operation (other than --version and --help), and we don't want this
343         function to make e.g. `touch file >&-' fail.
344         But do fail if it was closed and someone has tried to write to it.
345         E.g., `printf foo >&-' must fail.
346
347 2004-11-11  Simon Josefsson  <jas@extundo.com>
348
349         * strtok_r.h, strtok_r.c: New file.
350
351 2004-11-11  Paul Eggert  <eggert@cs.ucla.edu>
352
353         * getopt_.h (__getopt_argv_const): New macro, to be used so that
354         we can stop lying to compilers about the constness of argv when we
355         are compiled outside glibc.
356         (getopt, getopt_long, getopt_long_only): Use it.
357         * getopt.c (_getopt_initialize, _getopt_internal_r, _getopt_internal,
358         getopt): Likewise.
359         * getopt1.c (getopt_long, _getopt_long_r, getopt_long_only,
360         _getopt_long_only_r): Likewise.
361         * getopt_int.h (_getopt_internal, _getopt_internal_r, _getopt_long_r,
362         _getopt_long_only_r): Likewise.
363
364         * getopt_.h [defined __GETOPT_PREFIX && !defined __need_getopt]:
365         Include <stdlib.h> and <stdio.h>, and <unistd.h> if available.
366         Then rename getopt to __GETOPT_PREFIX##getopt, and so forth for
367         the other external symbols.
368         (getopt) [!defined __GNU_LIBRARY]: Use prototype, not old-style
369         declaration, since the above renaming now works around collisions.
370
371 2004-11-11  Jim Meyering  <jim@meyering.net>
372
373         * linebreak.c: Remove trailing blanks.
374         * alloca_.h: Likewise.
375         * acosl.c: Likewise.
376         * euidaccess.c: Likewise.
377         * allocsa.h: Likewise.
378
379 2004-11-10  Paul Eggert  <eggert@cs.ucla.edu>
380
381         * mktime.c (SHR): New macro, which is a portable
382         substitute for >> that should work even on Crays.
383         (TIME_T_MIDPOINT, ydhms_diff, __mktime_internal): Use it.
384         Problem reported by Mark D. Baushke in
385         <http://lists.gnu.org/archive/html/bug-gnulib/2004-11/msg00071.html>.
386         * getdate.y (SHR): Likewise.
387         (tm_diff): Use it.
388         * strftime.c (SHR): Likewise.
389         (tm_diff): Use it.
390         * quotearg.c (struct quoting_options): Use unsigned int for
391         quote_these_too, so that right shifts are well defined.  All uses
392         changed.
393
394 2004-11-10  Simon Josefsson  <jas@extundo.com>
395
396         * getaddrinfo.h, getaddrinfo.c: New files.
397
398 2004-11-10  Jim Meyering  <jim@meyering.net>
399
400         Ensure that no close failure goes unreported.
401         * closeout.c (close_stdout): Always close stdout.  I.e., don't
402         return early when it seems there's nothing to flush.
403         Don't include __fpending.h.
404
405 2004-11-09  Paul Eggert  <eggert@cs.ucla.edu>
406
407         * strftime.c (DO_MULTIBYTE): Check for wchar.h, too.
408
409 2004-11-05  Bruno Haible  <bruno@clisp.org>
410
411         * readlink.c: Include stddef.h, needed for size_t on Woe32.
412         Reported by Mark D. Baushke <mdb@cvshome.org>.
413
414 2004-11-04  Bruno Haible  <bruno@clisp.org>
415
416         2004-09-11  Bruno Haible  <bruno@clisp.org>
417                 * allocsa.valgrind: New file.
418         2004-02-06  Bruno Haible  <bruno@clisp.org>
419                 * allocsa.h (sa_alignof): Define differently with HP-UX cc, to
420                 avoid a bug of this cc on HP-UX 10.20 dealing with enums.
421                 Reported by Christopher Seip <chris.seip@hp.com>.
422
423 2004-11-03  Paul Eggert  <eggert@cs.ucla.edu>
424
425         * xreadlink.c (xreadlink): AIX and HP-UX readlink return -1
426         with errno == ERANGE if the buffer is too small.
427         Problem reported by Mark D. Baushke.
428
429 2004-11-02  Paul Eggert  <eggert@cs.ucla.edu>
430
431         * xreadlink.c (MAXSIZE): New macro.
432         (xreadlink): Use it instead of SSIZE_MAX.  Ensure initial buffer
433         size does not exceed MAXSIZE.  Avoid cast.
434         As suggested by Mark D. Baushke in
435         <http://lists.gnu.org/archive/html/bug-gnulib/2004-11/msg00009.html>,
436         if readlink fails with buffer size just under MAXSIZE, try again
437         with MAXSIZE.
438
439 2004-11-02  Derek R. Price  <derek@ximbiot.com>
440        and  Paul Eggert  <eggert@cs.ucla.edu>
441
442         * getdate.y [!TEST]: Include <stdio.h>, since we use sprintf now.
443         (get_date): Overparenthesize to avoid GCC warning.
444
445 2004-11-02  Bruno Haible  <bruno@clisp.org>
446
447         * setenv.h (unsetenv): Define as a macro if the system's unsetenv()
448         function returns void.
449
450 2004-11-01  Paul Eggert  <eggert@cs.ucla.edu>
451
452         * getpass.c (fflush_unlocked, flockfile, funlockfile)
453         (funlockfile, fputs_unlocked, putc_unlocked): Don't define if
454         already declared.
455
456 2004-10-29  Paul Eggert  <eggert@cs.ucla.edu>
457
458         * getdate.y: Add support for TZ="foo" within a date string.
459         Fix some bugs near time_t boundaries.  Reject dates with
460         out-of-range components, e.g., "Sept 31".
461         Include <stdlib.h>, "setenv.h", "xalloc.h".
462         (ISDIGIT_LOCALE): Remove; unused.
463         Note that the TZ and time functions used here are not reentrant.
464         (mktime_ok, get_tz): New functions.
465         (TZBUFSIZE): New constant.
466         (get_date): Parse leading TZ="foo".  Reject out-of-range components;.
467         This requires that we sometimes generate our own TZ="XXX..." setting.
468
469 2004-10-27  Derek R. Price  <derek@ximbiot.com>
470
471         * mktime.c (not_equal_tm): Remove redundant check.
472
473 2004-10-24  Paul Eggert  <eggert@cs.ucla.edu>
474
475         * getdate.y: Use Bison 1.875 features, and some minor
476         code cleanups.  This change does not affect semantics.
477         Don't include <stdlib.h>; no longer needed.
478         Don't include unlocked-io.h; only the "#if TEST" code uses
479         stdio, and performance isn't crucial there.
480         (PC, YYLEX_PARAM, YYPARSE_PARAM): Remove; replaced by
481         Bison 1.875 features as described below.
482         All uses of "PC." replaced by "pc->".
483         (YYSTYPE): Add a forward declaration.
484         (yylex, yyerror): Use full prototypes in forward decls.
485         Use "%pure-parser" rather than obsolescent "%pure_parser".
486         Use %parse-param and %lex-param instead of obsolescent
487         YYPARSE_PARAM and YYLEX_PARAM.
488         (meridian_table, month_and_day_table, time_units_table,
489         relative_time_table, time_zone_table, military_table,
490         lookup_zone, lookup_word, get_date):
491         Use NULL instead of 0 where appropriate.
492         (to_hour): Avoid abort (), to avoid a dependency on
493         stdlib.h.
494         (yyerror, yylex): Now accepts parser_control * arg.
495         (main) [TEST]: Use '\0' rather than 0 for char.
496
497 2004-10-22  Paul Eggert  <eggert@cs.ucla.edu>
498
499         * getpagesize.c (getpagesize): Don't assume <sys/param.h> exists.
500         It's now the caller's responsibility to handle the case where
501         !HAVE_GETPAGESIZE && !defined getpagesize.
502
503         * mktime.c (leapyear): Arg is long int, not int.
504
505 2004-10-18  Paul Eggert  <eggert@cs.ucla.edu>
506
507         * argp-fs-xinl.c, argp-xinl.c: Update from glibc.
508
509 2004-10-12  Simon Josefsson  <jas@extundo.com>
510
511         * getpass.c (fflush_unlocked, flockfile, funlockfile)
512         (fputs_unlocked, putc_unlocked) [!_LIBCS && !USE_UNLOCKED_IO]: Map
513         to real functions.
514
515 2004-10-11  Yoann Vandoorselaere  <yoann@prelude-ids.org>
516
517         * vsnprintf.h: New file.
518         * vsnprintf.c: New file.
519
520 2004-10-07  Bruno Haible  <bruno@clisp.org>
521
522         * snprintf.c (snprintf): Avoid a memory allocation if the result fits
523         into the provided buffer.
524
525 2004-10-06  Paul Eggert  <eggert@cs.ucla.edu>
526
527         * diacrit.c, diacrit.h: Add GPL notice.
528
529         * atanl.c, logl.c: Add GPL notice, to match glibc's added LGPL notice.
530         * atanl.c (atanl): Keep the code as similar to glibc as possible.
531         * logl.c (logl): Keep the code as similar to glibc as possible.
532         This avoids a potential constant-folding bug.
533
534 2004-10-05  Bruno Haible  <bruno@clisp.org>
535
536         * strsep.h: Don't declare strsep() if HAVE_STRSEP.
537
538 2004-10-04  Paul Eggert  <eggert@cs.ucla.edu>
539
540         * xalloc.h (xmemdup): Renamed from xclone.  All uses changed.
541         * xmalloc.c (xmemdup): Likewise.
542         * xalloc.h (CCLONE, CLONE, NEW, XCALLOC, XMALLOC, XREALLOC,
543         XFREE): Remove these long-obsolescent macros.
544         * xmalloc.c (xstrdup): Implementation moved here from xstrdup.c
545         * xstrdup.c: Remove.
546
547         * regex.c (re_comp): Cast gettext return value to char *,
548         Problem reported by Martin Neitzel via Mark D. Baushke.
549
550 2004-10-04  Simon Josefsson  <jas@extundo.com>
551
552         * error.c, md5.c, regex.c: Use '#if USE_UNLOCKED_IO' instead of
553         '#ifdef USE_UNLOCKED_IO'.
554
555 2004-10-04  Paul Eggert  <eggert@cs.ucla.edu>
556
557         * argmatch.c, closeout.c, error.c, exclude.c, getdate.y,
558         getndelim2.c, getpass.c, getusershell.c, linebuffer.c,
559         md5.c, mountlist.c, posixtm.c, readtokens.c, readutmp.c,
560         regex.c, sha1.c, version-etc.c, yesno.c:
561         Include "unlocked-io.h" only if USE_UNLOCKED_IO.
562         * unlocked-io.h: Don't worry about USE_UNLOCKED_IO; that's now
563         the includer's responsibility.
564
565         Sync from coreutils.
566
567         * modechange.c (mode_compile): Don't decrement a pointer that
568         points to the start of a string, as the C Standard says the
569         resulting behavior is undefined.
570
571         * backupfile.h (enum backuptype): Rename none -> no_backups,
572         simple -> simple_backups, numbered_existing ->
573         numbered_existing_backups, numbered -> numbered_backups
574         to avoid shadowing problems.  All uses changed.
575         * argmatch.c (enum backuptype) [defined TEST]: Likewise.
576         * backupfile.c (check_extension, numbered_backup):
577         Rename locals to avoid shadowing 'basename'.
578         * backupfile.h (VALID_BACKUP_TYPE): Don't evaluate arg more than
579         once.
580
581         * .cppi-disable: Add getopt_.h, getopt_int.h.
582         * .cvsignore: Add getopt.h.
583
584 2004-10-04  Simon Josefsson  <jas@extundo.com>
585
586         * memmem.h: New file.
587         * memmem.c: New file, taken from glibc.
588
589 2004-10-02  Jim Meyering  <jim@meyering.net>
590
591         * dirfd.h, getpagesize.h: Add copyright notice.
592
593 2004-10-01  Paul Eggert  <eggert@cs.ucla.edu>
594
595         * snprintf.c: Remove comments as to why each header is needed.
596
597 2004-10-01  Yoann Vandoorselaere <yoann@prelude-ids.org>
598
599         * strsep.h: New file.
600         * strsep.c: New file.
601
602 2004-10-01  Simon Josefsson  <jas@extundo.com>
603
604         * snprintf.c (snprintf): Handle size==0.
605
606 2004-10-01  Simon Josefsson  <jas@extundo.com>
607             Bruno Haible  <bruno@clisp.org>
608
609         * snprintf.c: Include <stdarg.h>, <stdlib.h>, <string.h>.
610         (snprintf): Declare 'args'.
611
612 2004-09-30  Simon Josefsson  <jas@extundo.com>
613
614         * snprintf.h, snprintf.c: New files.
615
616 2004-09-30  Sergey Poznyakoff  <gray@Mirddin.farlep.net>
617
618         * argp-help.c (canon_doc_option): Fixed coredump if *name==NULL
619         (hol_entry_help): Never translate an empty string.
620         Do not translate option tag (opt->name) if OPTION_NO_TRANS is set
621         * argp.h (OPTION_NO_TRANS): New option.
622
623 2004-09-29  Oskar Liljeblad  <oskar@osk.mine.nu>
624
625         * xvasprintf.c: Include xalloc.h.
626         (xvasprintf): Use xalloc_die, not xmalloc_die.
627
628 2004-09-28  Paul Eggert  <eggert@cs.ucla.edu>
629
630         * dummy.c: Change copyright notice to FSF, and license to GPL.
631
632 2004-09-13  Paul Eggert  <eggert@cs.ucla.edu>
633
634         * argp-pvh.c (argp_program_version_hook): Provide initial value.
635         Problem reported by Bruno Haible in:
636         http://lists.gnu.org/archive/html/bug-tar/2004-09/msg00023.html
637
638 2004-09-11  Paul Eggert  <eggert@cs.ucla.edu>
639
640         * mempcpy.h: Wrap the entire include file inside #ifndef mempcpy,
641         in case some system header has #define'd it.  Problem reported by
642         Soeren D. Schulze in
643         <http://lists.gnu.org/archive/html/bug-gnulib/2004-09/msg00017.html>.
644
645 2004-09-08  Bruno Haible  <bruno@clisp.org>
646
647         * stdint_.h.in: New file, taken from GNU clisp.
648
649 2004-09-08  Oskar Liljeblad  <oskar@osk.mine.nu>
650
651         * xvasprintf.h: New file.
652         * xvasprintf.c: New file.
653         * xasprintf.c: New file.
654
655 2004-09-08  Bruno Haible  <bruno@clisp.org>
656
657         * vasnprintf.c (VASNPRINTF): Signal EOVERFLOW if the resulting length
658         is > INT_MAX.
659         * vasprintf.c (vasprintf): Don't test for length > INT_MAX any more.
660
661 2004-08-19  Paul Eggert  <eggert@cs.ucla.edu>
662
663         Import from coreutils.
664         * userspec.c: Don't use <alloca.h>, so that we don't use alloca on
665         strings on unbounded length.  alloca's performance benefits aren't
666         that important here.
667         (V_STRDUP): Remove.
668         (parse_with_separator): New function, with most of the internals
669         of the old parse_user_spec.  Allow user to omit both user and group,
670         for compatibility with FreeBSD.
671         Clone only the user name, not the entire spec.
672         Do not set *uid, *gid unless entirely successful.
673         Avoid memory leak in some failing cases.
674         Fix regression for USER.GROUP reported by Dmitry V. Levin in
675         <http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00102.html>
676         (parse_user_spec): Rewrite to use parse_with_separator.
677
678 2004-08-12  Paul Eggert  <eggert@cs.ucla.edu>
679
680         * argp-help.c, argp-parse.c: Use "gettext.h" instead of
681         its complicated substitute.
682         * argp-help.c: Include <errno.h>, for program_invocation_short_name
683         and program_invocation_name.
684         (__argp_basename) [!_LIBC]: Remove; the only use was
685         replaced by its body.
686         (__argp_short_program_name): Change condition from
687         !defined __argp_short_program_name to
688         ! (defined _LIBC || HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME),
689         to match argp-namefrob.h.
690         (__argp_failure): Don't assume strerror_r returns char *.
691         * argp-parse.c (N_): Define unconditionally.
692         (argp_default_options): Fill out initializers with 0 to avoid
693         gcc warnings.
694
695 2004-08-12  Simon Josefsson  <jas@extundo.com>
696
697         * getopt.c, getopt1.c: Remove ELIDE_CODE hack.
698         * getopt_.h: Renamed from getopt.h.
699
700 2004-08-11  Paul Eggert  <eggert@cs.ucla.edu>
701
702         Merge from coreutils.
703
704         * fnmatch.c (WIDE_CHAR_SUPPORT): Don't set to 1 if missing
705         wmemchr or wmemcpy.  Problem reported by Robert Dahlem
706         for Reliant Unix 5.43.
707
708         * obstack.c: Include <inttypes.h> and <stdint.h> if available.
709         (union fooround): Use uintmax_t, not long int.
710         The rest is a merge from libc:
711         [defined _LIBC]: Include <shlib-compat.h>.
712         (_obstack) [defined _LIBC]: Remove after 2.3.4.
713
714         * settime.c (settime): Recode to avoid warning with Sun Forte C 6U2.
715
716         * strverscmp.c: Convert to UTF-8.
717
718 2004-08-09  Paul Eggert  <eggert@cs.ucla.edu>
719
720         * obstack.h (obstack_empty_p):
721         Don't assume that chunk->contents is suitably aligned.
722         * obstack.c (_obstack_begin, _obstack_begin_1, _obstack_newchunk):
723         Likewise. Problem reported by Benno in
724         <http://sources.redhat.com/ml/libc-alpha/2004-08/msg00055.html>.
725
726         * chown.c (rpl_chown): Work even if the file is writeable but not
727         readable.  This could be improved further but it'd take some work.
728
729 2004-08-08  Simon Josefsson  <jas@extundo.com>
730
731         * xgethostname.c: Don't include error.h (not used).
732
733         * getpass.h: Add.
734         * getpass.c: Include getpass.h first.
735
736 2004-08-08  Paul Eggert  <eggert@cs.ucla.edu>
737
738         * xalloc-die.c: New files.
739         * xalloc.h (xalloc_fail_func, xalloc_msg_memory_exhausted): Remove.
740         All uses removed.
741         * xmalloc.c (xalloc_fail_func, xalloc_msg_memory_exhausted): Likewise.
742         Move inclusions of gettext.h, error.h, exitfail.h to xalloc-die.c.
743         (_, N_, xalloc_die): Move to xalloc-die.c.
744         * userspec.c (parse_user_spaec): Use xstrdup rather than strdup,
745         so that we needn't mess with xalloc_msg_memory_exhausted.
746
747         * sha1.h: Renamed from sha.h.
748         (SHA1_H): Renamed from _SHA_H.
749         (sha1_ctx): Renamed from sha_ctx.
750         (sha1_init_ctx): Renamed from sha_init_ctx.
751         (sha1_process_block): Renamed from sha_process_block.
752         (sha1_process_bytes): Renamed from sha_process_bytes.
753         (sha1_finish_ctx): Renamed from sha_finish_ctx.
754         (sha1_read_ctx): Renamed from sha_read_ctx.
755         (sha1_stream): Renamed from sha_stream.
756         (sha1_buffer): Renamed from sha_buffer.
757         * sha1.c: Likewise; renamed from sha.c.
758         Do not include <sys/types.h>.
759         Include <stddef.h> rather than <stdlib.h>.
760
761 2004-08-08  Bruno Haible  <bruno@clisp.org>
762
763         * pathname.h (FILE_SYSTEM_PREFIX_LEN): Renamed from
764         FILESYSTEM_PREFIX_LEN.
765         * progreloc.c: Likewise.
766         * concatpath.c (concatenated_pathname): Use FILE_SYSTEM_PREFIX_LEN.
767
768 2004-08-06  Paul Eggert  <eggert@cs.ucla.edu>
769
770         Merge from tar.
771         * argp-help.c (make_hol, hol_append): Don't assume that
772         SIZE_MAX is a valid preprocessor constant.
773         (__argp_basename): Change from "#ifndef _LIBC"
774         to "#ifndef __argp_short_program_name", so that
775         we don't compile these functions for tar.
776
777         More merges from coreutils.
778         * raise.c, readtokens0.h, readtokens0.c, strftime.h, utimens.h,
779         utimens.c, utimecmp.h, utimecmp.c, xnanosleep.h, xnanosleep.c,
780         yesno.h: New files.
781         * addext.c: Remove; no longer needed.
782         * yesno.c, argmatch.h, argmatch.c, backupfile.h, backupfile.c,
783         euidaccess.c, filemode.c, closeout.c, dup2.c, exclude.c,
784         fileblocks.c, filemode.c, fnmatch.c, fnmtahc_loop.c,
785         fopen-safer.c, fsusage.c, fsusage.h, ftruncate.c, full-write.c,
786         getdate.y, getloadavg.c, getugroups.c, hard-locale.c, hard-locale.h,
787         hash.c, human.c, human.h, lchown.c, lchown.h, makepath.c, makepath.h,
788         md5.c, md5.h, memchr.c, memcoll.c, memrchr.c, modechange.c,
789         modechange.h, mountlist.c, mountlist.h, nanosleep.c, posixtm.c,
790         putenv.c, quotearg.c, quotearg.h, readtokens.c, readutmp.c,
791         readutmp.h, rmdir.c, safe-read.c, save-cwd.c, savedir.c, setenv.c,
792         sig2str.c, stat.c, strtoimax.c, strverscmp.c, userspec.c, utime.c,
793         version-etc.c., xgethostname.c, xmemcoll.c, xreadlink.c, xstrtod.c,
794         xstrtod.h, xstrtoimax.c, xstrtol.c, xstrtol.h, xstrtoumax.c:
795         Import changes from coreutils.
796
797 2004-08-05  Paul Eggert  <eggert@cs.ucla.edu>
798
799         Merge from coreutils.
800
801         * .gdb-history: Remove; this doesn't belong here.
802
803         * c-strtod.c, c-strtod.h, c-strtold.c, cycle-check.c,
804         cycle-check.h, dev-ino.h, canonicalize.h, canonicalize.c,
805         fcntl-safer.h, fcntl-safer.c, getcwd.c: New files.
806
807         * dirname.h: Include <stdbool.h>.
808         (FILE_SYSTEM_PREFIX_LEN): Renamed from FILESYSTEM_PREFIX_LEN,
809         for consistency with POSIX terminology.  All uses changed.
810         (IS_ABSOLUTE_FILE_NAME, IS_RELATIVE_FILE_NAME): New macros.
811         (strip_trailing_slashes): Use bool for booleans.
812         * stripslash.c (strip_trailing_slashes): Likewise.
813
814         * error.c: Work around bug in OpenBSD 3.4 sterror_r: it
815         sometimes returns a positive errno value even when it succeeds.
816         (print_errno_message) [!LIBC]: Fall back on strerror if
817         __strerror_r fails.
818
819         * path-concat.c (mempcpy): Don't define if a system header defines it.
820         Don't include stdio.h, stdlib.h, unistd.h, strdup.h.
821         (longest_relative_suffix): New function.
822         (path_concat): Use it.  Assume first argument is not NULL.
823         Port to DOS.  Omit redundant separators.
824         Report an error instead of returning NULL.
825         Use mempcpy instead of memcpy.
826         (xpath_concat): Remove: not declared or used.
827
828         * same.h: Include <stdbool.h>
829         (same_name): Return bool, not int.
830         * same.c (same_name): Likewise.
831         (errno): Don't declare; we assume C89 or better now.
832
833         * stat-macros (S_ISCTG, S_ISOFD, S_ISOFL): New macros,
834         if not already defined.
835
836         * xgetcwd.c (errno): Don't declare; we assume C89 or better now.
837         * dup-safer.c (errno): Likewise.
838
839 2004-08-03  Paul Eggert  <eggert@cs.ucla.edu>
840
841         * fatal.c, fatal.h: Remove as the "fatal" module wasn't used or
842         working.
843
844 2004-08-03  Simon Josefsson  <jas@extundo.com>
845
846         * strdup.h: Only use HAVE_DECL_STRDUP if defined.
847         * progname.h: Don't include stdbool.h.
848
849 2004-08-02  Simon Josefsson  <jas@extundo.com>
850
851         * getsubopt.h: New file, with comments from Bruno Haible.
852         * getsubopt.c: New file, from glibc, but slightly modified based on
853         suggestions from Paul Eggert <eggert@cs.ucla.edu>.
854
855 2004-08-01  Simon Josefsson  <jas@extundo.com>
856
857         * xgetdomainname.c: Include stdlib.h, for free().
858
859 2004-07-16  Simon Josefsson  <jas@extundo.com>
860
861         * dummy.c: New file.
862
863 2004-07-16  Bruno Haible  <bruno@clisp.org>
864
865         * backupfile.h: Add extern "C" for C++.
866         * closeout.h: Likewise.
867         * copy-file.h: Likewise.
868         * findprog.h: Likewise.
869         * full-write.h: Likewise.
870         * pathname.h: Likewise.
871         * progname.h: Likewise.
872         * stpcpy.h: Likewise.
873         * stpncpy.h: Likewise.
874         * strcase.h: Likewise.
875         * strstr.h: Likewise.
876         * xalloc.h: Likewise.
877
878         * mbswidth.h: Add extern "C" for C++.
879         Reported by Albert Chin-A-Young <china@thewrittenword.com>.
880
881 2004-07-09  Simon Josefsson  <jas@extundo.com>
882
883         * getndelim2.c: Include stddef.h, for ptrdiff_t.  (FreeBSD 4.9
884         failed without this.)
885
886 2004-07-09  Paul Eggert  <eggert@cs.ucla.edu>
887
888         * fchown-stub.c: New file.
889
890 2004-06-24  Jim Meyering  <jim@meyering.net>
891
892         * obstack.h (obstack_base): Cast to (void *), per documentation.
893
894 2004-06-22  Paul Eggert  <eggert@cs.ucla.edu>
895
896         * argz.c, argz_.h: New files, which are autoupdated from libtool.
897
898 2004-06-01  Jim Meyering  <jim@meyering.net>
899
900         * calloc.c: New file.
901
902 2004-06-06  Paul Eggert  <eggert@cs.ucla.edu>
903
904         * getdate.y (yylex): Allow space between sign and number.
905         Problem reported by Dan Jacobson.
906
907 2004-06-01  Paul Eggert  <eggert@cs.ucla.edu>
908        and  Jim Meyering  <jim@meyering.net>
909
910         Merge from coreutils CVS.
911
912         * stat-macros.h: New file, with contents from file-type.h
913         and coreutils' system.h.
914         * file-type.c: Include "stat-macros.h".
915         * file-type.h (file_type): Move all macro definitions to new file,
916         stat-macros.h.
917
918         * chown.c (rpl_chown) [CHOWN_FAILS_TO_HONOR_ID_OF_NEGATIVE_ONE]:
919         Wrap old code with this conditional.
920         [CHOWN_MODIFIES_SYMLINK]: Try to work around a chown
921         function that does not dereference symlinks.
922         * lchown.c (lchown) [CHOWN_MODIFIES_SYMLINK]: Just call chown.
923
924         * xreadlink.c: Include xreadlink.h first, to catch .h file
925         dependency problems.
926         (xreadlink): Accept new arg SIZE, for efficiency.
927         All decls and uses changed.
928         * xreadlink.h: Include <stddef.h>, for size_t.
929
930         * .cppi-disable: Add alloca_.h, allocsa.h, exit.h, getndelim2.h,
931         gettext.h, localcharset.h, strdup.h, strndup.h, strtoul.c, time_r.h.
932
933         * .cvsignore: Add alloca.h, fnmatch.h, poll.h, stdbool.h, sysexits.h.
934
935 2004-05-30  Paul Eggert  <eggert@cs.ucla.edu>
936
937         * xmalloc.c (HAVE_MALLOC, HAVE_REALLOC): Do not require these
938         macros to be defined.
939         (xnmalloc_inline, xnrealloc_inline, xcalloc): Do not die if
940         the allocator returns NULL because the requested size is zero.
941
942 2004-05-20  Paul Eggert  <eggert@cs.ucla.edu>
943
944         * malloc/obstack.c (_obstack) [defined _LIBC]: Bring back this
945         var.  Add comment explaining why libc still defines it.  This
946         merges the following patch from glibc:
947         http://sources.redhat.com/ml/libc-alpha/2004-05/msg00157.html
948
949 2004-05-19  Paul Eggert  <eggert@cs.ucla.edu>
950
951         * obstack.c (_obstack): Remove unused variable.  It hasn't been
952         present in glibc since revision 1.1 of this file.
953         * obstack.h (_obstack_free, obstack_1grow, obstack_1grow_fast,
954         obstack_alignment_mask, obstack_alloc, obstack_base,
955         obstack_blank, obstack_blank_fast, obstack_chunk_size,
956         obstack_copy, obstack_copy0, obstack_finish, obstack_grow,
957         obstack_grow0, obstack_init, obstack_int_grow,
958         obstack_int_grow_fast, obstack_make_room, obstack_memory_used,
959         obstack_next_free, obstack_object_size, obstack_ptr_grow,
960         obstack_ptr_grow_fast, obstack_room): Remove declarations of
961         nonexistent functions.
962
963 2004-05-17  Derek R. Price  <derek@ximbiot.com>
964             Paul Eggert  <eggert@cs.ucla.edu>
965
966         * argp-help.c, argp-parse.c: Assume <alloca.h> rather than freecoding.
967
968 2004-05-14  Bruno Haible  <bruno@clisp.org>
969
970         * vasnprintf.c (VASNPRINTF): Correctly handle the case of a precision
971         that consists of a '.' followed by an empty digit string.
972         Patch by Tor Lillqvist <tml@iki.fi>.
973
974 2004-05-17  Paul Eggert  <eggert@cs.ucla.edu>
975
976         Port obstack to the AS/400, where pointers are 16 bytes wide and
977         you cannot cast an integer to a valid pointer.  This patch is
978         currently waiting to be integrated into glibc; see
979         <http://sources.redhat.com/ml/libc-alpha/2004-05/msg00073.html>.
980
981         * obstack.h (__PTR_TO_INT, __INT_TO_PTR): Remove.
982         All uses of __INT_TO_PTR (PTR_TO_INT ...) replaced by __PTR_ALIGN.
983         (__BPTR_ALIGN, __PTR_ALIGN): New macros.
984         (struct obstack): temp member is now a union of a pointer and
985         an integer, instead of an integer.  All integer uses changed.
986         This does not affect the physical layout of struct obstack,
987         except on hosts (like the AS/400) where the size or alignment of
988         void * is greater than that of ptrdiff_t.
989         (obstack_finish) [! (defined __GNUC__ && defined __STDC__ &&
990         __STDC__)]: Store temporary in pointer member of union, not
991         integer member.
992         * obstack.c: Include <stddef.h>, for offsetof.
993         (struct fooalign): Remove; it doesn't need a name.
994         (union fooround): Change double to long double, and add void *.
995         (DEFAULT_ALIGNMENT): Use offsetof to compute.
996         (DEFAULT_ALIGNMENT, DEFAULT_ROUNDING): Now an enum constant,
997         not a macro.  Hence the values are always int; so remove all
998         casts-to-int in uses.
999
1000 2004-05-16  Paul Eggert  <eggert@cs.ucla.edu>
1001             Derek Price  <derek@ximbiot.com>
1002
1003         * alloca.c: Include <alloca.h>, to get our interface.
1004         * alloca_.h: Use __alloca on AIX, so that we don't have to
1005         include <alloca.h> first.  Use C89 prototype for alloca; this
1006         requires including <stddef.h> for size_t.  Use extern "C" if C++.
1007         Use #elif for simplicity, since we can assume C89 now.
1008         Don't try to source the system alloca.h since it will not be found
1009         and to prevent recursively including its replacement.
1010         * fnmatch.c: Include <alloca.h> instead of opencoding.
1011         * regex.c: Likewise.
1012
1013 2004-05-16  Derek Price  <derek@ximbiot.com>
1014             Paul Eggert  <eggert@cs.ucla.edu>
1015
1016         getline cleanup.  This changes the getndelim2 API: both order of
1017         arguments, and meaning of delim2 (now uses EOF, not 0, to indicate
1018         no delimiter).
1019
1020         * getline.c: Don't include stddef.h or stdio.h, since our
1021         interface does that.
1022         (getline): Always use getdelim, so that we don't have two
1023         copies of this code.
1024         * getndelim2.c: Include <limits.h>, <inttypes.h>, <stdint.h>
1025         if available.
1026         (PTRDIFF_MAX, SIZE_MAX, SSIZE_MAX): Define if not defined.
1027         (GETNDELIM2_MAXIMUM): New macro.
1028         (getndelim2): Reorder arguments.  delim==EOF now means no delimiter,
1029         instead of the old practice of delim2==0.  All callers changed.
1030         Return -1 on overflow, instead of returning junk.
1031         Do not set *linesize unless allocation succeeds.
1032         * getndelim2.h: Do not include stddef.h; no longer needed, now
1033         that we include sys/types.h.
1034         * getnline.h: Likewise.
1035         * getndelim2.h (GETNLINE_NO_LIMIT): New macro.
1036         (getndelim2): Reorder arguments.
1037         * getnline.c (getnline, getndelim):
1038         Don't discard the NMAX argument.
1039         (getnline): Invoke getndelim, to avoid code duplication.
1040         * getnline.h (GETNLINE_NO_LIMIT): New macro, used instead
1041         of (size_t) -1 by callers of the getnline family.
1042
1043 2004-05-13  Paul Eggert  <eggert@cs.ucla.edu>
1044
1045         * nanosleep.c (suspended): Change its type from int to
1046         sig_atomic_t volatile.
1047         (first_call): Make it private to rpl_nanosleep, and have it
1048         be zero initially as that's a bit faster.
1049         (my_usleep): Round up fractional times instead of truncating them,
1050         as this is the usual meaning for 'sleep'.
1051
1052         * gettime.c (gettime): Fall back on `time' if `gettimeofday'
1053         doesn't work.
1054         * settime.c: Include <unistd.h>, for stime (on Solaris 8, anyway).
1055         (ENOSYS): Define if not defined.
1056         (settime): Fall back on stime if it exists and settimeofday fails.
1057         But don't bother with fallbacks if a method fails with errno == EPERM.
1058
1059 2004-05-11  Jim Meyering  <jim@meyering.net>
1060
1061         Prior to this change, the save_cwd caller required read access to the
1062         current directory on most systems (ones with the fchdir function).
1063
1064         * save-cwd.c (save_cwd) [HAVE_FCHDIR]: If opening `.' read-only
1065         fails, try write-only, and finally, resort to using xgetcwd.
1066
1067 2004-05-06  Paul Eggert  <eggert@cs.ucla.edu>
1068
1069         * obstack.c, obstack.h: Import changes from libc.
1070
1071 2004-04-28  Bruno Haible  <bruno@clisp.org>
1072
1073         * findprog.c (find_in_path): Treat Cygwin like Windows, since it also
1074         implicitly appends .exe to executables.
1075         * localcharset.c (ISSLASH): Treat Cygwin like Windows, since it now
1076         accepts Windows pathnames.
1077         * pathname.h (ISSLASH, IS_PATH_WITH_DIR, FILESYSTEM_PREFIX_LEN): Treat
1078         Cygwin like Windows, since it now accepts Windows pathnames.
1079         * progreloc.c (ISSLASH, IS_PATH_WITH_DIR, FILESYSTEM_PREFIX_LEN): Treat
1080         Cygwin like Windows, since it now accepts Windows pathnames.
1081         Reported by Derek Robert Price <derek@ximbiot.com>.
1082
1083 2004-04-20  Jim Meyering  <jim@meyering.net>
1084
1085         * getndelim2.c (getndelim2): Upon realloc failure, don't leak memory.
1086
1087 2004-04-20  Jim Meyering  <jim@meyering.net>
1088             Bruno Haible  <bruno@clisp.org>
1089
1090         * localcharset.c (get_charset_aliases) [!VMS && !WIN32]: Don't leak
1091         memory when realloc fails.
1092
1093 2004-04-18  Jim Meyering  <jim@meyering.net>
1094
1095         * readutmp.c (read_utmp) [UTMP_NAME_FUNCTION]: Upon realloc failure,
1096         don't leak memory and do call END_UTMP_ENT.
1097
1098 2004-04-11  Paul Eggert  <eggert@twinsun.com>
1099
1100         * inttostr.h: Include <limits.h> unconditionally, since we assume C89.
1101         (CHAR_BIT): Remove, since we assume C89.
1102         Include <stdint.h> if available, as per current Autoconf CVS advice.
1103
1104 2004-03-30  Paul Eggert  <eggert@twinsun.com>
1105
1106         * cloexec.h, cloexec.c (set_cloexec_flag): Return int
1107         not bool, to be more consistent with Unix conventions.
1108         Suggested by Bruno Haible.
1109
1110         Merge from coreutils.
1111
1112         * imaxtostr.c, inttostr.c, inttostr.h, offtostr.c, umaxtostr.c:
1113         New files.
1114
1115         * getdate.h: Include stdbool.h, and timespec.h instead of
1116         the usual <time.h> dance.
1117         (get_date): Change signature to support fractional time stamps.
1118         All callers changed.
1119         * getdate.y: Include "getdate.h" first, as we can now
1120         assume C89 and don't need to worry about 'const'.
1121         Similarly, include "unlocked-io.h" near start, not in middle.
1122         Include <limits.h>.
1123         (textint.value): Use long int rather than int.
1124         (textint.digits): Use size_t rather than int.
1125         (BILLION, LOG10_BILLION): New constants.
1126         (parser_control): New member rel_ns.  Members day_ordinal,
1127         time_zone, month, day, hour, minutes, rel_year, rel_month,
1128         rel_day, rel_hour, rel_minutes, rel_seconds
1129         are now long int, not int.  Member seconds is now struct timespec,
1130         not int.  New member timespec_seen.  Members dates_seen, days_seen,
1131         local_zones_seen, rels_seen, times_seen, zones_seen are now size_t,
1132         not int.
1133         (%union.intval): Now long int, not int.
1134         New member timespec.
1135         (tSDECIMAL_NUMBER, tUDECIMAL_NUMBER): New tokens.
1136         (seconds, signed_seconds, unsigned_seconds): New nonterminals.
1137         (spec): Now is a timespec or an item list.
1138         (timespec, items): New nonterminals.
1139         (time, rel, relunit, number, get_date):
1140         Add support for fractional seconds.
1141         (time): Fix bug: seconds weren't cleared in "00:00 +0000" syntax.
1142         (gmtime, localtime, mktime): Remove decls; not needed with C89.
1143         (to_hour): First arg is now long int, not int.
1144         (to_year): Returns long int, not int.
1145         Don't treat year -70 like 70.
1146         (tm_diff): Returns long int, not int.
1147         (lookup_word): Use bool instead of int when appropriate.
1148         (yylex): Use size_t for count, not int.
1149         Detect overflow when parsing large integer constants.
1150         Add support for fractions.
1151         (get_date): Make pointers 'const' if possible.
1152         Use more-portable code to detect integer overflow.
1153         (main) [TEST]: Adjust to above changes.  Test for localtime failure.
1154         Don't use ctime; it's not reliable if the year has >4 digits.
1155
1156         * human.c (humblock): Inspect BLOCKSIZE if BLOCK_SIZE isn't set.
1157         This is for compatibility with BSD.
1158
1159         * timespec.h (ST_TIME_CMP_NS, ST_TIME_CMP): Define.
1160         (ATIME_CMP, CTIME_CMP, MTIME_CMP, TIMESPEC_NS): Likewise.
1161         From coreutils' system.h.
1162
1163         * userspec.c: Don't include "posixver.h".
1164         (parse_user_spec): Fall back on USER.GROUP parsing, regardless
1165         of POSIX version, as POSIX 1003.1-2001 allows that behavior as a
1166         compatible extension.  Simplify code by removing a boolean int
1167         that was always nonzero if a string was nonnull.
1168
1169 2004-03-30  Jim Meyering  <jim@meyering.net>
1170
1171         Merge from coreutils.
1172
1173         * mountlist.c [HAVE_SYS_UCRED_H]: Include grp.h before sys/ucred.h.
1174
1175         * readtokens.c (readtoken): Don't leak 64 bytes when reading
1176         an empty input stream.
1177
1178         * readtokens.c: Include <stdbool.h>.
1179         (readtoken): Use `size_t' rather than int/long.
1180         All callers adjusted.
1181         Use `bool' rather than `int' where appropriate.
1182         Use memset rather than an explicit loop.
1183         Use x2nrealloc rather than xrealloc.
1184         Allow the use of `\0' as a delimiter.
1185         (readtokens): Likewise.
1186         * readtokens.h (readtoken, readtokens): Update prototypes.
1187
1188 2004-03-30  Bruno Haible  <bruno@clisp.org>
1189
1190         * getloadavg.c (getloadavg): Don't assume setlocale returns
1191         nonnull.
1192
1193 2004-03-29  Paul Eggert  <eggert@twinsun.com>
1194
1195         Merge changes to getloadavg.c from coreutils and Emacs.
1196
1197         * getloadavg.c [!defined HAVE_SETLOCALE] (setlocale):
1198         Define to an expression, not to the empty string.
1199         Include cloexec.h and xalloc.h.
1200         (getloadavg): Restore LC_NUMERIC locale after setting it temporarily.
1201         Use set_cloexec_flag rather than rolling our own.
1202         * cloexec.c, cloexec.h: New files.
1203
1204 2004-03-18  Paul Eggert  <eggert@twinsun.com>
1205
1206         * getopt.h: Sync with libc CVS.
1207
1208 2004-03-18  Paul Eggert  <eggert@twinsun.com>
1209             Bruno Haible  <bruno@clisp.org>
1210
1211         * mbswidth.h: Include <wchar.h> only if HAVE_DECL_MBSWIDTH_IN_WCHAR_H,
1212         not on all platforms that have <wchar.h>.
1213         * mbswidth.c: Include <stdio.h> and <time.h> before <wchar.h>.
1214
1215 2004-03-09  Paul Eggert  <eggert@twinsun.com>
1216
1217         * argp-parse.c, getopt.c, getopt.h, getopt1.c:
1218         Sync with libc CVS.
1219         * getopt_int.h: New file, also synced from libc.
1220
1221 2004-03-07  Paul Eggert  <eggert@twinsun.com>
1222
1223         * c-stack.c (SIGACTION_WORKS): New macro.  Use it instead of long
1224         '#if' expressions.  Unlike the code it replaces, it does not
1225         depend on (defined _SC_PAGESIZE).  However, it does depend on
1226         HAVE_STRUCT_SIGACTION_SA_SIGACTION; this last change fixes a bug
1227         first reported by Jason Andrade in
1228         <http://mail.gnu.org/archive/html/bug-textutils/2003-03/msg00027.html>.
1229
1230 2004-01-18  Simon Josefsson  <jas@extundo.com>
1231
1232         * strdup.h: New file.
1233         * strdup.c: Include it.
1234         * path-concat.c: Include strdup.h. Drop strdup declaration.
1235         * userspec.c: Include strdup.h. Drop strdup declaration.
1236
1237 2004-02-06  Karl Berry  <karl@gnu.org>
1238
1239         * config.charset: update from gettext 0.14.1.
1240
1241 2004-02-05  Paul Eggert  <eggert@twinsun.com>
1242
1243         Add comments and code, prompted by suggestions from Bruno Haible
1244         for sh-quote.
1245         * quotearg.h (quotearg_alloc): New decl.  Improve the comments
1246         describing the enum quoting_style values.
1247         * quotearg.c (quotearg_alloc): New function.
1248         (quotearg_buffer_restyled): Treat lone { and } as special.
1249         Treat = as special.  Work around bug with older shells
1250         that "see" a '\' that is really the 2nd byte of a multibyte char.
1251         Quote empty string with shell_quoting_style.
1252
1253 2004-02-03  Bruno Haible  <bruno@clisp.org>
1254
1255         * pipe.h: New file, from GNU gettext.
1256         * pipe.c: New file, from GNU gettext.
1257
1258 2004-01-27  Bruno Haible  <bruno@clisp.org>
1259
1260         * execute.h: New file, from GNU gettext.
1261         * execute.c: New file, from GNU gettext.
1262         * w32spawn.h: New file, from GNU gettext.
1263
1264 2004-01-23  Paul Eggert  <eggert@twinsun.com>
1265
1266         Exit-status fix from coreutils.
1267
1268         Use exit_failure consistently in place of EXIT_FAILURE,
1269         so that program exit statuses are consistent on failure.
1270
1271         * argmatch.c (ARGMATCH_DIE) [! defined ARGMATCH_DIE]:
1272         Include "exitfail.h", and use exit_failure rather than EXIT_FAILURE.
1273         * argmatch.h: Comment fix to match the above.
1274         * obstack.c (obstack_exit_failure) [!defined _LIBC]:
1275         Now a macro referring to exit_failure, instead of a separate
1276         variable.  Include "exitfail.h" to get it.
1277         * xstrtol.h: Include "exitfail.h".
1278         (STRTOL_FATAL_ERROR): Exit with status exit_failure, not 2.
1279
1280         * long-options.c (parse_long_options): Use prototype
1281         for usage function arg.  Pass it EXIT_SUCCESS rather than 0,
1282         for clarity.
1283
1284 2004-01-21  Jim Meyering  <jim@meyering.net>
1285
1286         * mktime.c (__mktime_internal) [!_LIBC]: Define to mktime_internal
1287         so as not to conflict with a different-sized __mktime_internal
1288         function in GNU libc.
1289         * timegm.c (__mktime_internal) [!_LIBC]: Likewise.
1290         Problem building statically-linked `ls' reported by Michael Brunnbauer.
1291
1292 2004-01-18  Paul Eggert  <eggert@twinsun.com>
1293
1294         Merge from diffutils.
1295
1296         * file-type.c (file_type): Add typed memory objects.
1297         * file-type.h (S_TYPEISTMO): New macro.
1298
1299         * c-stack.h (c_stack_action): Remove argv argument.
1300         * c-stack.c (c_stack_action): Likewise.  All uses changed.
1301         (die): Don't calculate message unless segv_action returns.
1302         (get_stack_location, min_address_from_argv, max_address_from_argv,
1303         volatile stack_base, volatile_stack_size): Remove.
1304         (segv_handler): If ! HAVE_XSI_STACK_OVERFLOW_HEURISTIC, assume
1305         that every segmentation violation is a stack overflow.  (Ouch!)
1306         See Debian bug 136249 (still outstanding) for more info about why
1307         HAVE_XSI_STACK_OVERFLOW_HEURISTIC fails on Linux kernels.
1308
1309 2003-11-30  Bruno Haible  <bruno@clisp.org>
1310
1311         Safer stack allocation.
1312         * setenv.c: Include allocsa.h.
1313         (alloca): Remove fallback definition.
1314         (freea): Remove macro.
1315         (__add_to_environ) [!_LIBC]: Use allocsa instead of alloca. Use freesa
1316         instead of freea.
1317
1318 2003-10-17  Bruno Haible  <bruno@clisp.org>
1319
1320         * binary-io.h: Avoid warnings on Cygwin.
1321
1322 2003-12-28  Bruno Haible  <bruno@clisp.org>
1323
1324         * wait-process.c (wait_subprocess): Add ignore_sigpipe argument.
1325         * wait-process.c (wait_subprocess): Likewise. Handle SIGPIPE specially.
1326
1327 2003-11-28  Bruno Haible  <bruno@clisp.org>
1328
1329         * wait-process.c (cleanup_slaves): Use ANSI C declaration.
1330
1331 2003-11-27  Bruno Haible  <bruno@clisp.org>
1332
1333         * wait-process.c: On Windows, include windows.h. Needed on mingw.
1334
1335 2003-11-17  Bruno Haible  <bruno@clisp.org>
1336
1337         * wait-process.c (wait_process): Disable the 2003-10-31 waitid() patch.
1338
1339 2003-11-24  Bruno Haible  <bruno@clisp.org>
1340
1341         * xallocsa.h: New file, from GNU gettext.
1342         * xallocsa.c: New file, from GNU gettext.
1343
1344 2003-11-24  Bruno Haible  <bruno@clisp.org>
1345
1346         * allocsa.h: New file, from GNU gettext.
1347         * allocsa.c: New file, from GNU gettext.
1348
1349 2003-11-24  Bruno Haible  <bruno@clisp.org>
1350
1351         * eealloc.h: New file.
1352
1353 2004-01-15  Jim Meyering  <jim@meyering.net>
1354
1355         Merge from coreutils.
1356
1357         * md5.h (rol) [__GNUC__ && __i386__]: Don't use `asm' code.  These
1358         days, gcc-3.x does better all by itself.  Patch from Dean Gaudet:
1359         http://mail.gnu.org/archive/html/bug-coreutils/2003-11/msg00144.html
1360
1361         * posixver.c (DEFAULT_POSIX2_VERSION): Use definition of new,
1362         optional configure-time default.
1363
1364         * version-etc.c (version_etc_copyright): Update copyright date.
1365
1366         * xreadlink.c (xreadlink): Correct outdated comment.
1367
1368 2004-01-15  Paul Eggert  <eggert@twinsun.com>
1369
1370         Merge from coreutils.
1371
1372         * posixver.c: Include posixver.h.
1373
1374         * same.c: Include <stdbool.h>, <limits.h>.
1375         (_POSIX_NAME_MAX): Define if not defined.
1376         (MIN): New macro.
1377         (same_name): If file names are silently truncated, report
1378         that the file names are the same if they are the same after
1379         the silent truncation.
1380
1381         * xstrtod.h (xstrtod): Accept an extra arg, specifying the
1382         conversion function.
1383         * xstrtod.c (xstrtod): Likewise.  All callers changed to
1384         include c-strtod.h and use c_strtod.  Don't include stdlib.h; no
1385         longer needed.
1386
1387 2004-01-14  Paul Eggert  <eggert@twinsun.com>
1388
1389         * fnmatch_loop.c (ALLOCA_LIMIT): Remove macro, which collided
1390         with like-named macro in fnmatch.c.
1391         (EXT): Use an internal constant instead.
1392
1393         Merge fnmatch patches from glibc.
1394         * fnmatch.c (mbsinit): Remove define.
1395         Add libc_hidden_ver (__fnmatch, fnmatch).
1396         * fnmatch_loop.c (FCT): Cast to int32_t and UCHAR when appropriate.
1397         Adjust to renaming of collseq_table_lookup to __collseq_table_lookup.
1398
1399 2003-12-14  Karl Berry  <karl@gnu.org>
1400
1401         * config.charset: update from gettext-runtime.
1402
1403 2003-12-03  Paul Eggert  <eggert@twinsun.com>
1404
1405         * getgroups.c (getgroups): xmalloc takes one argument, not two.
1406         Bug reported by Alfred M. Szmidt.
1407
1408 2003-11-29  Karl Berry  <karl@gnu.org>
1409
1410         * argp-{help.c,parse.c,namefrob.h}, argp.h: update from libc.
1411
1412 2003-11-23  Paul Eggert  <eggert@twinsun.com>
1413             Bruno Haible  <bruno@clisp.org>
1414
1415         * printf-parse.h: Don't include sys/types.h.
1416         (ARG_NONE): New macro.
1417         (char_directive): Change type of *arg_index fields to size_t.
1418         * printf-parse.c: Don't include sys/types.h.
1419         (SSIZE_MAX): Remove macro.
1420         (PRINTF_PARSE): Change the type of the arg_index variables to size_t.
1421         Remove unnecessary overflow check.
1422         * vasnprintf.c (VASNPRINTF): Update for type change of *arg_index
1423         fields.
1424
1425 2003-11-24  Paul Eggert  <eggert@twinsun.com>
1426
1427         * alloca.c: Remove dependency on xalloc module.
1428         (xalloc_die): Remove.
1429         (memory_full) [!defined emacs]: New macro.
1430         [!defined emacs]: Don't include xalloc.h.
1431         (alloca): Invoke memory_full, not xalloc_die, if malloc fails or
1432         address arithmetic overflows.  Change datatypes a bit to avoid
1433         unnecessary casts.
1434
1435 2003-11-22  Jim Meyering  <jim@meyering.net>
1436
1437         * xmalloc.c (x2nrealloc_inline): Fix typos in comments: s/size/size_t/.
1438
1439 2003-11-17  Bruno Haible  <bruno@clisp.org>
1440
1441         * vasnprintf.c (alloca): Remove fallback definition.
1442         (freea): Remove definition.
1443         (VASNPRINTF): Use alloca only for small sizes, say <= 4000 bytes.
1444         Reported by Paul Eggert.
1445
1446 2003-11-17  Jim Meyering  <jim@meyering.net>
1447
1448         On systems without utime and without a utimes function capable of
1449         dealing with a NULL struct utimbuf* argument, this utime replacement
1450         could -- in unusual circumstances -- leak a file descriptor.
1451         * utime.c: Include <unistd.h> and <errno.h>.
1452         (utime_null): Be sure to close `fd' and to preserve errno.
1453         Reported by Geoff Collyer via Arnold Robbins.
1454
1455 2003-11-16  Paul Eggert  <eggert@twinsun.com>
1456             Bruno Haible  <bruno@clisp.org>
1457
1458         Protect against address arithmetic overflow.
1459         * printf-args.h: Include stddef.h.
1460         (arguments): Change type of field 'count' to size_t.
1461         * printf-args.c (printf_fetchargs): Use size_t instead of
1462         'unsigned int' where appropriate.
1463         * printf-parse.h: Include sys/types.h.
1464         (char_directive): Change type of *arg_index fields to ssize_t.
1465         (char_directives): Change type of fields 'count', max_*_length to
1466         size_t.
1467         * printf-parse.c: Include sys/types.h and xsize.h.
1468         (SSIZE_MAX): Define fallback value.
1469         (PRINTF_PARSE): Use size_t instead of 'unsigned int' and ssize_t
1470         instead of 'int' where appropriate. Check a_allocated, d_allocated
1471         against overflow. Reject %m$ argument numbers > SSIZE_MAX + 1.
1472         * vasnprintf.c: Include xsize.h.
1473         (VASNPRINTF): Use size_t instead of 'unsigned int' where appropriate.
1474         Check alloca, malloc, realloc, ENSURE_ALLOCATION arguments against
1475         overflow. Avoid wraparound when converting a width or precision from
1476         decimal to binary.
1477
1478 2003-11-16  Bruno Haible  <bruno@clisp.org>
1479
1480         Update from GNU gettext.
1481         * printf-parse.c: Generalize to it can be compiled for wide strings.
1482         (PRINTF_PARSE, CHAR_T, DIRECTIVE, DIRECTIVES): New macros.
1483         * vasnprintf.c: Generalize to it can be compiled for wide strings.
1484         (VASNPRINTF, CHAR_T, DIRECTIVE, DIRECTIVES, PRINTF_PARSE, USE_SNPRINTF,
1485         SNPRINTF): New macros.
1486         Don't include <alloca.h> if the file is used inside libintl.
1487         (local_wcslen): New function, for Solaris 2.5.1.
1488         (VASNPRINTF): Use it instead of wcslen.
1489
1490 2003-11-16  Bruno Haible  <bruno@clisp.org>
1491
1492         * xsize.h (xmax): New function.
1493         (xsum, xsum3, xsum4): Declare as "pure" functions.
1494
1495 2003-11-12  Paul Eggert  <eggert@twinsun.com>
1496
1497         * xalloc.h: Do not include <limits.h> or <stdint.h>.
1498         (xalloc_oversized): Use sizeof (ptrdiff_t) and sizeof (size_t) for
1499         the heuristic, rather than PTRDIFF_MAX and SIZE_MAX.  This
1500         heuristic is just as accurate as far as we know, and it removes a
1501         dependency on size_max.m4 and ptrdiff_max.m4.
1502
1503 2003-11-12  Paul Eggert  <eggert@twinsun.com>
1504
1505         * xstrtol.c (__xstrtol): Remove "break" immediately after
1506         "return", to pacify some unknown compiler.  Problem reported
1507         by Joerg Schilling.
1508
1509 2003-11-11  Bruno Haible  <bruno@clisp.org>
1510
1511         * xsize.h (SIZE_MAX): Remove fallback definition.
1512         * xalloc.h: Include limits.h. Assume SIZE_MAX and PTRDIFF_MAX are
1513         defined.
1514
1515 2003-11-10  Paul Eggert  <eggert@twinsun.com>
1516
1517         * xalloc.h (xalloc_oversized): [! (defined PTRDIFF_MAX &&
1518         PTRDIFF_MAX < SIZE_MAX)]: Fix off-by-one error that would have
1519         rejected some allocations of exactly SIZE_MAX - 2 bytes.
1520         From Bruno Haible.
1521         [defined PTRDIFF_MAX && PTRDIFF_MAX < SIZE_MAX]: Use SIZE_MAX,
1522         not (size_t) -1, since it's defined here.
1523
1524 2003-11-06  Paul Eggert  <eggert@twinsun.com>
1525
1526         * xalloc.h [HAVE_STDINT_H]: Include <stdint.h>.
1527         (xalloc_oversized) [! (PTRDIFF_MAX < SIZE_MAX)]:
1528         Reject sizes of exactly SIZE_MAX bytes.
1529         * xreadlink.c: Include "xalloc.h" before checking whether SIZE_MAX
1530         is defined, since "xalloc.h" now defines SIZE_MAX on modern hosts.
1531
1532 2003-11-05  Bruno Haible  <bruno@clisp.org>
1533
1534         * xsize.h: Include limits.h, to avoid a possible collision with
1535         SIZE_MAX defined in <limits.h> on Solaris.
1536
1537 2003-11-04  Bruno Haible  <bruno@clisp.org>
1538
1539         * xsize.h: New file.
1540         * linebreak.c: Include xsize.h.
1541         (mbs_possible_linebreaks, mbs_width_linebreaks): Check malloc()
1542         argument for overflow.
1543         Suggested by Paul Eggert.
1544
1545 2003-10-31  Bruno Haible  <bruno@clisp.org>
1546
1547         * wait-process.c (wait_process): Use waitid with WNOWAIT if available,
1548         to avoid (extremely rare) race condition.
1549         Suggested by Paul Eggert.
1550
1551 2003-11-03  Jim Meyering  <jim@meyering.net>
1552
1553         * userspec.c: Include "userspec.h".
1554         * userspec.h: New file.
1555
1556 2003-10-31  Paul Eggert  <eggert@twinsun.com>
1557
1558         * mountlist.h (struct mount_entry.me_type_malloced): New member.
1559         * mountlist.c (SIZE_MAX): Define if not defined already.
1560         (read_filesystem_list): Set and use me_type_malloced.
1561         Use "sizeof *me" rather than "sizeof (struct mount_entry)" (or
1562         whatever the type happens to be), for brevity and consistency.
1563         Check for size calculation overflow on Alphas running OSF/1.
1564
1565 2003-10-31  Jim Meyering  <jim@meyering.net>
1566
1567         * hash.c: Include "xalloc.h" for use of xalloc_oversized.
1568
1569         * linebuffer.c: Include <string.h> for declaration of memset.
1570
1571 2003-10-30  Paul Eggert  <eggert@twinsun.com>
1572             Bruno Haible  <bruno@clisp.org>
1573
1574         * vasprintf.c: Include <limits.h>, <stdlib.h>.
1575         (vasprintf): Fail if the resulting length doesn't fit in an 'int'.
1576
1577 2003-10-29  Paul Eggert  <eggert@twinsun.com>
1578
1579         * xalloc.h (xalloc_oversized): Now a macro, not a function,
1580         so that it works even if SIZE_MAX < N.  Do not include <stdbool.h>;
1581         no longer needed.
1582         * quotearg.c (quotearg_n_options): Use it.
1583         * group-member.c: Include <stdbool.h>.
1584         (free_group_info): Arg is now const *; don't free arg.
1585         (get_group_info): Now returns bool and accepts struct group_info *,
1586         rather than returning a malloc'ed struct group_info *.
1587         All uses changed.  Check for overflow in internal size calculation.
1588
1589         * getusershell.c (readname): Simplify the code by using x2nrealloc
1590         rather than xmalloc/xrealloc.
1591         * linebuffer.c (initbuffer, readlinebuffer): Simplify the code by
1592         using x2realloc rather than xmalloc/xrealloc.  Also, fix a C
1593         conformance bug: the old code used a pointer after freeing the
1594         storage that it addressed.
1595         * hash.c (hash_initialize): Simplify the code by using xalloc_oversized
1596         rather than doing it by hand.
1597         * getgroups.c (getgroups): Don't use xrealloc, since we don't need
1598         the buffer preserved.  Use free and xmalloc instead.
1599         * quotearg.c (quotearg_n_options): Likewise.
1600         Use a simpler test for size overflow.  Don't use xalloc_oversized
1601         because unsigned int might be wider than size_t (!); this suggests
1602         that we should switch from unsigned int to size_t for slot numbers.
1603
1604 2003-10-27  Bruno Haible  <bruno@clisp.org>
1605
1606         * stdbool_.h: Better support for BeOS.
1607
1608 2003-10-27  Paul Eggert  <eggert@twinsun.com>
1609
1610         * exclude.c (new_exclude): Use xzalloc rather than xmalloc
1611         to allocate the returned structure.  Do not allocate a subarray,
1612         as x2nrealloc will do that.
1613         (add_exclude): Use x2nrealloc to reallocate ex->exclude,
1614         instead of xnrealloc.
1615         (add_exclude_file): Use x2realloc instead of malloc + xnrealloc.
1616
1617 2003-10-26  Paul Eggert  <eggert@twinsun.com>
1618
1619         * xalloc.h (xalloc_oversized): New static inline function, for
1620         callers that want to do their own size-overflow checking.  Include
1621         <stdbool.h>, since xalloc_oversized returns bool.
1622         * xalloc.c (array_size_overflow): Remove.  All callers changed
1623         to use xalloc_oversized.
1624
1625         Add two functions x2realloc, x2nrealloc, for programs that grow
1626         arrays dynamically by doubling their sizes.
1627         * xalloc.h (x2realloc, x2nrealloc): New decls.
1628         * xmalloc.c (x2nrealloc_inline, x2nrealloc, x2realloc):
1629         New functions.
1630
1631         Port to C99 semantics for 'inline' of external functions.
1632         Bug reported by Bruno Haible.
1633         * xmalloc.c (xnmalloc_inline): New static inline function,
1634         with the old contents of xnmalloc.
1635         (xnmalloc, xmalloc): Use it.
1636         (xnrealloc_inline): New static inline function,
1637         with the old contents of xnrealloc.
1638         (xnrealloc, xrealloc): Use it.
1639
1640         * alloc.c (alloca): xmalloc cannot return NULL, so don't test for that.
1641
1642 2003-10-25  Paul Eggert  <eggert@twinsun.com>
1643
1644         Fix several address-calculation bugs in the hash modules,
1645         plus some minor code cleanup.
1646
1647         * hash.h: Include <stdbool.h>, for bool.
1648         * hash.c: Don't include <stdbool.h>, since hash.h does it now.
1649         * hash.h (Hash_hasher, hash_get_n_buckets, hash_get_n_buckets_used,
1650         hash_get_n_entries, hash_get_max_bucket_length,
1651         hash_get_entries, hash_do_for_each, hash_string, hash_initialize,
1652         hash_rehash): Use size_t rather than unsigned.
1653         * hash.c (struct hash_table, hash_get_n_buckets,
1654         hash_get_n_buckets_used, hash_get_n_entries,
1655         hash_get_max_bucket_length, hash_table_ok, hash_print_statistics,
1656         hash_get_entries, hash_do_for_each, hash_string, is_prime,
1657         next_prime, hash_initialize, hash_rehash, hash_delete, hash_print):
1658         Likewise.
1659         (SIZE_MAX): Define if not defined.
1660         (hash_get_max_bucket_length, hash_table_ok, hash_lookup,
1661         hash_get_first, hash_get_next, hash_get_entries, hash_do_for_each,
1662         hash_print):
1663         Use const * when possible.
1664         (hash_string): Use (unsigned char) *P rather than *(unsigned char *) P.
1665         (check_tuning): Fix bug: if tuning parameters were very close to
1666         0 or 1, rounding errors could have caused subscript violations.
1667         (hash_initialize, allocate_entry, hash_print): Remove unnecessary cast.
1668         (hash_initialize): Add 'fail:' label
1669         to free table and return NULL, and use it to simplify code.
1670         Use calloc rather than clearing the storage ourself.
1671         (hash_initialize, hash_rehash): Check for arithmetic overflow in
1672         buffer size calculations.
1673         * hash-pjw.h (hash_pjw): Use size_t, not unsigned.
1674         Include <stddef.h>, for size_t.
1675         * hash-pjw.c (hash_pjw): Likewise.
1676         Switch to method described by Bruno Haible.
1677         Include <limits.h>, for CHAR_BIT.
1678         (SIZE_BITS): New macro.
1679
1680 2003-10-21  Paul Eggert  <eggert@twinsun.com>
1681
1682         * getndelim2.c (getndelim2): When size calculation overflows,
1683         ceiling the allocation at NMAX bytes rather than silently
1684         discarding input bytes before NMAX is reached.  This makes
1685         a difference only if NMAX exceeds SIZE_MAX / 2.
1686
1687         * obstack.c: Merge from glibc.
1688         [defined _LIBC]: Include <obstack.h>, not "obstack.h".
1689         Add libc_hidden_def (_obstack_newchunk).
1690         (_obstack_free) [! defined _LIBC]: Remove.
1691         [defined _LIBC]: Make a strong alias from obstack_free, rather than
1692         a clone of the function body.
1693         (fputs) [defined _LIBC && defined USE_IN_LIBIO]: Remove.
1694         [defined _LIBC && !defined USE_IN_LIBIO]: Include <libio/iolibio.h>.
1695
1696         * obstack.h: Indenting cleanup, to make it easier to merge with glibc.
1697         (obstack_grow, obstack_grow0): Remove unnecessary parentheses around
1698         arg to memcpy.
1699
1700         * obstack.h (obstack_1grow_fast): Properly parenthesize arg.
1701         (obstack_ptr_grow_fast, obstack_int_grow_fast):
1702         Don't use lvalue casts, as GCC plans to remove support for them
1703         in GCC 3.5.  Reported by Joseph S. Myers.  This bug
1704         was also present in the non-GCC version, indicating that this
1705         code had always been buggy and had never been widely used.
1706         (obstack_1grow, obstack_ptr_grow, obstack_int_grow, obstack_blank):
1707         Use the fast variant of each macro, rather than copying the
1708         definiens of the fast variant; that way, we'll be more likely to
1709         catch future bugs in the fast variants.
1710
1711 2003-10-20  Bruno Haible  <bruno@clisp.org>
1712
1713         * wait-process.h: New file, from GNU gettext.
1714         * wait-process.c: New file, from GNU gettext.
1715
1716 2003-10-19  Jim Meyering  <jim@meyering.net>
1717
1718         * vasnprintf.c (vasnprintf): Work around losing snprintf on HPUX 10.20.
1719
1720 2003-10-16  Paul Eggert  <eggert@twinsun.com>
1721
1722         * getgroups.c: Include <errno.h>, <stdlib.h>.
1723         (getgroups): First arg is int, not size_t.
1724         Don't let 'free' mangle errno.
1725
1726 2003-10-16  Jim Meyering  <jim@meyering.net>
1727
1728         * xmalloc.c: Include <string.h>, for declarations of memset and memcpy.
1729
1730 2003-10-15  Paul Eggert  <eggert@twinsun.com>
1731
1732         * exclude.c: Do not include <inttypes.h> or <stdint.h>.
1733         (SIZE_MAX): Remove.
1734         (new_exclude, add_exclude_file): Initial size no longer needs to
1735         be a power of 2.
1736         (add_exclude, add_exclude_file): Use xnrealloc instead of rolling
1737         our own address arithmetic overflow checking.
1738
1739         * fnmatch.c (SIZE_MAX): Define if standard headers don't.
1740         (fnmatch): Do not alloca more than 2000 wide characters;
1741         instead, use malloc for large buffers.
1742         Check for address arithmetic overflow, and return -1
1743         with errno set to ENOMEM in that case.
1744         * fnmatch_loop.c (ALLOCA_LIMIT): New macro.
1745         (NEW_PATTERN): Do not alloca more than 8000 bytes;
1746         instead, return -1.  Check for address arithmetic overflow.
1747
1748 2003-10-14  Paul Eggert  <eggert@twinsun.com>
1749
1750         Handle invalid suffixes and overflow independently, so that
1751         callers can treat them independently as needed.  Fix some bugs in
1752         suffix handling, e.g., "100k@" was not diagnosed as an invalid
1753         suffix for a human-readable blocksize.  The major caller-visible
1754         change is the addition of a new
1755         LONGINT_INVALID_SUFFIX_CHAR_WITH_OVERFLOW enum value, indicating
1756         that both overflow and suffix chars were found.
1757
1758         * human.c (humblock): Don't check separately for invalid suffix
1759         char; that is xstrtoumax's job (now that its bug is fixed).
1760         * xstrtoimax.c (STRTOL_T_MINIMUM, STRTOL_T_MAXIMUM) [defined
1761         INTMAX_MAX]: New macros.
1762         * xstrtol.c (STRTOL_T_MINIMUM, STRTOL_T_MAXIMUM, TYPE_MINIMUM,
1763         TYPE_MAXIMUM): New macros.
1764         (bkm_scale, bkm_scale_by_power): Return strtol_error, not int.
1765         (bkm_scale, bkm_scale_by_power, __xstrtol): Return maximal values
1766         if overflow occurs, as it's what __strtol does and it's more useful
1767         in practice.
1768         (__xstrtol): If __strtol reports some error other than ERANGE,
1769         reflect it to the caller as LONGINT_INVALID.  If it reports
1770         ERANGE, continue the rest of parsing, and report LONGINT_OVERFLOW
1771         | LONGINT_INVALID_SUFFIX_CHAR if both errors occur.
1772         * xstrtol.h (LONGINT_INVALID_SUFFIX_CHAR_WITH_OVERFLOW): New enum
1773         value.
1774         (_STRTOL_ERROR): Handle it.  Abort when given unknown error codes.
1775         * xstrtoul.c (STRTOL_T_MINIMUM, STRTOL_T_MAXIMUM): New macros.
1776         * xstrtoumax.c (STRTOL_T_MINIMUM, STRTOL_T_MAXIMUM)
1777         [defined UINTMAX_MAX]: New macros.
1778
1779 2003-10-14  Bruno Haible  <bruno@clisp.org>
1780
1781         * fatal-signal.h: Improved comments. Suggested by Paul Eggert.
1782         * fatal-signal.c: Use sig_atomic_t. Suggested by Paul Eggert.
1783         Also use volatile where needed.
1784
1785 2003-10-12  Paul Eggert  <eggert@twinsun.com>
1786
1787         * xalloc.h (xnmalloc, xzalloc, xnrealloc, xclone): New decls.
1788         (XMALLOC, XCALLOC, XREALLOC, XFREE, CCLONE, CLONE): Deprecate,
1789         and define in terms of the other primitives.
1790         * xmalloc.c: Include stdbool.h; do not include exit.h.
1791         (SIZE_MAX): Define if not already defined.
1792         (array_size_overflow): New function.
1793         (xalloc_die): Abort instead of exiting if 'error' returns.
1794         (xnmalloc, xnrealloc, xzalloc, xclone): New functions.
1795         (xmalloc, xrealloc): Use them.
1796         (xcalloc): Check for address arithmetic overflow.
1797         * xstrdup.c (xstrdup): Use xclone, since memcpy should be
1798         a bit faster than strcpy.
1799
1800 2003-10-08  Paul Eggert  <eggert@twinsun.com>
1801
1802         Merge getpass from libc, plus a few fixes.
1803
1804         * getpass.c (HAVE_STDIO_EXT) [_LIBC]: Define to 1.
1805         Include <stdbool.h>.
1806         Include <stdio_ext.h> if HAVE_STDIO_H, otherwise define
1807         __fsetlocking to empty.
1808         [_LIBC]: Do not include "getline.h" or "unlocked-io.h", but
1809         do include <bits/libc-lock.h>.
1810         Do not include <fcntl.h>; not needed.
1811         [_LIBC]: Include <wchar.h>.
1812         (NOTCANCEL_MODE): New macro.
1813         (flockfile, funlockfile) [_LIBC]: New macros.
1814         (__libc_cleanup_push, __libc_cleanup_pop, __getline, __tcgetattr)
1815         [!_LIBC]: New macros.
1816         (call_fclose): New function.
1817         (getpass): Use it.  Save tty stream separately; this simplifies the
1818         code and makes it more reliable if stdin happens to equal stdout.
1819         Invoke __fsetlocking on tty.
1820         Handle thread cancellation if needed.
1821         Namespace cleanup (use __tcgetattr, __getline).
1822         Use bool for Booleans.
1823         [USE_IN_LIBIO]: Handle wide streams.
1824         [!_LIBC]: Unconditionally do the fseek, since we don't know what
1825         stream might go where.
1826
1827         * unlocked-io.h: Include <stdio.h>, so that the caller
1828         doesn't have to include <stdio.h> before us.
1829         (clearerr_unlocked, feof_unlocked, ferror_unlocked,
1830         fflush_unlocked, fgets_unlocked, fputc_unlocked, fputs_unlocked,
1831         fread_unlocked, fwrite_unlocked, getc_unlocked, getchar_unlocked,
1832         putc_unlocked, putchar_unlocked): Define to the unlocked counterpart
1833         if not declared, so that we can use getpass.c code from libc without
1834         rewriting it.
1835         (flockfile, ftrylockfile, funlockfile): New macros.
1836
1837 2003-10-06  Bruno Haible  <bruno@clisp.org>
1838
1839         * version-etc-2.h: Remove file.
1840         * version-etc-2.c: Remove file.
1841
1842 2003-09-25  Jim Meyering  <jim@meyering.net>
1843             Bruno Haible  <bruno@clisp.org>
1844
1845         This lets translators provide better translations for the
1846         "Written by ..." part of --version output.
1847         * version-etc.h: Include stdarg.h.
1848         (version_etc_copyright): Declare as readonly.
1849         (version_etc): Make this function variadic with a NULL-terminated list
1850         of author name strings.
1851         (version_etc_va): New declaration.
1852         * version-etc.c: Include stdarg.h, stdlib.h.
1853         (version_etc_copyright): Declare as readonly.
1854         (version_etc_va): New function. Provide a different translatable string
1855         for each possible number of authors < 10. Abbreviate when there are 10
1856         authors or more.
1857         (version_etc): Make this function variadic. Call version_etc_va.
1858         Suggestion from Gary V. Vaughan.
1859
1860         * long-options.h (parse_long_options): Change prototype: the authors
1861         string is moved to the end and becomes variadic.
1862         * long-options.c: Include stdarg.h.
1863         (parse_long_options): Make this function variadic, too.
1864         Call version_etc_va, not version_etc.
1865
1866 2003-10-06  Bruno Haible  <bruno@clisp.org>
1867
1868         * fatal-signal.h: New file, from GNU gettext.
1869         * fatal-signal.c: New file, from GNU gettext.
1870
1871 2003-10-04  Karl Berry  <karl@gnu.org>
1872
1873         * argp*: update from libc.
1874
1875 2003-10-01  Larry Jones  <lawrence.jones@eds.com>
1876
1877         * getpass.c (getpass): Use a no-op fseek when switching from input to
1878         output mode on the same stream.
1879
1880 2003-09-29  Paul Eggert  <eggert@twinsun.com>
1881
1882         * strftime.c (tm_diff) [! HAVE_TM_GMTOFF]:
1883         Fix arg typo in previous patch.
1884
1885 2003-09-28  Jim Meyering  <jim@meyering.net>
1886
1887         * error.c: Correct cpp indentation.
1888
1889 2003-09-27  Paul Eggert  <eggert@twinsun.com>
1890
1891         * minmax.h (MIN, MAX) [__STDC__ && defined __GNUC__ && __GNUC__ >= 2]:
1892         Omit the special code that used __typeof__, since we worry that
1893         it could be more trouble than it's worth.  See:
1894         http://mail.gnu.org/archive/html/bug-gnulib/2003-01/msg00090.html
1895         http://mail.gnu.org/archive/html/bug-gnulib/2003-01/msg00095.html
1896
1897         * free.c: New file.
1898
1899 2003-09-26  Jim Meyering  <jim@meyering.net>
1900
1901         * error.c (error_tail): Move some declarations
1902         into inner scope where the local variables are used.
1903
1904 2003-09-26  Bruno Haible  <bruno@clisp.org>
1905
1906         * stpncpy.h (gnu_stpncpy): New declaration.
1907         (stpncpy): Define as alias for gnu_stpncpy.
1908         * stpncpy.c [!_LIBC]: Define gnu_stpncpy, not stpncpy.
1909
1910 2003-09-26  Paul Eggert  <eggert@twinsun.com>
1911
1912         * error.c (SIZE_MAX) [!defined SIZE_MAX]: Define.
1913         (error_tail): Do not loop, reallocating temporary buffer, since
1914         the output cannot contain more wide characters than the input
1915         contains bytes, the size must be big enough already.  This avoids
1916         one potential size overflow calculation.  Check for size overflow
1917         when calculating temporary buffer size.  Free temporary buffer
1918         when done, if it was allocated with malloc; this plugs a memory
1919         leak.  Remove casts from void * to pointers, that are no longer
1920         needed now that we're assuming C89 or better.
1921
1922         Merge error changes from glibc.
1923
1924         * error.c, error.h: Update copyright notice header to match glibc.
1925         * error.c [defined _LIBC]: Include <errno.h>, <bits/libc-lock.h>.
1926         (error, error_at_line) [defined _LIBC && defined __libc_ptf_call]:
1927         Disable cancellation while printing error.
1928         * error.h: Prepend __ to parameter names.
1929
1930 2003-09-25  Karl Berry  <karl@gnu.org>
1931
1932         * argp-fmtstream.c, argp-help.c: update from libc.
1933
1934 2003-09-25  Bruno Haible  <bruno@clisp.org>
1935
1936         * version-etc-2.h: New file, from version-etc.h with modifications.
1937         * version-etc-2.c: New file, from version-etc.c with modifications.
1938
1939 2003-09-25  Simon Josefsson  <jas@extundo.com>
1940
1941         * xgetdomainname.h: New file.
1942         * xgetdomainname.c: New file.
1943
1944 2003-09-25  Simon Josefsson  <jas@extundo.com>
1945             Bruno Haible  <bruno@clisp.org>
1946
1947         * getdomainname.h: New file.
1948         * getdomainname.c: New file.
1949
1950 2003-09-24  Paul Eggert  <eggert@twinsun.com>
1951
1952         * linebuffer.c (freebuffer): Don't free the argument, just
1953         the buffer associated with the argument.  Bug reported by
1954         Simon Josefsson.
1955
1956 2003-09-19  Karl Berry  <karl@gnu.org>
1957
1958         * argp.h: update from libc.
1959
1960 2003-09-16  Paul Eggert  <eggert@twinsun.com>
1961
1962         * linebuffer.c (readlinebuffer): Return NULL immediately upon
1963         input error, instead of returning NULL the next time we are called
1964         (and therefore losing track of errno).
1965
1966 2003-09-15  Paul Eggert  <eggert@twinsun.com>
1967
1968         * getndelim2.c (getndelim2): Don't trash errno when a read
1969         fails, so that the caller gets the proper errno.
1970
1971         * readutmp.c (read_utmp): Likewise.
1972         Check for fstat error.  Close stream and free storage
1973         when failing.
1974
1975 2003-09-14  Bruno Haible  <bruno@clisp.org>
1976
1977         * fwriteerror.h: New file.
1978         * fwriteerror.c: New file.
1979
1980 2003-09-14  Jim Meyering  <jim@meyering.net>
1981
1982         * getloadavg.c: Correct cpp indentation.
1983         * strdup.c: Likewise.
1984         * vasnprintf.c: Likewise.
1985
1986 2003-09-12  Paul Eggert  <eggert@twinsun.com>
1987
1988         * argmatch.c, fatal.c, xgethostname.c, xmalloc.c: Include exit.h.
1989         * obstack.c [!defined _LIBC]: Likewise.
1990         * argmatch.c (EXIT_FAILURE): Remove; now done by exit.h
1991         * exitfail.c, fatal.c, xgethostname.c, xmalloc.c: Likewise.
1992         * exitfail.c: Don't include stdlib.h; no longer needed.
1993
1994         More changes to assume C89 or better.
1995
1996         * error.c (error_tail): Assume vprintf.
1997
1998         * argmatch.c (getenv): Remove decl.
1999         * progreloc.c (get_full_program_name): Define via prototype.
2000         * setenv.c (clearenv): Likewise.
2001         * stpncpy.c: Do not include <string.h> or <sys/types.h>; not
2002         needed.
2003         * strdup.c: Include <stdlib.h>, <string.h> unconditionally.
2004         (malloc, memcpy): Remove decls.
2005         * strftime.c (HAVE_LIMITS_H, STDC_HEADERS) [defined _LIBC]: Remove.
2006         (HAVE_MEMCPY) [defined emacs && !defined HAVE_BCOPY]: Remove.
2007         Include <limits.h>, <stddef.h>, <stdlib.h>, <string.h> unconditionally.
2008         (memcpy): Remove macro.
2009         (MEMCPY) [!defined COMPILE_WIDE]: Define to memcpy unconditionally.
2010         (__P): Remove.  All uses removed.
2011         (PTR): Remove.  All uses changed to void *.
2012         (CHAR_BIT, NULL): Remove.
2013         (spaces, zeros, memset_space, memset_zero)
2014         [!defined memset && !defined HAVE_MEMSET && !defined _LIBC]:
2015         Remove.
2016         (LOCALE_PARAM, LOCALE_PARAM_DECL): Remove.
2017         (memcpy_lowcase, memcpy_uppcase, tm_diff, iso_week_days):
2018         Define with prototype.
2019         Remove now-unnecessary prototype decl.
2020         (extra_args_spec): Assume ANSI C.  All uses changed.
2021         (extra_args_spec_iso): Remove.
2022         (my_strftime, emacs_strftimeu): Define via prototype.
2023         * strtod.c: Include <float.h>, <stdlib.h>, <string.h>
2024         unconditionally.
2025         (DBL_MAX, DBL_MIN, HUGE_VAL, NULL): Remove decls.
2026         * strtoimax.c: Include <stdlib.h> unconditionally.
2027         (strtoul, strtol): Remove decls.
2028         * strtol.c (STDC_HEADERS, HAVE_LIMITS_H, NULL, ULONG_MAX,
2029         LONG_MAX): Remove.
2030         Include <limits.h>, <stddef.h>, <stdlib.h>, <string.h> unconditionally.
2031         (LOCALE_PARAM_DECL): Remove.  All uses changed to LOCALE_PARAM_PROTO.
2032         (LOCALE_PARAM_PROTO): New macro.
2033         (INTERNAL, INTERNAL1, WEAKNAME): Assume ANSI C, not K&R.
2034         (INTERNAL (strtol), strtol): Define with a prototype.
2035         (PARAMS): Remove.  All uses removed.
2036         * tempname.c: Include <string.h> unconditionally.
2037         * userspec.c: Include <stdlib.h>, <string.h> unconditionally.
2038         * xgethostname.c (main): Define with a prototype.
2039         * xmalloc.c: Include "xalloc.h" first, to check interface.
2040         Include <stdlib.h> unconditionally.
2041         (calloc, malloc, realloc, free): Remove decls.
2042         * xstrtod.c: Include "xstrtod.h" first, to check interface.
2043         Include <stdlib.h> unconditionally.  Sort include file names.
2044         (strtod): Remove.
2045         (xstrtod): Define with a prototype.
2046         * xstrtol.c: Include <stdlib.h>, <string.h> unconditionally.
2047         (strtol, strtoul): Remove decls.
2048
2049 2003-09-11  Paul Eggert  <eggert@twinsun.com>
2050
2051         * strndup.c: Don't include <stdio.h>, <sys/types.h>.
2052         Include <stdlib.h>, <string.h> unconditionally.
2053         Remove now-unnecessary cast to char *.
2054         * strnlen.c: Include <string.h> unconditionally.
2055         * yesno.c (yesno): Define with a prototype.
2056
2057 2003-09-10  Bruno Haible  <bruno@clisp.org>
2058
2059         * strcspn.c: Include <string.h> unconditionally.
2060         * strpbrk.c: Include <string.h> unconditionally.
2061         * strstr.c: Include <string.h> unconditionally.
2062         * unicodeio.c: Include <string.h> unconditionally.
2063         * setenv.c: Include <stdlib.h> and <string.h> unconditionally.
2064         * unsetenv.c: Likewise.
2065         * xreadlink.c: Include <stdlib.h> unconditionally.
2066         * yesno.c: Include <stdlib.h> unconditionally.
2067         (rpmatch): Add prototype.
2068
2069 2003-09-10  Jim Meyering  <jim@meyering.net>
2070
2071         * error.c: Correct indentation of cpp directives.
2072
2073 2003-09-09  Paul Eggert  <eggert@twinsun.com>
2074
2075         More K&R removal.
2076
2077         * acosl.c (main): Use a prototype.
2078         * asinl.c, cosl.c, expl.c, frexpl.c, ldexpl.c, sinl.c,
2079         tanl.c: Likewise.
2080
2081         * getloadavg.c (getloadavg, main): Define via prototypes.
2082
2083         * getopt.h (struct option.name): Assume C89, and use 'const'.
2084         (getopt, etopt_long, getopt_long_only, _getopt_internal)
2085         [defined __GNU_LIBRARY__]: Assume C89, so we can always declare
2086         with a prototype.
2087         * getopt.c (const): Remove macro.
2088         Include <string.h> unconditionally.
2089         (my_index): Remove; all uses changed to strchr.
2090         (strlen): Remove decl.
2091         (exchange): Remove forward decl; no longer needed.
2092         (exchange, _getopt_initialize, _getopt_internal, getopt, main):
2093         Define with prototype.
2094         * getopt1.c (const): Remove macro.
2095         (getopt_long, getopt_long_only, main): Define with prototype.
2096
2097         * getugroups.c: Include <string.h> unconditionally.
2098
2099         * getusershell.c: Include <stdlib.h> unconditionally.
2100         (getusershell, setusershell, endusershell, readname, main):
2101         Define with prototypes.
2102
2103         * group-member.c: Include group-member.h first.
2104         Include <stdlib.h> unconditionally.
2105
2106         * hard-locale.c: Include hard-locale.h first.
2107         Include <stdlib.h>, <string.h> unconditionally.
2108
2109         * hash.c (free, malloc): Remove decls.
2110         Include <stdlib.h> unconditionally.
2111
2112         * human.c: Include <stdlib.h>, <string.h> unconditionally.
2113         (getenv): Do not declare.
2114
2115         * idcache.c: Include <string.h> unconditionally.
2116
2117         * long-options.c: Include long-options.h first, to test interface.
2118         Include <stdlib.h> unconditionally.
2119
2120         * makepath.c: Include makepath.h first, to test interface.
2121         Include <stdlib.h> and <string.h> unconditionally.
2122
2123         * linebuffer.c: Include <stdlib.h>.
2124         (free): Remove decl.
2125
2126         * malloc.c: Include <stdlib.h>, for malloc; don't bother with stddef.h.
2127         rpl_malloc returns void *, not char *.
2128         * realloc.c (rpl_realloc): Likewise.  Also, define with a prototype.
2129
2130         * md5.h: Include <limits.h> unconditionally.
2131         (UINT_MAX_32_BITS): Don't worry about non-__STDC__ case.
2132         (__P): Remove; all uses removed.
2133         * md5.c: Include "md5.h" first.
2134         (md5_init_ctx, md5_read_ctx, md5_finish_ctx, md5_stream,
2135         md5_buffer, md5_process_bytes, md5_process_block):
2136         Define with prototypes.
2137         * sha.h (__P): Remove all uses.  (It wasn't defined??)
2138         * sha.c: Include "sha.h" first.
2139         Include <stdlib.h>, <string.h> unconditionally.
2140
2141         * memchr.c (__ptr_t): Remove; all uses changed to void *.
2142         * memcmp.c (__ptr_t): Likewise.
2143         * memrchr.c (__ptr_t): Likewise.
2144         * memchr.c, memcmp.c, memcoll.c, memrchr.c:
2145         Include <string.h> unconditionally.
2146         * memchr.c, memrchr.c: Include <limits.h> unconditionally.
2147         * memchr.c: Include <stdlib.h> unconditionally.
2148         * memchr.c (LONG_MAX): Remove.
2149         * memrchr.c (LONG_MAX): Likewise.
2150         * memchr.c (__memchr): Define via a prototype.
2151         * memrchr.c (__memrchr): Likewise.
2152         * memcmp.c (__P): Remove, and remove all uses.
2153         (memcmp_bytes, memcmp_common_alignment, memcmp_not_common_alignment):
2154         Remove forward decls; no longer needed.
2155         * memcpy.c, memmove.c, memset.c: Include <stddef.h>.
2156         Use types required by C89 in prototype.
2157
2158         * mkdir.c: Include <stdlib.h>, <string.h> unconditionally.
2159         * savedir.c: Likewise.
2160         * mkdir.c (free): Remove decl.
2161         * rmdir.c (rmdir): Define with a prototype.
2162         * savedir.c: Include savedir.h first, to test interface.
2163
2164         * mktime.c (STDC_HEADERS): Remove.
2165         Include <stdlib.h>, <string.h> unconditionally.
2166
2167         * modechange.c: Include <stdlib.h> unconditionally.
2168         (malloc): Remove decl.
2169
2170         * mountlist.c: Include <stdlib.h>, <string.h> unconditionally.
2171         (free): Remove decl.
2172
2173         * obstack.h (PTR_INT_TYPE) [!defined __PTRDIFF_TYPE__]:
2174         Define to ptrdiff_t, without bothering to check HAVE_STDDEF_H.
2175         (This type really should be intptr_t, but that's a C99ism.)
2176         (_obstack_memcpy): Remove: all uses changed to memcpy.
2177         Include <string.h> unconditionally.
2178         (struct obstack): Assume __STDC__ for types of members
2179         chunkfun, freefun, extra_arg.
2180         (_obstack_newchunk, _obstack_free, _obstack_begin, _obstack_begin_1,
2181         _obstack_memory_used, obstack_alloc_failed_handler, obstack_init,
2182         obstack_begin, obstack_specify_allocation,
2183         obstack_specify_allocation_with_arg, obstack_chunkfun,
2184         obstack_freefun, obstack_free) [! (defined __STDC__ && __STDC__)]:
2185         Remove unprototyped decls and the macros that use them.
2186         * obstack.c (POINTER): Remove.  All uses changed to void *.
2187         (obstack_alloc_failed_handler, CALL_CHUNKFUN, CALL_FREEFUN,
2188         _obstack_begin, _obstack_begin_1, _obstack_allocated_p)
2189         (defined __STDC__ && __STDC__)]:
2190         Remove nonprototyped code.
2191         Include <stdlib.h> unconditionally.
2192         (_obstack_begin, _obstack_begin_1, _obstack_newchunk,
2193         _obstack_allocated_p, _obstack_free, obstack_free,
2194         _obstack_memory_used, print_and_abort):
2195         Define using prototypes.
2196         (obstack_1grow, obstack_1grow_fast, obstack_alloc, obstack_base,
2197         obstack_blank, obstack_blank_fast, obstack_copy, obstack_copy0,
2198         obstack_finish, obstack_grow, obstack_grow0, obstack_make_room,
2199         obstack_next_free, obstack_object_size, obstack_room) [0]:
2200         Remove unused, unprototyped code.
2201
2202         * path-concat.c: Include <stdlib.h>, <string.h> unconditionally.
2203
2204         * physmem.c (physmem_total, physmem_available, main): Define
2205         with prototypes.
2206
2207         * posixtm.c: Include <stdlib.h>, <string.h> unconditionally.
2208         (main): Define with a prototype.
2209
2210         * posixver.c (getenv): Remove decl.
2211
2212         * putenv.c (malloc): Returns void *, not char *.
2213         Include <string.h> unconditionally.
2214         (strchr, memcpy, NULL): Do not define.
2215
2216         * readtokens.c: Include readtokens.h first, to test interface.
2217         Include <stdlib.h>, <string.h> unconditionally.
2218         (init_tokenbuffer): Define with a prototype.
2219
2220         * regex.c (PARAMS): Remove.  All uses removed.
2221         All uses of _RE_ARGS removed, too.
2222         Include <stddef.h>, <stdlib.h>, <string.h>, <limits.h>
2223         unconditionally.
2224         (bzero): Assume memset exists.
2225         (memcmp, memcpy, NULL): Remove.
2226         (SIGN_EXTEND_CHAR): Remove; all uses replaced by casts to signed
2227         char, or assignments to local vars of type signed char.
2228         (init_syntax_once, PREFIX(extract_number_and_incr),
2229         PREFIX(print_partial_compiled_pattern),
2230         PREFIX(print_compiled_pattern), PREFIX(print_double_string),
2231         convert_mbs_to_wcs, print_fastmap, re_set_syntax,
2232         PREFIX(regex_grow_registers), PREFIX(regex_compile),
2233         PREFIX(store_op1), PREFIX(store_op2), PREFIX(insert_op1),
2234         PREFIX(insert_op2), PREFIX(at_begline_loc_p),
2235         PREFIX(at_endline_loc_p), group_in_compile_stack, insert_space,
2236         wcs_compile_range, byte_compile_range, truncate_wchar,
2237         PREFIX(re_compile_fastmap), re_compile_fastmap, re_set_registers,
2238         re_search, re_search_2, PREFIX(re_search_2), re_match, re_match_2,
2239         count_mbs_length, wcs_re_match_2_internal,
2240         byte_re_match_2_internal, PREFIX(group_match_null_string_p),
2241         PREFIX(alt_match_null_string_p),
2242         PREFIX(common_op_match_null_string_p), PREFIX(bcmp_translate),
2243         re_compile_pattern, re_comp, re_exec, regcomp, regexec, regerror,
2244         regfree, PREFIX(extract_number)): Define with prototype.  Remove
2245         now-unnecessary declaration, if any.
2246         (byte_compile_range, PREFIX(regex_compile), re_comp, re_exec,
2247         regcomp, regexec):
2248         Remove now-unnecessary casts among pointer types.
2249         * regex.h (_RE_ARGS): Remove.  All uses removed.
2250
2251         * rename.c: Include <stdlib.h>, <string.h> unconditionally.
2252         (free): Remove decl.
2253
2254         * rpmatch.c: Include <stdlib.h> unconditionally.
2255
2256         * same.c: Include <stdlib.h>, <string.h> unconditionally.
2257         (free): Remove decl.
2258
2259         * save-cwd.c: Include <stdlib.h> unconditionally.
2260         * xgetcwd.c: Likewise.
2261
2262         * stat.c: Include <stdlib.h>, <string.h> unconditionally.
2263         (free): Remove decl.
2264
2265         * strchrnul.c (strchrnul): Define with a prototype.
2266         Fix bug: c_in was not converted to char before searching.
2267
2268         The following changes are not K&R related:
2269
2270         * group-member.h: Include <sys/types.h>, so that this file is
2271         self-contained.
2272         * makepath.h: Likewise.
2273
2274         * getusershell.c (readname, default_index, line_size, readname):
2275         Use size_t, not int, for sizes.
2276         (readname): If the size overflows, report an error instead of
2277         looping forever.
2278
2279 2003-09-09  Derek Robert Price  <derek@ximbiot.com>
2280
2281         * getndelim2.c: Assume stdlib.h per the C89 spec.
2282
2283 2003-09-08  Paul Eggert  <eggert@twinsun.com>
2284
2285         Assume C89 or better; remove K&R cruft.
2286         A few of these changes were first proposed by Derek Robert Price
2287         in <http://mail.gnu.org/archive/html/bug-gnulib/2003-07/msg00105.html>.
2288
2289         * addext.c: Include <string.h> unconditionally.
2290         * backupfile.c: Include <string.h>, <stdlib.h> unconditionally.
2291         Don't declare getenv or malloc.
2292
2293         * alloca.c: Include <string.h>, <stdlib.h> unconditionally.
2294         (POINTER_TYPE, pointer): Remove; all uses changed to void *.
2295         (NULL): Remove.
2296         (find_stack_direction, alloca): Use prototypes.
2297
2298         * atexit.c (atexit): Define using a prototype.
2299
2300         * basename.c, dirname.c, stripslash.c:
2301         Include <string.h> unconditionally.
2302
2303         * bcopy.c: Include <stddef.h>.
2304         (bcopy): Define with prototype, using 'const' and 'void' and 'size_t'.
2305
2306         * canon-host.c: Include <stdlib.h>, <string.h> unconditionally.
2307
2308         * error.h (error, error_at_line, error_print_progname)
2309         [! (defined (__STDC__) && __STDC__)]: Remove decls.
2310         * error.c: Include error.h first, to check interface.
2311         Include <stdarg.h>, <stdlib.h>, <string.h> unconditionally.
2312         (VA_START): Remove; all uses changeed to va_start.
2313         (exit, strerror): Remove decls.
2314         (error_print_progname): Prototype uncondionally.
2315         Don't include <errno.h>; no longer needed.
2316         (private_strerror): Remove.
2317         (error_tail): Always define.
2318         (error, error_at_line): Assume C89 or better; always use prototypes.
2319         * fatal.c: Include "fatal.h" first, to test interface.
2320         Include <stdarg.h>, <stdlib.h>, <string.h> unconditionally.
2321         (VA_START): Remove; all uses changed to va_start.
2322         [! (HAVE_VPRINTF || HAVE_DOPRNT || _LIBC)]: Remove support for
2323         this case.
2324         (exit): Remove decl.
2325         (fatal): Prototype unconditionally.  Assume va_start works.
2326         Abort at end, to pacify gcc.
2327
2328         * euidaccess.c (main): Define with a prototype.
2329
2330         * exclude.c: Include <stdlib.h>, <string.h> unconditionally.
2331
2332         * exitfail.c: Include <stdlib.h> unconditionally.
2333
2334         * fnmatch_.h (__P): Remove.  All uses changed to assume
2335         prototypes.
2336         * fnmatch.c: Include fnmatch.h first, to test interface.
2337         Include <string.h>, <stddef.h>, <stdlib.h> unconditionally.
2338         (getenv): Remove decl.
2339         (fnmatch): Define using a prototype.
2340         * fnmatch_loop.c (FCT): Remove forward decl; no longer needed.
2341         (FCT): Define using a prototype.
2342
2343         * getdate.y: Include <stdlib.h>, <string.h> unconditionally.
2344
2345         * gethostname.c: Include <stddef.h>.
2346         (gethostname): Define with prototype.  Length is size_t, not int.
2347
2348 2003-09-08  Paul Eggert  <eggert@twinsun.com>
2349
2350         * getversion.c: Remove; was migrated to backupfile.c in 1997.
2351         getversion.c should have been removed then, but was accidentally
2352         preserved.
2353
2354         * utime.c [!HAVE_UTIMES_NULL]: Include <sys/stat.h>, <fcntl.h>.
2355         (utime_null): Fix typo: 'st' was sometimes called 'sb'.
2356
2357 2003-09-07  Paul Eggert  <eggert@twinsun.com>
2358
2359         * time_r.c (gmtime_r, localtime_r): Fix silly typo: missing arg to
2360         copy_tm_result.  Bug reported by Simon Josefsson in
2361         <http://mail.gnu.org/archive/html/bug-gnulib/2003-09/msg00028.html>.
2362
2363 2003-09-06  Paul Eggert  <eggert@twinsun.com>
2364
2365         * time_r.c, time_r.h: New files.
2366
2367         * mktime.c (my_mktime_localtime_r): Remove; all uses changed to
2368         __localtime_r.
2369         (__localtime_r) [!defined _LIBC]: New macro.  Include <time_r.h>.
2370         (__mktime_internal) [!defined _LIBC]: Now extern, not static.
2371
2372         * strftime.c (my_strftime_gmtime_r): Remove; all uses changed to
2373         __gmtime_r.
2374         (my_strftime_localtime_r): Remove; all uses changed to __localtime_r.
2375         (__gtime_r, __localtime_r) [!HAVE_TM_GMTOFF]: New macros.
2376         Include <time_r.h>.
2377
2378         * timegm.c: Switch to glibc implementation, with the following changes:
2379         [defined HAVE_CONFIG_H]: Include <config.h>.
2380         [!defined _LIBC]: Include "timegm.h" rather than <time.h>.
2381         (__mktime_internal) [!defined _LIBC]: New decl.
2382         (__gmtime_r) [!defined _LIBC]: New macro and function.
2383         (timegm): Use a prototype, since gnulib assumes C89.
2384         Do not bother declaring tmp to be const, as it's not really usefu.
2385         * timegm.h: Hoist "#include <time.h>" out of #ifdef.
2386         (timegm): Declare only if HAVE_DECL_TIMEGM.
2387
2388 2003-09-03  Paul Eggert  <eggert@twinsun.com>
2389
2390         * human.c (human_readable): Fix bug that rounded 10501 to 10k.
2391         Bug reported by Lute Kamstra in
2392         <http://mail.gnu.org/archive/html/bug-gnulib/2003-09/msg00003.html>.
2393
2394         * getdate.y (relative_time_table): Use tDAY_UNIT for "tomorrow",
2395         "yesterday", "today", and "now" rather than tMINUTE_UNIT.  Of
2396         course with correspondingly smaller numbers for tomorrow and
2397         yesterday.  From Tadayoshi Funaba.  Originally installed into
2398         sh-utils on 1999-08-07, but the patch got lost (I guess during the
2399         coreutils merge?).
2400
2401 2003-08-31  Simon Josefsson  <jas@extundo.com>
2402
2403         * timegm.h: New file.
2404         * timegm.c: New file.  Based on wget-1.8.2/src/http.c:mktime_from_utc.
2405
2406 2003-08-31  Karl Berry  <karl@gnu.org>
2407
2408         * argp.h: update from libc.
2409
2410 2003-08-28  Bruno Haible  <bruno@clisp.org>
2411
2412         * binary-io.h: Undefine O_BINARY before defining it. This avoids a
2413         warning on QNX, which defines O_BINARY to 000000.
2414
2415 2003-08-24  Bruno Haible  <bruno@clisp.org>
2416
2417         * binary-io.h: Include <stdio.h>, to avoid a compilation error when
2418         MSVC7 <stdio.h> is included later.
2419
2420 2003-08-20  Bruno Haible  <bruno@clisp.org>
2421
2422         * progname.h: New file, from GNU gettext.
2423         * progname.c: New file, from GNU gettext.
2424         * progreloc.c: New file, from GNU gettext.
2425
2426 2003-08-19  Bruno Haible  <bruno@clisp.org>
2427
2428         * xstrdup.c: Assume <string.h> exists.
2429
2430 2003-08-18  Jim Meyering  <jim@meyering.net>
2431
2432         * setenv.h: Indent nested cpp directive.
2433         * vasnprintf.c: Remove trailing blanks.
2434
2435 2003-08-17  Simon Josefsson  <jas@extundo.com>
2436             Bruno Haible  <bruno@clisp.org>
2437
2438         * xstrndup.h: New file.
2439         * xstrndup.c: New file.
2440
2441 2003-08-17  Bruno Haible  <bruno@clisp.org>
2442
2443         * strndup.h: New file.
2444
2445 2003-08-16  Paul Eggert  <eggert@twinsun.com>
2446
2447         * regex.h, strdup.c, strtoll.c, strtoul.c: Do not normalize white
2448         space, undoing this 2003-08-12 change:
2449         <http://mail.gnu.org/archive/html/bug-gnulib/2003-08/msg00080.html>
2450
2451 2003-08-16  Jim Meyering  <jim@meyering.net>
2452
2453         Merge from coreutils.
2454         * xstrtoimax.c: #else #if -> #elif.
2455         * xstrtoumax.c: Likewise.
2456
2457 2003-08-15  Paul Eggert  <eggert@twinsun.com>
2458
2459         * config.charset, ref-add.sin, ref-del.sin: Use three spaces,
2460         rather than tab, after '#' in shell-script copyright notices.
2461         Suggested by Bruno Haible.
2462
2463 2003-08-15  Jim Meyering  <jim@meyering.net>
2464         and Paul Eggert  <eggert@twinsun.com>
2465
2466         Merge from coreutils.
2467         * readutmp.h (HAVE_UTMPX_H): Undef if struct utmp has the ut_exit
2468         member but strut utmpx does not.  Needed for AIX 4.3.3.
2469         (UT_EXIT_E_TERMINATION, UT_EXIT_E_EXIT): Define.
2470
2471 2003-08-15  Jim Meyering  <jim@meyering.net>
2472
2473         Merge from coreutils.
2474         * xgethostname.c: Include <stdlib.h>.
2475         (xghostname): Don't exit for anything other than memory-related
2476         failure; just return NULL.
2477         * userspec.c: Include "posixver.h".
2478         (parse_user_spec): Accept `.' as a separator only
2479         in pre-POSIX-200112 mode.
2480         * strtoimax.c: Use #elif rather than #else #if.
2481         * strftime.c (my_strftime) [!_LIBC && HAVE_TZNAME && HAVE_TZSET]:
2482         Remove function, now that we can rely on a working tzset function.
2483         [!_LIBC]: Ensure that the required autoconf test has been run.
2484         [!defined _NL_CURRENT && HAVE_STRFTIME]:
2485         Use underlying_strftime for %r.
2486         * sha.c: Merge in some clean-up and optimization changes from glibc.
2487         * sha.c (sha_stream) [BLOCKSIZE]: Move definition to top of file.
2488         Ensure that it is a multiple of 64.
2489         Rearrange loop exit tests so as to avoid performing an
2490         additional fread after encountering an error or EOF.
2491         * realloc.c: Update copyright date.
2492
2493 2003-08-14  Jim Meyering  <jim@meyering.net>
2494
2495         Merge from coreutils.
2496         * obstack.h: Whitespace changes.
2497         * mountlist.c: Remove anachronistic casts of xmalloc, xrealloc,
2498         and xcalloc return values.
2499         (read_filesystem_list) [MOUNTED_GETFSSTAT]:
2500         Use MNT_NOWAIT, rather than MNT_WAIT.  Otherwise, `df DIR' could
2501         hang on OSF/1 5.1 for DIR on both local and remote file systems.
2502         Reported by (and fix confirmed by) Nelson H. F. Beebe.
2503         (read_filesystem_list) [MOUNTED_VMOUNT]: Detect any
2504         error from mntctl.
2505         Use mntctl's return value to drive the entry-processing loop, since
2506         we can't rely on the value of the vmt_length member in the last
2507         entry.  On some systems doing so could result in exhausting
2508         virtual memory.  Based in part on a patch from Mike Jetzer.
2509
2510 2003-08-14  Jim Meyering  <jim@meyering.net>
2511         and Paul Eggert  <eggert@twinsun.com>
2512
2513         Merges from coreutils, plus other fixes.
2514         * physmem.c: Merge in portability changes from gcc/libiberty
2515         to support AIX, IRIX, Tru64, and Windows.  See the ChangeLog there
2516         for credits and details.  Thanks to Kaveh Ghazi for helping
2517         to keep these files in sync.
2518         (ARRAY_SIZE): Define it.
2519         (physmem_total, physmem_available): Add comments. From Kaveh Ghazi.
2520         * memcasecmp.c: Remove unnecessary parentheses after 'defined'.
2521         (memcasecmp): Don't assume size_t fits in unsigned int.
2522         Remove casts and duplicate code.
2523         * md5.c: Include <string.h> and <stdlib.h> unconditionally.
2524         (memcpy): Remove definition.
2525         Merge in some clean-up and optimization changes from glibc.
2526         [BLOCKSIZE]: Move definition to top of file.
2527         Ensure that it is a multiple of 64.
2528         Rearrange loop exit tests so as to avoid performing an
2529         additional fread after encountering an error or EOF.
2530         * md5.h (md5_uintptr): Define.
2531         * makepath.c (CLEANUP_CWD): Report an error if we failed to
2532         return to the initial working directory.  Preserve errno
2533         for caller.
2534         * idcache.c: Include "xalloc.h".
2535         (xmalloc, xrealloc): Remove decls.
2536         (getuser): Remove casts no longer required in C89.
2537         * human.c: Include stdio.h, for sprintf.
2538         * group-member.c: Include "xalloc.h".
2539         (xmalloc, xrealloc): Remove decls.
2540         (get_group_info): Remove casts no longer required in C89.
2541         * getusershell.c (readname): Remove casts no longer required in C89.
2542         * gettimeofday.c (rpl_gmtime, rpl_tzset): New functions.
2543         * getline.c: Whitespace fix, from coreutils.
2544
2545 2003-08-13  Paul Eggert  <eggert@twinsun.com>
2546
2547         * exclude.c: Include <ctype.h>
2548         (IN_CTYPE_DOMAIN): New macro.
2549         (is_space): New fn.
2550         (add_exclude_file): If LINE_END is a space, ignore trailing spaces
2551         and empty lines.
2552
2553         * argp-help.c, argp-parse.c, config.charset, getopt.h:
2554         Undo previous (whitespace-only) change.
2555
2556 2003-08-12  Paul Eggert  <eggert@twinsun.com>
2557
2558         * argp-help.c, argp-parse.c, config.charset, getopt.h:
2559         Normalize leading white space and remove trailing white space.
2560         * ref-add.sin, ref-del.sin: Use '#' before empty line in copyright
2561         notice, as per ../config/srclist-update.
2562
2563         Merge from coreutils.
2564         * euidaccess.h: New file.
2565         * euidaccess.c: Include it.
2566         * .cppi-disable: Add printf-args.h, printf-parse.h, stdbool_.h,
2567         vasnprintf.h, vasprintf.h.  Remove strdup.c, gettext.h.
2568         * regex.h, strdup.c, strtoll.c, strtoul.c: Normalize white space.
2569
2570 2003-08-11  Bruno Haible  <bruno@clisp.org>
2571
2572         * vasnprintf.c (local_wcslen): New function, for Solaris 2.5.1.
2573         (vasnprintf): Use it instead of wcslen.
2574
2575 2003-08-11  Bruno Haible  <bruno@clisp.org>
2576
2577         * stdbool_.h (_Bool): Undo last change; instead use a negative enum
2578         value to ensure that _Bool promotes to int. Use #define for _Bool when
2579         using the Solaris C compiler. Adds comments suggested by Paul Eggert.
2580
2581 2003-08-10  Karl Berry  <karl@gnu.org>
2582
2583         * regex.h: update from libc (whitespace fix).
2584
2585 2003-08-09  Paul Eggert  <eggert@twinsun.com>
2586
2587         Merge some files from coreutils.  These changes were
2588         originally made by Jim Meyering.
2589         * acl.c: Include <sys/types.h> before <sys/stat.h>;
2590         many older Unixes require this.
2591         * alloca.c (alloca): Remove cast to argument of free;
2592         no longer needed in C89.
2593         * alloca_.h, regex.h: Fix white space to match
2594         what GNU indent does.
2595
2596 2003-08-05  Paul Eggert  <eggert@twinsun.com>
2597
2598         * bumpalloc.h: Remove.
2599
2600 2003-08-04  Paul Eggert  <eggert@twinsun.com>
2601
2602         * getloadavg.c: Change copyright notice and spacing to conform to
2603         GNU coding style.
2604
2605         Merge from coreutils.
2606         * error.c [!USE_IN_LIBIO]: Omit this case; assume USE_IN_LIBIO is 1.
2607         From glibc.
2608         * getdate.y (date): Also accept dates like May-23-2003; suggestion
2609         from Karl Berry, implemented by Jim Meyering.
2610         * getgroups.c: Include "xalloc.h" instead of declaring xalloc fns;
2611         from Dmitry V. Levin.
2612         Remove anachronistic cast of xrealloc.
2613         * fnmatch_.h (__const): Remove.  Use 'const'.
2614         * fnmatch_loop.c (NEW_PATTERN): Cast alloca return value to proper
2615         type. Otherwise, it wouldn't compile with at least /bin/cc on
2616         ymp-cray-unicos9.0.2.X.
2617         Combine two mostly-identical uses of alloca into one.
2618         Thanks to the Cray-Cyber project for access to a Cray Y-MP.
2619
2620 2003-08-04  Dave Love <d.love@dl.ac.uk>
2621
2622         [From Emacs.]
2623
2624         * getloadavg.c: Check `__unix' as well as `unix'.  Use #ifdef, not
2625         #if.  Check HAVE_LIBKSTAT as well as LOAD_AVE_TYPE.  Check
2626         F_SETFD, not FD_SETFD.  Use HAVE_STRUCT_NLIST_N_UN_N_NAME, not
2627         obsolete NLIST_NAME_UNION.
2628         [__GNU__]: Undef BSD and FSCALE.
2629         [!NLIST_STRUCT]: Remove conditional definition of NLIST_STRUCT.
2630
2631 2003-08-03  Paul Eggert  <eggert@twinsun.com>
2632
2633         * stdbool_.h (_Bool): Make it signed char, instead of
2634         an enum type, so that it's guaranteed to promote to int.  See:
2635         <http://mail.gnu.org/archive/html/bug-gnulib/2003-07/msg00124.html>
2636
2637 2003-07-31  Paul Eggert  <eggert@twinsun.com>
2638
2639         * strerror.c: Include config.h, limits.h.  Declare sprintf.
2640         (strerror): Don't assume that a printable int fits in 14 bytes.
2641
2642 2003-07-24  Derek Robert Price  <derek@ximbiot.com>
2643             Bruno Haible  <bruno@clisp.org>
2644
2645         * getline.h (getline, getdelim): Change return type to ssize_t.
2646         * getline.c (getline, getdelim): Likewise.
2647         Remove _GNU_SOURCE define; now it's defined in config.h through
2648         m4/getline.m4.
2649
2650 2003-07-22  Paul Eggert  <eggert@twinsun.com>
2651
2652         * xalloc.h (XCALLOC, XREALLOC, CCLONE): Fix under- and
2653         over-parenthesization in macros.
2654
2655         Sync with coreutils.
2656
2657         * xalloc.h (XMALLOC, XCALLOC, XREALLOC): Remove casts not
2658         required by C99.
2659
2660         Use `exit_failure' for xalloc and xmemcoll instead of their own
2661         private exit-failure variables.
2662         * xalloc.h (xalloc_exit_failure): Remove.
2663         * xmalloc.c: Likewise.  Include exitfail.h.
2664         (xalloc_die): Use exit_failure instead of xalloc_exit_failure.
2665         * xmemcoll.h (xmemcoll_exit_failure): Remove.
2666         * xmemcoll.c: Likewise.  Include exitfail.h.
2667         (xmemcoll): Use exit_failure instead of xalloc_exit_failure.
2668
2669 2003-07-18  Paul Eggert  <eggert@twinsun.com>
2670
2671         * closeout.h (close_stdout_set_status, close_stdout_status): Remove.
2672         * closeout.c: Likewise.  Include "closeout.h" right after config.h,
2673         to test that it can stand by itself.  Include "exitfail.h".
2674         Clients should set exit_failure instead.
2675         (EXIT_FAILURE): Remove; no longer needed.  Do not include <stdlib.h>.
2676
2677 2003-07-18  Andreas Schwab  <schwab@suse.de>
2678
2679         * memcoll.c (memcoll) [!HAVE_STRCOLL]: Clear errno.
2680
2681 2003-07-18  Bruno Haible  <bruno@clisp.org>
2682
2683         * getndelim2.h: New file.
2684         * getndelim2.c: Make into a module of its own. Include config.h,
2685         getndelim2.h.
2686         (getndelim2): Make non-static. Change return type to ssize_t.
2687         * getline.h: Change argument names.
2688         * getline.c: Include getndelim2.h instead of getndelim2.c.
2689         * getnline.c: Include getndelim2.h.
2690
2691 2003-07-17  Bruno Haible  <bruno@clisp.org>
2692
2693         * Makefile.am: Remove file.
2694         * Makefile.in: Remove file.
2695
2696 2003-07-17  Bruno Haible  <bruno@clisp.org>
2697
2698         * getnline.h: New file.
2699         * getnline.c: New file.
2700         * getndelim2.c: New file, extracted from getline.c.
2701         (getndelim2): Renamed from getdelim2, with added nmax argument.
2702         * getline.c: Include getndelim2.c.
2703         (getdelim2): Moved out to getndelim2.c.
2704         (getline, getdelim): Update.
2705
2706 2003-07-15    <karl@gnu.org>
2707
2708         * vasnprintf.c: update from gettext.
2709
2710 2003-07-15  Jim Meyering  <jim@meyering.net>
2711
2712         * makepath.c (make_path): Enclose diagnostic in _(...).
2713
2714 2003-07-14  Paul Eggert  <eggert@twinsun.com>
2715
2716         * asnprintf.c, asprintf.c, config.charset, gettext.h,
2717         localcharset.c, localcharset.h, mkdtemp.c, printf-args.c,
2718         printf-args.h, printf-parse.c, printf-parse.h, ref-add.sin,
2719         ref-del.sin, setenv.c, unsetenv.c, vasnprintf.c, vasnprintf.h,
2720         vasprintf.c, vasprintf.h: Regenerate.  These files are now being
2721         updated automatically by ../config/srclist-update.  This changes
2722         their license from LPGL to GPL.
2723
2724 2003-07-14  Jim Meyering  <jim@meyering.net>
2725
2726         Don't emit diagnostics.  Let callers do that.
2727         * save-cwd.c: Don't include "error.h".
2728         (save_cwd): Don't call error.  Ensure that errno is valid
2729         when returning nonzero.
2730
2731         * save-cwd.h (restore_cwd): Update prototype.
2732         * save-cwd.c (restore_cwd): Remove two parameters.
2733         Simplify.  Don't call error upon failure.  Let callers do that.
2734         (save_cwd): Mention that Irix 5.3 has the same problem as SunOS 4
2735         when auditing is enabled.  But don't bother updating the #if.
2736
2737 2003-07-14  Simon Josefsson  <jas@extundo.com>
2738
2739         * mempcpy.h: New file.
2740         * mempcpy.c: New file.
2741
2742 2003-07-14  Paul Eggert  <eggert@twinsun.com>
2743
2744         * ceill.c, expl.c, floorl.c, frexpl.c, ldexpl.c, mathl.h,
2745         sincosl.c, sqrtl.c, trigl.c, trigl.h, poll.c, poll_.h, mkstemp.c,
2746         unicodeio.c, unicodeio.h, unlocked-io.h:
2747         Switch from LGPL to GPL.
2748
2749 2003-07-11  Alexandre Duret-Lutz  <adl@gnu.org>
2750
2751         * obstack.h (__INT_TO_PTR): Revert change of 2003-03-13;
2752         it breaks C++ compilation.
2753         [!__GNUC__ || !__STDC__] (obstack_finish): Cast result to void*.
2754
2755 2003-07-10  Jim Meyering  <jim@meyering.net>
2756
2757         * vasnprintf.c: Remove trailing blanks.
2758         Make cpp indentation consistent.
2759
2760 2003-07-09  Paul Eggert  <eggert@twinsun.com>
2761
2762         * alloca_.h, euidaccess.c, getpass.c, memrchr.c, obstack.h,
2763         posixver.c, strftime.c, strnlen.c, strverscmp.c:
2764         Switch from LGPL to GPL.
2765
2766 2003-07-07  Paul Eggert  <eggert@twinsun.com>
2767
2768         * mktime.c: Fix some boundary cases and remove need for floating point.
2769
2770         Issue a compile-time diagnostic if time_t is floating point, or if
2771         two's complement arithmetic is not in effect, or if arithmetic
2772         right shift does not propagate the sign.  These assumptions were
2773         all in the original code but they weren't checked.
2774
2775         (TIME_T_MIDPOINT, verify): New macros.
2776         (__isleap): Remove; it has integer overflow problems.
2777         (leapyear): New function, without those problems.
2778         (ydhms_tm_diff): Remove; splitting into two parts.
2779         (ydhms_diff): New function, containing the arithmetic part of
2780         the old ydhms_tm_diff function.  Issue a compile-time
2781         diagnostic if we are not using C99 integer division.
2782         Avoid casts when possible.
2783         (guess_time_tm): New function, containing the checking part of
2784         the old ydhms_tm_diff function.  Return the new value, rather than
2785         the difference between it and the old.  Accept a new argument T
2786         so that *T specifies the old value.  Check for overflow in the result.
2787
2788         (__mktime_internal): Use a time_t offset, not a long int offset.
2789         This undoes the 2003-06-04 change, which is no longer needed now
2790         that we have better overflow checking.
2791         (localtime_offset): Likewise.
2792
2793         (__mktime_internal): Avoid harmful overflow on hosts where time_t
2794         and long are 64-bit but int is only 32-bit.
2795         (ydhms_diff): Use long int to store year1 and yday1.
2796         Issue a compile-time diagnostic if long int is not wide enough.
2797
2798         (__mktime_internal): Use long int to store adjusted year and yday.
2799         Use plain C rather than preprocessor commands, if that doesn't
2800         affect efficiency.
2801         Check for overflow (and try to repair) after each probe
2802         rather than checking only at the very end.  This avoids some bugs
2803         (e.g., southern hemisphere, behind GMT, and GMT offset at minimum time
2804         does not equal GMT offset at maximum time).
2805         Use integer to check for overflow rather than floating point; this
2806         is more portable to non-IEEE hosts, and is a tad faster.
2807         When we detect that we are oscillating between two values,
2808         don't check whether tm_isdst has the requested value, since
2809         we already know the answer.  When tm_isdst has the wrong value,
2810         use a different heuristic to find the right one, based on the
2811         extreme values actually observed in practice in tz2003a,
2812         rather than the (overly optimistic) "previous 3 calendar quarters".
2813
2814         (not_equal_tm, print_tm, check_result): Use "const T" rather than
2815         "T const" to accommodate glibc style.
2816         (check_result): Use less-confusing report format.  "long" -> "long int.
2817         (main): Likewise.
2818         Don't loop if the iteration overflows time_t.
2819         Allow a negative step in the iteration.
2820
2821 2003-07-01  Paul Eggert  <eggert@twinsun.com>
2822
2823         * xreadlink.c: Include <sys/types.h> unconditionally, instead of
2824         having it depend on HAVE_SYS_TYPES_H.
2825
2826 2003-06-25  Bruno Haible  <bruno@clisp.org>
2827
2828         * readlink.c: New file.
2829
2830 2003-06-20  Bruno Haible  <bruno@clisp.org>
2831
2832         Assume C89, so PARAMS isn't needed.
2833         * unicodeio.h (PARAMS): Remove.
2834         * unicodeio.c: Don't use PARAMS.
2835
2836 2003-06-18  Jim Meyering  <jim@meyering.net>
2837
2838         Merge changes from coreutils.
2839         * readutmp.c: Include <string.h> and <stdlib.h> unconditionally.
2840         Remove explicit declarations of xmalloc and realloc.
2841         Include xalloc.h.
2842         (read_utmp): Remove anachronistic cast of xmalloc.
2843
2844 2003-06-17  Paul Eggert  <eggert@twinsun.com>
2845
2846         Assume C89, so PARAMS isn't needed.
2847         * backupfile.h (PARAMS): Remove.  All uses removed.
2848         * closeout.h, dirname.h, filemode.h, fsusage.h, getdate.h, getline.h,
2849         group-member.h, hard-locale.h, hash.h, linebuffer.h, long-options.h,
2850         makepath.h, memcasecmp.h, memcoll.h, modechange.h, mountlist.h,
2851         path-concat.h, physmem.h, posixtm.h, quote.h, readutmp.h, same.h,
2852         save-cwd.h, savedir.h, stdio-safer.h, strtoimax.c, strverscmp.h,
2853         unistd-safer.h, version-etc.h, xalloc.h, xreadlink.h, xstrtod.h,
2854         xstrtol.h: Likewise.
2855         * filemode.h, hard-locale.h, memcoll.h, modechange.h, physmem.h,
2856         same.h, strverscmp.h: Do not include config.h; no longer needed.
2857         Anyway, config.h should always be included before any other file.
2858
2859 2003-06-11  Simon Josefsson  <jas@extundo.com>
2860
2861         * sysexit_.h: New file.
2862
2863 2003-05-20  Derek Price  <derek@ximbiot.com>
2864
2865         * stat.c [LSTAT]: Compile/use slash_aware_lstat only if it is necessary.
2866
2867 2003-06-10  Simon Josefsson  <jas@extundo.com>
2868
2869         * strchrnul.h: New file.
2870         * strchrnul.c: New file.
2871
2872 2003-06-10  Simon Josefsson <jas@extundo.com>
2873
2874         * argp.h: New file, from glibc.
2875         * argp-ba.c: New file, from glibc.
2876         * argp-eexst.c: New file, from glibc.
2877         * argp-fmtstream.c: New file, from glibc.
2878         * argp-fmtstream.h: New file, from glibc.
2879         * argp-fs-xinl.c: New file, from glibc.
2880         * argp-help.c: New file, from glibc.
2881         * argp-namefrob.h: New file, from glibc.
2882         * argp-parse.c: New file, from glibc.
2883         * argp-pv.c: New file, from glibc.
2884         * argp-pvh.c: New file, from glibc.
2885         * argp-xinl.c: New file, from glibc.
2886
2887 2003-06-07  Jim Meyering  <jim@meyering.net>
2888
2889         * readtokens.h: Put `Free Software Foundation, Inc.'
2890         in place of my name in the copyright comment.
2891         Remove definition and uses of __P.
2892
2893         From coreutils.
2894         * stat.c: Don't declare xmalloc explicitly.
2895         Instead, include "xalloc.h".
2896         * readtokens.c (readtokens): Remove anachronistic casts of xmalloc,
2897         xrealloc, and xcalloc return values.
2898         * xgetcwd.c (xgetcwd): Include "xgetcwd.h".
2899         Improve comment.
2900         * xgetcwd.h: Remove definition/uses of PARAMS.
2901
2902 2003-06-06  Jim Meyering  <jim@meyering.net>
2903
2904         * stdbool_.h: Renamed from stdbool.h.in.
2905
2906 2003-06-06  Jim Meyering  <jim@meyering.net>
2907
2908         Merge from coreutils.
2909         * same.c: (same_name): Declare *_basename locals to be `const'.
2910         Consolidate declarations and initializations of *_base* locals.
2911
2912         Merge from coreutils.
2913         This avoids a core dump on systems without GNU putenv,
2914         when running `env -u SOME_ALREADY_UNSET_VARIABLE'.
2915         * putenv.c (__set_errno, LOCK, UNLOCK): Define.
2916         (unsetenv): New static function, from GNU libc.
2917         (rpl_putenv): Use it.
2918
2919         * modechange.c: Remove trailing blanks.
2920
2921         Merge from coreutils.
2922         * fsusage.c: Remove declaration of statfs.
2923         It conflicted with one from OSF/1 5.1 in <sys/mount.h>.
2924
2925         * posixtm.c: Include <stdbool.h> unconditionally.
2926
2927 2003-06-05  Paul Eggert  <eggert@twinsun.com>
2928
2929         * mktime.c (__mktime_internal): When resolving a tm_isdst
2930         mismatch, look in future quarters as well as past.  This fixes a
2931         bug when processing fall-backwards gaps immediately after a long
2932         period of daylight-saving time.
2933
2934         * mktime.c: Assume freestanding C89 or better.
2935         (HAVE_LIMITS_H): Remove.  Assume it's 1.
2936         (__P): Remove; not used.
2937         (CHAR_BIT, INT_MIN, INT_MAX): Remove; <limits.h> defines them.
2938         (mktime, not_equal_tm, print_tm, check_result,
2939         main): Use prototypes.  Use const * where appropriate.
2940         (main): Fix typo in testing code that uncovered by above changes.
2941         (Local Variables): Remove -DHAVE_LIMITS_H from compile-command.
2942
2943 2003-06-04  Paul Eggert  <eggert@twinsun.com>
2944
2945         * mktime.c: Fix Debian bug 177940
2946         <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=177940>.
2947         (localtime_offset): Now long int, not time_t, because we want it
2948         to be guaranteed to be signed.  All uses changed.
2949         (__mktime_internal): If overflow would occur when adding offset,
2950         don't add it.
2951
2952         Merge 'human' changes from coreutils.  Rewrite to support
2953         locale-specific notations like thousands separators.
2954         * human.c: Simplify authorship notice.
2955         Include human.h immediately after config.h.
2956         <sys/types.h>, <stdio.h>: Do not include; no longer needed.
2957         <limits.h>: Do not include, since human.h does.
2958         (SIZE_MAX, UINTMAX_MAX): New macros.
2959         <strings.h>: Include if HAVE_STRINGS_H, not if !HAVE_STRING_H.
2960         <locale.h>: Include if HAVE_LOCALE_H and HAVE_LOCALECONV.
2961         (HUMAN_READABLE_SUFFIX_LENGTH_MAX): New macro.
2962         (power_letter): Renamed from suffixes.
2963         (generate_suffix_backwards): Remove.
2964         (adjust_value): Now takes int style (because of human.h changes)
2965         and long double value (for greater precision on some platforms).
2966         (group_number): New function.
2967         (human_readable): Use it.  Use integer options, not enum.
2968         Put the options before the sizes in the arg list.
2969         Support all the new options.
2970         The old human_readable function has been removed;
2971         use inttostr.h instead.
2972         (human_readable, default_block_size, humblock):
2973         Use uintmax_t, not int, for block sizes.
2974         (human_readable_inexact, block_size_types): Remove.
2975         (block_size_opts): New constant.
2976         (human_options): Renamed from human_block_size, with new signature
2977         that allows block sizes up to UINTMAX_MAX.  All callers changed.
2978         * human.h: Add copyright and authorship notice.
2979         Include <limits.h> and <stdbool.h> unconditionally.
2980         (PARAMS): Remove.  All uses removed.
2981         (LONGEST_HUMAN_READABLE): Add support for thousands separator.
2982         (enum human_inexact_style): Remove tag; now a nameless enum.
2983         (human_floor, human_ceiling, human_round_to_even): Now have
2984         values 2, 0, 1 rather than -1, 1, 0.
2985         (human_group_digits, human_suppress_point_zero, human_autoscale,
2986         human_base_1024, human_SI, human_B): New constants.
2987         (human_readable_inexact, human_block_size): Remove.
2988         (human_readable): Size args are now uintmax_t, not int.
2989         (human_options): New decl.
2990
2991         * exclude.c: (new_exclude, add_exclude): Remove casts that are
2992         unnecessary now that we assume C89 or better.  This change
2993         imported from coreutils.
2994
2995         * mktime.c (__mktime_internal): Do not reject negative timestamps
2996         arbitrarily.  This is the same patch as 2003-05-28, but it got lost
2997         in the 2003-05-30 sync from glibc.
2998
2999         .h files should stand alone, but we shouldn't include <sys/types.h>
3000         if we can get away with just <stddef.h>.
3001
3002         * __fpending.h, addext.c, backupfile.c, exclude.c, getline.c,
3003         malloc.c, putenv.c, realloc.c, strcasecmp.c: Include <stddef.h>
3004         rather than <sys/types.h>, as we merely need size_t.
3005         * dirname.h, memcoll.h, xalloc.h, xmemcoll.h: Include <stddef.h>,
3006         to get size_t.
3007         * hash.h, linebuffer.h, readtokens.h, stdio-safer.h, version-etc.h:
3008         Include <stdio.h>, to get FILE.
3009         * memcasecmp.c: Don't include <sys/types.h>, as we can assume
3010         memcasecmp.h has included <stddef.h> and all we need is size_t.
3011         * memcoll.c: Include "memcoll.h", which gets us size_t and checks
3012         our interface, instead of including <sys/types.h>
3013
3014 2003-06-02  Paul Eggert  <eggert@twinsun.com>
3015
3016         [from coreutils]
3017         Fix some minor time-related bugs with POSIX time arguments.
3018         Some valid time stamps were being rejected (notably -1, and
3019         time stamps before 1900 on 64-bit hosts).  And some invalid
3020         time stamps were being accepted, e.g. September 31.
3021
3022         * posixtm.h (posixtime): Return bool instead of time_t, so
3023         that we can return (time_t) -1 successfully.
3024         * posixtm.c: Likewise.
3025         [HAVE_STDBOOL_H]: Include <stdbool.h>.
3026         (bool, false, true) [!HAVE_STDBOOL_H]: New type.
3027         (t): Remove static var.
3028         (year, posix_time_parse): Now takes struct tm * arg to modify, instead
3029         of static var.  All uses changed.
3030         (year): Do not reject years before 1900; they can occur with
3031         64-bit time_t.
3032         (posix_time_parse): Do not check for out-of-range components;
3033         that is now the caller's responsibility, since our checks were
3034         only approximations.
3035         (posixtime): Use mktime to check for out-of-range components,
3036         since it knows them exactly.
3037         If mktime returns (time_t) -1, check whether an error actually occurred
3038         by invoking localtime on -1.
3039         (main) [TEST_POSIXTIME]: Check for input data errors, and report
3040         posixtime failures better.
3041         Improve the test data (in comments only).
3042
3043 2003-05-30    <karl@gnu.org>
3044
3045         * mktime.c: update from libc.
3046
3047 2003-05-30  Bruno Haible  <bruno@clisp.org>
3048
3049         * config.charset: Upgrade to gettext-0.12.1 and libiconv-1.9.1.
3050         * localcharset.h: Likewise.
3051         * localcharset.c: Likewise.
3052
3053 2003-05-28  Paul Eggert  <eggert@twinsun.com>
3054
3055         Assume the headers required for C89 freestanding compilers.
3056         * addext.c, backupfile.c, fsusage.c, human.c, pathmax.h,
3057         rpmatch.c, userspec.c, xreadlink.c, xstrtol.c: Include <limits.h>
3058         without checking for HAVE_LIMITS_H.
3059         * backupfile.c, fsusage.c, hash.c, human.c, safe-read.c, userspec.c,
3060         xstrtol.c (CHAR_BIT) : Don't define, since <limits.h> is guaranteed
3061         to do that.
3062         * fatal.c: Include <stdarg.h> without checking for __STDC__.
3063         * exclude.c: Include <stdbool.h> unconditionally.
3064         * tempname.c: Include <stddef.h> unconditionally.
3065         * hash.c: Include <limits.h>, since we no longer define CHAR_BIT.
3066         * modechange.c, rpmatch.c (NULL): Don't define, since
3067         <stddef.h> does that.
3068         * quote.c: Dont include <stddef.h> or <sys/types.h>; not needed.
3069         * safe-read.c (INT_MAX): Don't define, since <limits.h> does that.
3070         * safe-read.c (TYPE_MINIMUM, TYPE_MAXIMUM): Remove; no longer needed.
3071         * xstrtol.c: Likewise.
3072         * safe-read.c: Remove TYPE_SIGNED; no longer needed.
3073         * savedir.c: Include <stddef.h> instead of defining NULL.
3074
3075         * addext.c (addext): Use assignment rather than cast, to avoid
3076         warnings on some platforms.
3077
3078         * mktime.c (__mktime_internal): Do not reject negative timestamps
3079         arbitrarily.
3080
3081 2003-05-10  Bruno Haible  <bruno@clisp.org>
3082
3083         * linebreak.c (iconv_string_length): Don't return -1 just because the
3084         string is longer than 4 KB.
3085
3086 2003-05-12  Jim Meyering  <jim@meyering.net>
3087
3088         * strftime.c (my_strftime): Let the `-' (no-pad) flag affect
3089         the space-padded-by-default conversion specifiers, %e, %k, %l.
3090
3091 2003-05-03  Bruno Haible  <bruno@clisp.org>
3092
3093         Upgrade to Unicode-4.0.
3094         * linebreak.c (nonspacing_table_data): Change width of U+00AD,
3095         U+0350..U+0357, U+035D..U+035F, U+0600..U+0603, U+0610..U+0615,
3096         U+0656..U+0658, U+0A01, U+0AE2..U+0AE3, U+0CBC, U+17B4..U+17B5,
3097         U+17DD, U+1920..U+1922, U+1927..U+192B, U+1932, U+1939..U+193B
3098         from 1 to 0. Change width of U+0CBF, U+0CC6, U+180E from 0 to 1.
3099         (uc_width): Change width of U+4DC0..U+4DFF from 2 to 1. Change width
3100         of U+2A6D7..U+2F7FF, U+2FA1E..U+2FFFD, U+30000..U+3FFFD from 1 to 2.
3101         Change width of U+E0100..U+E01EF from 1 to 0.
3102
3103 2003-04-25  Bruno Haible  <bruno@clisp.org>
3104
3105         * copy-file.c: Include <stddef.h>, for size_t.
3106
3107 2003-04-25  Jim Meyering  <jim@meyering.net>
3108
3109         * copy-file.c (copy_file_preserving): Declare buf_size to be
3110         of type size_t, not int.
3111
3112 2003-04-11  Jim Meyering  <jim@meyering.net>
3113
3114         Merge changes from Coreutils.
3115
3116         2003-03-22  Jim Meyering  <jim@meyering.net>
3117
3118         * strftime.c (widen): Cast alloca return value to proper type.
3119
3120         2003-01-19  Ulrich Drepper  <drepper@redhat.com>
3121
3122         From GNU libc.
3123         * strftime.c (my_strftime): Handle very large width
3124         specifications for numeric values correctly.  Improve checks for
3125         overflow.
3126
3127         2003-01-19  Jim Meyering  <jim@meyering.net>
3128
3129         * strftime.c (widen) [COMPILE_WIDE]: Merge nearly-identical definitions.
3130         (nl_get_alt_digit) [! defined my_strftime]: Define.
3131         (my_strftime) [_NL_CURRENT]: Merge nearly-identical uses of
3132         _nl_get_alt_digit and _nl_get_walt_digit.
3133
3134         * strftime.c (my_strftime): Merge in locale-related changes from libc.
3135         These changes have no effect outside of _LIBC.
3136
3137 2003-04-10  Bruno Haible  <bruno@clisp.org>
3138
3139         * findprog.h: New file, from GNU gettext.
3140         * findprog.c: New file, from GNU gettext.
3141
3142 2003-04-05  Jim Meyering  <jim@meyering.net>
3143
3144         Merge changes from Coreutils.
3145
3146         * exclude.h (PARAMS): Remove definition and uses.
3147         * exclude.c: Remove uses of `PARAMS'.
3148
3149         * dirname.c [TEST_DIRNAME]: Update build instructions for test.
3150         Add test-cases for DOS filenames. Declare program_name.
3151         (main): Set up program_name.  Patch by Rich Dawe.
3152
3153         * mountlist.c (read_filesystem_list) [MOUNTED_VMOUNT]: Detect any
3154         error from mntctl.
3155         Use mntctl's return value to drive the entry-processing loop, since
3156         we can't rely on the value of the vmt_length member in the last
3157         entry.  On some systems doing so could result in exhausting
3158         virtual memory.  Based in part on a patch from Mike Jetzer.
3159
3160 2003-04-04  Bruno Haible  <bruno@clisp.org>
3161
3162         * linebreak.h: New file, from GNU gettext.
3163         * linebreak.c: New file, from GNU gettext with slight modifications.
3164         * lbrkprop.h: New file, from GNU gettext.
3165
3166 2003-04-03  Bruno Haible  <bruno@clisp.org>
3167
3168         * utf8-ucs4.h: New file, from GNU gettext.
3169         * utf16-ucs4.h: New file, from GNU gettext.
3170         * ucs4-utf8.h: New file, from GNU gettext.
3171         * ucs4-utf16.h: New file, from GNU gettext.
3172
3173 2003-04-02  Bruno Haible  <bruno@clisp.org>
3174
3175         * binary-io.h: New file, from GNU gettext.
3176
3177 2003-04-01  Bruno Haible  <bruno@clisp.org>
3178
3179         * pathname.h: New file, from GNU gettext.
3180         * concatpath.c: New file, from GNU gettext.
3181
3182 2003-03-30  Bruno Haible  <bruno@clisp.org>
3183
3184         * copy-file.c (copy_file_preserving): Don't set owner if the function
3185         chown() doesn't exist.
3186
3187 2003-03-28  Bruno Haible  <bruno@clisp.org>
3188
3189         * copy-file.h: New file, from GNU gettext.
3190         * copy-file.c: New file, from GNU gettext.
3191
3192 2003-03-18  Jim Meyering  <jim@meyering.net>
3193
3194         * quote.c (quote_n): Fix typo in comment.
3195
3196 2003-03-14  Jim Meyering  <jim@meyering.net>
3197
3198         Merge changes from Coreutils.
3199         * obstack.h (obstack_object_size): Declare temporary, __o,
3200         to be const, in order to avoid warnings.
3201         (obstack_room): Likewise.
3202         (obstack_empty_p): Likewise.
3203
3204 2003-03-13  Paul Eggert  <eggert@twinsun.com>
3205
3206         Merge changes from Bison.
3207         * obstack.h: (__INT_TO_PTR) [__STDC__]: Cast result to
3208         (void *) to avoid diagnostic with native c89 on SGI IRIX 6.5
3209         when compiling Bison 1.875's `bitset bset = obstack_alloc
3210         (bobstack, bytes);'.  Problem reported by Nelson H. F. Beebe.
3211         * hash.c: Include <stdbool.h> unconditionally.
3212
3213 2003-03-09  Paul Eggert  <eggert@twinsun.com>
3214
3215         * argmatch.c (EXIT_FAILURE): Define if the system doesn't.
3216         Reported by Bruce Becker; see:
3217         http://mail.gnu.org/archive/html/bug-bison/2003-03/msg00017.html
3218
3219 2003-03-03  Paul Eggert  <eggert@twinsun.com>
3220             Bruno Haible  <bruno@clisp.org>
3221
3222         * mbswidth.h: Include <wchar.h>. Needed for UnixWare 7.1.1.
3223         Reported by John Hughes, see
3224         http://mail.gnu.org/archive/html/bug-bison/2003-02/msg00030.html
3225
3226 2003-02-19  Paolo Bonzino  <bonzini@gnu.org>
3227
3228         * poll_.h: New file.
3229         * poll.c: New file.
3230
3231 2003-02-18  Paolo Bonzino  <bonzini@gnu.org>
3232
3233         * mathl.h: New file.
3234         * acosl.c: New file.
3235         * asinl.c: New file.
3236         * atanl.c: New file.
3237         * ceill.c: New file.
3238         * cosl.c: New file.
3239         * expl.c: New file.
3240         * floorl.c: New file.
3241         * frexpl.c: New file.
3242         * ldexpl.c: New file.
3243         * logl.c: New file.
3244         * sincosl.c: New file.
3245         * sinl.c: New file.
3246         * sqrtl.c: New file.
3247         * tanl.c: New file.
3248         * trigl.c: New file.
3249         * trigl.h: New file.
3250
3251 2003-02-17  Bruno Haible  <bruno@clisp.org>
3252
3253         * mkdtemp.h: New file, from GNU gettext.
3254         * mkdtemp.c: New file, from GNU gettext.
3255
3256 2003-01-31  Bruno Haible  <bruno@clisp.org>
3257
3258         * rename.c: #undef rename before defining rpl_rename.
3259         * strnlen.c: #undef strnlen, define rpl_strnlen instead of strnlen.
3260
3261 2003-01-30  Bruno Haible  <bruno@clisp.org>
3262
3263         * printf-args.h: New file, from GNU gettext.
3264         * printf-args.c: New file, from GNU gettext.
3265         * printf-parse.h: New file, from GNU gettext.
3266         * printf-parse.c: New file, from GNU gettext.
3267         * vasnprintf.h: New file, from GNU gettext.
3268         * vasnprintf.c: New file, from GNU gettext.
3269         * asnprintf.c: New file, from GNU gettext.
3270         * vasprintf.h: New file, from GNU gettext with modifications.
3271         * vasprintf.c: New file, from GNU gettext.
3272         * asprintf.c: New file, from GNU gettext.
3273
3274 2003-01-29  Bruno Haible  <bruno@clisp.org>
3275
3276         * stpncpy.h: New file, from GNU gettext with modifications.
3277         * stpncpy.c: New file, from GNU gettext with modifications.
3278
3279 2003-01-28  Bruno Haible  <bruno@clisp.org>
3280
3281         * c-ctype.h: New file, from GNU gettext, with changes suggested by
3282         Paul Eggert.
3283         * c-ctype.c: New file, from GNU gettext, with changes suggested by
3284         Paul Eggert.
3285
3286 2003-01-27  Bruno Haible  <bruno@clisp.org>
3287
3288         * xsetenv.h: New file, from GNU gettext.
3289         * xsetenv.c: New file, from GNU gettext.
3290
3291 2003-01-23  Bruno Haible  <bruno@clisp.org>
3292
3293         * minmax.h: New file, from GNU gettext, with comments from Paul Eggert.
3294
3295 2003-01-22  Bruno Haible  <bruno@clisp.org>
3296
3297         * exit.h: New file, from GNU gettext.
3298
3299 2003-01-11  Bruno Haible  <bruno@clisp.org>
3300
3301         * stpcpy.h (stpcpy): Use ANSI C function declarations.
3302         * strcase.h (strcasecmp, strncasecmp): Likewise.
3303
3304 2003-01-14  Jim Meyering  <jim@meyering.net>
3305
3306         * same.c (same_name): Tweak a comment.
3307
3308 2003-01-11  Bruno Haible  <bruno@clisp.org>
3309
3310         * same.c (same_name): Reorder tests so as to avoid calling stat()
3311         when a string comparison is sufficient.
3312
3313 2003-01-11  Bruno Haible  <bruno@clisp.org>
3314
3315         * readtokens.c (readtoken): Cast character to 'unsigned char', not
3316         'unsigned int'.
3317
3318 2003-01-11  Bruno Haible  <bruno@clisp.org>
3319
3320         * hash-pjw.c: Add comment about low quality of this function.
3321
3322 2003-01-12  Paul Eggert  <eggert@twinsun.com>
3323
3324         Finish renaming getstr -> getdelim2 and readline -> readlinebuffer,
3325         to avoid collisions with libcurses and libreadline.
3326
3327         * Makefile.am (libfetish_a_SOURCES): Remove getstr.c, getstr.h.
3328         * getstr.h, getstr.c: Remove.
3329         * getline.c: Include "getline.h", to check interface.
3330         Move body of old getstr.c here: this defines MIN_CHUNK and
3331         declares getdelim2, which is renamed from getstr.
3332         (getline, getdelim): Adjust to renaming of getstr -> getdelim2.
3333
3334         * linebuffer.c (readlinebuffer): Renamed from readline.
3335         All uses changed.
3336         * linebuffer.h: Likewise.
3337         (readline): Remove backward-compatibility macro.
3338
3339 2003-01-12  Jim Meyering  <jim@meyering.net>
3340
3341         * makepath.c: Don't test HAVE_ERRNO_H.  It's not necessary.
3342
3343 2003-01-10  Bruno Haible  <bruno@clisp.org>
3344
3345         * alloca_.h: New file.
3346         * getdate.y: Unconditionally include alloca.h.
3347         * makepath.c: Likewise.
3348         * setenv.c: Likewise.
3349         * userspec.c: Likewise.
3350
3351 2003-01-09  Bruno Haible  <bruno@clisp.org>
3352
3353         * stdbool.h.in: New file.
3354
3355 2003-01-08  Bruno Haible  <bruno@clisp.org>
3356
3357         * safe-read.c: Include specification header first, to ensure its
3358         selfcontainedness.
3359         * full-write.c: Likewise.
3360
3361 2003-01-08  Jim Meyering  <jim@meyering.net>
3362
3363         * full-write.c: Undefine and define-away `const' after inclusion
3364         of errno.h, not before.  Suggestion from Bruno Haible.
3365
3366 2003-01-07  Jim Meyering  <jim@meyering.net>
3367
3368         * full-write.c: Rework so that it may serve to define full_read, too.
3369         * full-read.c: Simply #define FULL_READ and include full-write.c.
3370
3371 2003-01-06  Jim Meyering  <jim@meyering.net>
3372
3373         * version-etc.c: Update year in translatable copyright string.
3374
3375 2002-12-25  Bruno Haible  <bruno@clisp.org>
3376
3377         * strtoimax.c: Include <stdint.h> as an alternative to <inttypes.h>.
3378         * xstrtol.h: Likewise.
3379         * xstrtoimax.c: Likewise.
3380         * xstrtoumax.c: Likewise.
3381         * human.h: Likewise.
3382
3383         * tempname.c: Include <inttypes.h> too. Avoids a compilation error
3384         on systems that have <inttypes.h> but not <stdint.h>.
3385
3386 2002-12-31  Paul Eggert  <eggert@twinsun.com>
3387
3388         * memcoll.c (memcoll): Fall back on a simple algorithm using
3389         memcmp if strcoll doesn't work.
3390
3391 2002-12-23  Bruno Haible  <bruno@clisp.org>
3392
3393         * localcharset.h: New file.
3394         * localcharset.c: Include it.
3395         * unicodeio.c: Likewise.
3396
3397 2002-12-22  Bruno Haible  <bruno@clisp.org>
3398
3399         * utime.c (utime_null): No need to call ftruncate if the file was
3400         nonempty.
3401
3402 2002-12-23  Bruno Haible  <bruno@clisp.org>
3403
3404         * memcoll.c (STRCOLL): New macro.
3405         (memcoll): Use it.
3406
3407 2002-12-22  Bruno Haible  <bruno@clisp.org>
3408
3409         * getstr.h (getstr): Define, to avoid clash with libcurses.
3410         * linebuffer.h (readline): Define, to avoid clash with libreadline.
3411
3412 2002-12-22  Bruno Haible  <bruno@clisp.org>
3413
3414         * getdate.y (get_date): Test HAVE_STRUCT_TM_TM_ZONE, not HAVE_TM_ZONE.
3415
3416 2002-12-23  Bruno Haible  <bruno@clisp.org>
3417
3418         * getline.h: Include <stddef.h>, for size_t.
3419
3420         * unicodeio.h: Include <stddef.h>, for size_t.
3421         * unicodeio.c: Don't include <stddef.h>.
3422
3423 2002-12-17  Bruno Haible  <bruno@clisp.org>
3424
3425         * canon-host.c (strdup): Remove unused declaration.
3426
3427         * fsusage.c: Include full_read.h.
3428         (get_fs_usage): Use full_read instead of safe_read.
3429
3430         * utime.c (utime_null): Use SAFE_READ_ERROR.
3431
3432 2002-12-11  Bruno Haible  <bruno@clisp.org>
3433
3434         * setenv.h: Rewritten to cope with systems that have setenv() but not
3435         unsetenv().
3436         * setenv.c, unsetenv.c: Taken from glibc-2.2.4 with the following
3437         modifications:
3438
3439         2002-12-11  Bruno Haible  <bruno@clisp.org>
3440
3441                 * setenv.c (alloca): Fall back to malloc.
3442                 (freea): New macro.
3443                 (setenv): Use freea() to free memory allocated with alloca().
3444
3445         2002-11-13  Bruno Haible  <bruno@clisp.org>
3446
3447                 * setenv.c (compar_fn_t, __add_to_environ, setenv): Use ANSI C
3448                 function declarations.
3449                 * unsetenv.c (unsetenv): Likewise.
3450
3451         2002-03-04  Bruno Haible  <bruno@clisp.org>
3452
3453                 Portability to AIX 4.3.3.
3454                 * unsetenv.c: New file, extracted from setenv.c.
3455                 * setenv.c: Move the unsetenv() function to unsetenv.c.
3456
3457         2001-12-20  Bruno Haible  <bruno@clisp.org>
3458
3459                 * setenv.c (__add_to_environ): Don't call realloc(NULL,...),
3460                 use malloc instead. For SunOS 4.
3461
3462         2001-12-11  Bruno Haible  <bruno@clisp.org>
3463
3464                 * setenv.c: Declare alloca.
3465                 (compar_fn_t): New typedef.
3466                 (KNOWN_VALUE, STORE_VALUE): Use it.
3467
3468         * Makefile.am (libfetish_a_SOURCES): Add setenv.c, unsetenv.c,
3469         setenv.h.
3470
3471 2002-12-10  Paul Eggert  <eggert@twinsun.com>
3472
3473         Port exclude.c and exclude.h to more non-GNU systems, e.g. Solaris 7.
3474         * exclude.h (EXCLUDE_ANCHORED, EXCLUDE_INCLUDE, EXCLUDE_WILDCARDS):
3475         Choose values that are less likely to collide with system fnmatch
3476         options.
3477         * exclude.c (FNM_CASEFOLD, FNM_LEADING_DIR): Define to 0 if not
3478         defined (e.g., a pure POSIX system).
3479         (EXCLUDE_macros_do_not_collide_with_FNM_macros): Use FNM_PATHNAME
3480         instead of FNM_FILE_NAME, for compatibility with pure POSIX sytems.
3481
3482 2002-12-06  Jim Meyering  <jim@meyering.net>
3483
3484         * error.c: Be consistent: change `#ifndef _LIBC' to `#if !_LIBC'.
3485
3486         Merge in changes from libc's misc/error.c, in preparation
3487         for the merge of gnulib's changes back into libc.
3488
3489         * error.c (_): Define only if not already defined.
3490         Move definition to follow all #include directives.
3491         Include unlocked-io.h only if !_LIBC.
3492         [_LIBC]: Include <libio/libioP.h>.
3493         [USE_IN_LIBIO]: Include <libio/iolibio.h>
3494         (fflush): Tweak definition to use INTUSE.
3495         (putc): Define.
3496
3497 2002-12-05  Paul Eggert  <eggert@twinsun.com>
3498
3499         * alloca.c [defined emacs]: Include "lisp.h".
3500         (xalloc_die) [defined emacs]: New macro.
3501         (free) [defined emacs && defined EMACS_FREE]: Define to EMACS_FREE.
3502         [! defined emacs]: Include <xalloc.h>.
3503         (POINTER_TYPE) [!defined POINTER_TYPE]: New macro.
3504         (pointer): Typedef to POINTER_TYPE *.
3505         (malloc): Remove decl; we now always use xmalloc.
3506         (alloca): Use old-style definition, since Emacs needs this.
3507         Check for arithmetic overflow when computing combined size.
3508
3509 2002-12-04  Paul Eggert  <eggert@twinsun.com>
3510
3511         Do not generate unlocked-io.h automatically, since it's easier to
3512         maintain it by hand.
3513
3514         * unlocked-io.h: New file, from GNU diffutils,
3515         but with proper copyright notice and attribution.
3516         * gen-uio: Remove.
3517         * Makefile.am: Add copyright notice.
3518         (libfetish_a_SOURCES): Add unlocked-io.h.
3519         (BUILT_SOURCES, all-local): Remove unlocked-io.h.
3520         (DISTCLEANFILES, io_functions): Remove macros.
3521         (EXTRA_DIST): Remove gen_uio.
3522         (unlocked-io.h): Remove rule.
3523
3524 2002-12-04  Jim Meyering  <jim@meyering.net>
3525
3526         Reflect the fact that stat.c and lstat.c are no longer generated.
3527         * Makefile.am (BUILT_SOURCES): Remove stat.c and lstat.c.
3528         (DISTCLEANFILES): Likewise.
3529         (EXTRA_DIST): Likewise.
3530         (all_local): Don't depend on stat.c or lstat.c.
3531         (stat.c, lstat.c): Remove rules.
3532         (EXTRA_DIST): Remove xstat.in.
3533
3534         * xstat.in: Remove file.  Contents moved into stat.c.
3535         * stat.c: New file.  Contents mostly from xstat.in.
3536         * stat.c: Rework so that it may serve to define rpl_lstat, too.
3537         * lstat.c: New file. Simply #define LSTAT and include stat.c.
3538
3539         * safe-read.c: Rework so that it may serve to define safe_write, too.
3540         * safe-write.c: Simply #define SAFE_WRITE and include safe-read.c.
3541
3542 2002-12-03  Jim Meyering  <jim@meyering.net>
3543
3544         * safe-read.c, safe-write.c: Change variable names and comments, but
3545         not semantics, to minimize the differences between these two files.
3546         (safe_read): Change comment to mention SAFE_READ_ERROR.
3547
3548         * safe-read.c (IS_EINTR): Define.
3549         (safe_read): Use IS_EINTR in place of in-function cpp directives.
3550
3551 2002-12-02  Bruno Haible  <bruno@clisp.org>
3552
3553         * safe-write.c (CHAR_BIT, TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM):
3554         Define, taken from safe-read.c.
3555         (INT_MAX): Provide fallback.
3556         (safe_write): Rewrite to iterate IFF the write fails with EINTR.
3557         * safe-write.h (SAFE_WRITE_ERROR): Define.
3558
3559         * safe-read.c (EINTR): Remove definition.
3560         (safe_read): Don't use EINTR if it is absent.
3561
3562 2002-12-02  Jim Meyering  <jim@meyering.net>
3563
3564         * safe-read.c (EINTR): Define.
3565         (CHAR_BIT, TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM): Define.
3566         (INT_MAX): Provide fallback.
3567         (safe_read): Rewrite to iterate IFF the read fails with EINTR.
3568
3569         * safe-read.h (SAFE_READ_ERROR): Define.
3570
3571 2002-12-01  Jim Meyering  <jim@meyering.net>
3572
3573         * safe-read.c: (safe_read): Also exit the loop when read returns zero.
3574         (CHAR_BIT, TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM, INT_MAX): Define.
3575
3576 2002-11-27  Paul Eggert  <eggert@twinsun.com>
3577
3578         * hash.c (hash_lookup, hash_get_first, hash_get_next, hash_find_entry,
3579         hash_rehash): Replace `if (limit <= value) abort ();' with
3580         `if (! (value < limit)) abort ();', for readability.
3581
3582 2002-11-26    <karl@gnu.org>
3583
3584         * strdup.c: copy from libc again, with jim's ok.
3585         * .cppi-disable: re-add strdup.c
3586
3587 2002-11-25    <karl@gnu.org>
3588
3589         * strtoll.c: copy from libc, meaning we now #include <strtol.c>
3590         instead of "strtol.c".
3591
3592 2002-11-25  Jim Meyering  <jim@meyering.net>
3593
3594         * mktime.c: Sync from libc, now that it has the latest fix.
3595
3596 2002-11-24    <karl@gnu.org>
3597
3598         * error.c, getopt.c, getopt.h, getopt1.c, obstack.c, regex.c,
3599         regex.h, strdup.c, strtoll.c, tempname.c: change license to gpl.
3600
3601 2002-11-24  Jim Meyering  <jim@meyering.net>
3602
3603         Update from coreutils:
3604
3605         * mktime.c: Merge in changes from libc.
3606
3607         Avoid a link-time failure on some Linux systems.
3608         * mktime.c (STATIC): Define to be empty (_LIBC) or `static' (otherwise).
3609         (__mon_yday): Declare with the STATIC attribute.
3610         (__mktime_internal): Likewise.
3611         Based on a report from Greg Schafer.
3612
3613 2002-11-23  Jim Meyering  <jim@meyering.net>
3614
3615         * sig2str.c (str2signum, sig2str): Avoid a warning from gcc:
3616         Use `unsigned', not `int', as type of index.
3617
3618         * xstat.in [@BEGIN_LSTAT_ONLY@]: Include <string.h>.
3619
3620         * fsusage.c: Remove unneeded parentheses around operands of `defined'.
3621
3622 2002-11-22  Paul Eggert  <eggert@twinsun.com>
3623
3624         * hash.c: Avoid use of <assert.h>, as the GNU Coding Standards
3625         hint that one should use `if (! x) abort ();' rather than `assert
3626         (x);', and anyway it's one less thing to worry about configuring.
3627         (hash_lookup, hash_get_first, hash_get_next, hash_find_entry,
3628         hash_rehash, hash_insert): Use abort rather than assert.
3629
3630 2002-11-22  Paul Eggert  <eggert@twinsun.com>
3631
3632         * quotearg.h: Allow multiple inclusion by surrounding with
3633         "#ifndef QUOTEARG_H_".  Include <stddef.h>, for size_t,
3634         so that we can be included first.
3635         (PARAMS): Remove; we now assume C89 or later.  All uses removed.
3636         * quotearg.c: Include quotearg.h immediately after config.h.
3637         No need to include stddef.h or sys/types.h any more.
3638         Surround local include files with "", not "<>".
3639         Assume HAVE_LIMITS_H unconditionally, as we assume C89.
3640         Similarly, assume HAVE_C_BACKSLASH_A, CHAR_BIT, UCHAR_MAX, UINT_MAX,
3641         HAVE_STDLIB_H, HAVE_STRING_H, STDC_HEADERS.
3642         (HAVE_MBSINIT): Undef if !HAVE_MBRTOWC.
3643         (mbsinit): Define to 1 if !defined mbsinit && !HAVE_MBSINIT.
3644         (ISPRINT): Remove; no longer needed now that we assume C89.
3645
3646         (clone_quoting_options, quotearg_buffer, quotearg_n_options):
3647         Preserve errno.
3648
3649         (quotearg_buffer_restyled, quotearg_n, quotearg_n_style,
3650         quotearg_char): Use SIZE_MAX rather than
3651         (size_t) -1 when we are talking about "infinity".
3652
3653         (quotearg_buffer_restyled): Fix bug when quoting trigraphs.
3654
3655 2002-11-22  Bruno Haible  <bruno@clisp.org>
3656
3657         * safe-read.h: Assume C89. Add comments.
3658         (safe_read): Change return type to size_t.
3659         * safe-read.c (safe_read): Change return type to size_t. Handle byte
3660         counts > SSIZE_MAX correctly.
3661         * safe-write.h: New file.
3662         * safe-write.c: New file.
3663         * full-read.h: New file.
3664         * full-read.c: New file.
3665         * full-write.h: Assume C89. Add comments.
3666         * full-write.c: Include safe-write.h.
3667         (full_write): Rewritten to use safe_write.
3668         Suggested by Jim Meyering and Paul Eggert.
3669
3670 2002-11-21  Bruno Haible  <bruno@clisp.org>
3671
3672         Remove case insensitive option matching.
3673         * argmatch.h (argcasematch): Remove declaration.
3674         (ARGCASEMATCH): Remove macro.
3675         (__xargmatch_internal): Remove case_sensitive argument.
3676         (XARGMATCH): Update.
3677         (XARGCASEMATCH): Remove macro.
3678         * argmatch.c (argmatch): Renamed from __argmatch_internal. Remove
3679         case_sensitive argument.
3680         (argcasematch): Remove function.
3681         (__xargmatch_internal): Remove case_sensitive argument.
3682         (main): Use XARGMATCH instead of XARGCASEMATCH.
3683
3684         * xmalloc.c: Change compile-time error message. Add comment about
3685         required autoconf version.
3686
3687 2002-11-21  Jim Meyering  <jim@meyering.net>
3688
3689         * strdup.c (strdup): Tweak comment and initial #if/#include.
3690
3691         Merge in changes from the coreutils.
3692
3693         2002-09-25  Paul Eggert  <eggert@twinsun.com>
3694         * fsusage.c [! HAVE_INTTYPES_H && HAVE_STDINT_H] Include <stdint.h>.
3695         (UINTMAX_MAX) [!defined UINTMAX_MAX]: New macro.
3696         (PROPAGATE_ALL_ONES): Work even if X is unsigned and narrower than
3697         int.  Work more efficiently if X is the same width as uintmax_t.
3698         Do not compare X to -1, to avoid bogus compiler warning.
3699         (get_fs_usage): (uintmax_t) -1 -> UINTMAX_MAX to avoid a cast.
3700         Don't assume that f_frsize and f_bsize are the same type.
3701
3702         * mountlist.c: #undef MNT_IGNORE before defining it, to avoid warning
3703         on FreeBSD.
3704
3705         * makepath.c (make_path): Restore umask *before* creating the final
3706         component.
3707         (make_path): Minor reformatting.
3708
3709         * xmalloc.c: Adjust to work with new autoconf macros, AC_FUNC_MALLOC
3710         and AC_FUNC_REALLOC: test #ifndef HAVE_MALLOC/HAVE_REALLOC.
3711
3712         * mountlist.h (ME_DUMMY): Don't count entries of type `auto' as dummy
3713         ones.  At least on GNU/Linux systems, `auto' means something else.
3714         From Michael Stone.
3715
3716 2002-11-20  Paul Eggert  <eggert@twinsun.com>
3717
3718         Merge argmatch cleanups from Bison.  Assume C89.
3719
3720         * argmatch.c: Include config.h here, not in argmatch.h.
3721         Include stdlib.h, for EXIT_FAILURE.
3722         Always include <string.h>, since we assume C89.
3723         (EXIT_FAILURE): Remove pre-C89 bug workaround.
3724         * argmatch.h: Do not include <config.h> or <sys/types.h>.
3725         Include <stddef.h> instead, since it's all we need for size_t.
3726         (PARAMS): Remove.  All uses removed.
3727         (ARRAY_CARDINALITY): Do not bother to #undef.
3728         (ARRAY_CARDINALITY, ARGMATCH, ARGCASEMATCH, invalid_arg,
3729         ARGMATCH_VALID, XARGMATCH, XARGCASEMATCH):
3730         Remove unnecessary parentheses.
3731         (ARGMATCH_VALID, XARGMATCH, XARGCASEMATCH):
3732         Insert necessary parentheses.
3733         (ARGMATCH_CONSTRAINT, ARGMATCH_VERIFY): New macros.
3734         (ARGMATCH_ASSERT): Use ARGMATCH_CONSTRAINT.
3735
3736 2002-11-19  Bruno Haible  <bruno@clisp.org>
3737
3738         * mbswidth.c: Include mbswidth.h right at the beginning.
3739         * mbswidth.h: Include <stddef.h>, for size_t.
3740
3741         * mbswidth.h (PARAMS): Remove macro.
3742         (mbswidth, mbsnwidth): Use ANSI C function declarations.
3743         * mbswidth.c (mbswidth, mbsnwidth): Likewise.
3744
3745         * gcd.h (PARAMS): Remove macro.
3746         (gcd): Use ANSI C function declarations.
3747         * gcd.c (gcd): Likewise.
3748
3749 2002-11-15  Bruno Haible  <bruno@clisp.org>
3750
3751         * strcspn.c: Include <stddef.h>.
3752         (strcspn): Use ANSI C function declaration. Change return type to
3753         size_t. Use NULL.
3754         * strpbrk.c: Minimize diffs to glibc. Include <stddef.h>.
3755         (strpbrk): Use NULL.
3756         * strpbrk.h (PARAMS): Remove macro.
3757         (strpbrk): Use ANSI C function declaration.
3758         * strstr.c: Don't include <sys/types.h>.
3759         * strstr.h (PARAMS): Remove macro.
3760         (strstr): Use ANSI C function declarations.
3761
3762 2002-11-06  Bruno Haible  <bruno@clisp.org>
3763
3764         * gcd.h (gcd): Change argument type to 'unsigned long'.
3765         * gcd.c (gcd): Likewise.
3766
3767 2002-11-05  Bruno Haible  <bruno@clisp.org>
3768
3769         * gcd.h: New file, from gettext-0.11.5.
3770         * gcd.c: New file, from gettext-0.11.5.
3771
3772 2002-11-05  Bruno Haible  <bruno@clisp.org>
3773
3774         * error.c [!_LIBC]: Include gettext.h instead of <libintl.h>.
3775         * getopt.c [!_LIBC]: Include gettext.h instead of <libintl.h>.
3776         * obstack.c [!_LIBC]: Include gettext.h instead of <libintl.h>.
3777         * regex.c [!_LIBC]: Include gettext.h instead of <libintl.h>.
3778
3779         * argmatch.c: Include gettext.h instead of <locale.h> and <libintl.h>.
3780         * makepath.c: Include gettext.h instead of <locale.h> and <libintl.h>.
3781
3782         * closeout.c: Include gettext.h instead of <libintl.h>.
3783         * human.c: Include gettext.h instead of <libintl.h>.
3784         * quotearg.c: Include gettext.h instead of <libintl.h>.
3785         * rpmatch.c: Include gettext.h instead of <libintl.h>.
3786         * unicodeio.c: Include gettext.h instead of <libintl.h>.
3787         * userspec.c: Include gettext.h instead of <libintl.h>.
3788         * version-etc.c: Include gettext.h instead of <libintl.h>.
3789         * xmalloc.c: Include gettext.h instead of <libintl.h>.
3790         (textdomain): Remove definition.
3791         * xmemcoll.c: Include gettext.h instead of <libintl.h>.
3792
3793         * long-options.c: Remove include of <libintl.h> and definition of _.
3794         * same.c: Remove include of <libintl.h> and definition of _.
3795
3796 2002-11-04  Bruno Haible  <bruno@clisp.org>
3797
3798         * stpcpy.h: New file, from GNU gettext-0.11.5.
3799         * strcase.h: New file, from GNU gettext-0.11.5.
3800         * strpbrk.h: New file, from GNU gettext-0.11.5.
3801         * strstr.h: New file, from GNU gettext-0.11.5.
3802         * xgetcwd.h: New file, from GNU gettext-0.11.5.
3803
3804 2002-05-09  Bruno Haible  <bruno@clisp.org>
3805
3806         * config.charset: Update for newest glibc. Add canonical names
3807         ISO-8859-14, KOI8-T, TCVN5712-1, GEORGIAN-PS.
3808
3809 2002-05-09  Bruno Haible  <bruno@clisp.org>
3810
3811         * localcharset.c (get_charset_aliases): Add more Windows specific
3812         aliases.
3813
3814 2002-05-08  Owen Taylor  <otaylor@redhat.com>
3815
3816         * config.charset: A few additions for Solaris.
3817
3818 2001-12-05  Bruno Haible  <bruno@clisp.org>
3819
3820         * localcharset.c (locale_charset): Don't return an empty string.
3821
3822 2001-10-23  Bruno Haible  <haible@clisp.cons.org>
3823
3824         * config.charset: msdos in uk_UA uses CP1125.
3825
3826 2001-08-05  Bruno Haible  <haible@clisp.cons.org>
3827
3828         Make it possible to build libcharset with CC=gcc CFLAGS="-x c++".
3829         * localcharset.c (locale_charset): Declare as extern "C".
3830
3831 2002-02-15  Bruno Haible  <bruno@clisp.org>
3832
3833         * config.charset [msdosdjgpp]: For Russian, use CP866.
3834
3835 2002-02-11  Bruno Haible  <bruno@clisp.org>
3836
3837         * config.charset: Add support for NetBSD.
3838
3839 2002-09-25    <karl@gnu.org>
3840
3841         * strdup.c: copy from libc/string (via ../config/srclist*).
3842         * getopt*: copy from libc/posix.
3843         * gettext.h: copy from gettext.
3844         * .cppi-disable: add strdup.c, gettext.h.
3845
3846 2002-07-01  Jim Meyering  <meyering@lucent.com>
3847
3848         * c-stack.c: Include sys/time.h.
3849         From Volker Borchert.
3850
3851 2002-06-11  Paul Eggert  <eggert@twinsun.com>
3852
3853         * fnmatch.c, fnmatch_loop.c (WIDE_CHAR_SUPPORT):
3854         New macro.  Use it uniformly instead of
3855         (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H).
3856         It also uses HAVE_BTOWC, to fix a porting bug on Solaris 2.5.1
3857         reported by Vin Shelton.
3858
3859 2002-06-22  Jim Meyering  <meyering@lucent.com>
3860
3861         * fnmatch.c (ISASCII, ISPRINT): Undefine, to avoid warning about
3862         redefinition due to Solaris 2.6's definition in /usr/include/sys/euc.h.
3863
3864 2002-06-22  Paul Eggert  <eggert@twinsun.com>
3865
3866         * c-stack.h (segv_handler, c_stack_action) [! defined SA_SIGINFO]:
3867         Do not assume SA_SIGINFO behavior.
3868         Bug reported by Jim Meyering on NetBSD 1.5.2.
3869
3870 2002-06-22  Jim Meyering  <meyering@lucent.com>
3871
3872         * c-stack.c, c-stack.h: New files, from diffutils-2.8.2.
3873
3874         * exitfail.c, exitfail.h: Likewise.
3875         * Makefile.am (libfetish_a_SOURCES): Add exitfail.c and exitfail.h.
3876
3877         * Makefile.am (libfetish_a_SOURCES): Add fnmatch_.h in place
3878         of fnmatch.h.
3879         (EXTRA_DIST): Add fnmatch_loop.c.
3880         (libfetish_a_SOURCES): Add c-stack.c and c-stack.h.
3881
3882         * fnmatch_loop.c: New file, from diffutils-2.8.2.
3883         * fnmatch.c: Update from diffutils-2.8.2.
3884         * fnmatch_.h: New file.  From diffutils-2.8.2.
3885         * fnmatch.h: Remove file.
3886
3887 2002-06-18  Paul Eggert  <eggert@twinsun.com>
3888
3889         * file-type.h: Report an error if neither S_ISREG nor
3890         S_IFREG is defined, instead of using a test specific to glibc
3891         2.2.  This should be safe, since POSIX requires S_ISREG and
3892         Unix Version 7 had S_IFREG.  We don't need to check for
3893         <sys/types.h> since we don't use any symbols that it defines.
3894
3895 2002-06-15  Jim Meyering  <meyering@lucent.com>
3896
3897         * file-type.h (FILE_TYPE_H): Guard entire contents with #ifndef.
3898         For GNU libc 2.2 and newer, ensure that <sys/types.h> and <sys/stat.h>
3899         have been included before this file.
3900
3901 2002-06-13  Richard Dawe  <richdawe@bigfoot.com>
3902
3903         * Makefile.am (lstat.c, stat.c, .sin.sed): Use t-$@, rather than $@-t,
3904         so that each temporary file name is unique and valid in the first
3905         8 characters, for operation under DOS.
3906
3907 2002-06-15  Jim Meyering  <meyering@lucent.com>
3908
3909         Work even with DJGPP 2.03, which lacks support for symlinks.
3910         From Richard Dawe.
3911         * xstat.in (S_ISLNK): Define to 0 if neither S_ISLNK nor S_IFLNK
3912         is defined.
3913         * lchown.c (S_ISLNK): Likewise.
3914
3915 2002-06-14  Jim Meyering  <meyering@lucent.com>
3916
3917         * file-type.h: Use the version from diffutils-2.8.2.
3918         * file-type.c: Likewise.
3919
3920 2002-05-27  Jim Meyering  <meyering@lucent.com>
3921
3922         Fix a problem seen only on nonconforming systems whereby ls.c's
3923         use of localtime, and then of gettimeofday would cause trouble:
3924         the localtime call used to initialize rpl_gettimeofday's save
3925         mechanism would clobber ls's current local time information so
3926         that in any long listing the first file would always be listed
3927         with date 1970-01-01.  Analysis by Volker Borchert.
3928
3929         * gettimeofday.c (localtime): Undefine.
3930         (rpl_localtime): New function.
3931
3932 2002-05-22  Jim Meyering  <meyering@lucent.com>
3933
3934         * Makefile.am (libfetish_a_SOURCES): Add file-type.c and file-type.h.
3935         * file-type.h: New file.
3936         * file-type.c (file_type): New file/function.  Extracted from diffutils.
3937
3938 2002-04-29  Paul Eggert  <eggert@twinsun.com>
3939
3940         * hard-locale.c: Upgrade to version used in GNU Diffutils 2.8.1.
3941
3942 2002-04-28  Paul Eggert  <eggert@twinsun.com>
3943
3944         * sig2str.h (SIGNUM_BOUND): Do not use WTERMSIG, to avoid
3945         depending on <sys/wait.h> and WTERMSIG.  Default to 64 instead
3946         of 127, since 64 is the largest conceivable number for ancient
3947         nonstandard hosts.
3948         * sig2str.c: Do not include <sys/wait.h>; no longer needed.
3949
3950 2002-04-28  Jim Meyering  <meyering@lucent.com>
3951
3952         * sig2str.c (WTERMSIG): Remove definition (unused).
3953
3954 2002-04-28  Paul Eggert  <eggert@twinsun.com>
3955
3956         * sig2str.h, sig2str.c: New files.
3957         * Makefile.am (libfetish_a_SOURCES): Add sig2str.h.
3958
3959 2002-04-24  Jim Meyering  <meyering@lucent.com>
3960
3961         * gettext.h: New file, from Gettext.
3962         * Makefile.am (INCLUDES): Remove -I../intl.
3963         (libfetish_a_SOURCES): Add gettext.h.
3964
3965 2002-04-16  Jim Meyering  <meyering@lucent.com>
3966
3967         * readutmp.h (UT_TYPE): Remove definition (now in who.c).
3968         (HAVE_STRUCT_XTMP_UT_EXIT, HAVE_STRUCT_XTMP_UT_ID): Define.
3969         (HAVE_STRUCT_XTMP_UT_PID, HAVE_STRUCT_XTMP_UT_TYPE): Define.
3970
3971 2002-04-12  Jim Meyering  <meyering@lucent.com>
3972
3973         * dirfd.h (dirfd): Elide prototype if dirfd is a macro.
3974
3975 2002-03-10  Jim Meyering  <meyering@lucent.com>
3976
3977         * makepath.c (make_path): Remove a comma from a diagnostic.
3978         Suggestion from Santiago Vila.
3979
3980 2002-03-08  Jim Meyering  <meyering@lucent.com>
3981
3982         * rename.c: Mention that this wrapper is needed also on
3983         mips-dec-ultrix4.4 systems.
3984
3985 2002-03-02  Jim Meyering  <meyering@lucent.com>
3986
3987         * gettime.c (gettime): Test HAVE_CLOCK_GETTIME,
3988         not HAVE_CLOCK_SETTIME.
3989
3990 2002-02-27  Paul Eggert  <eggert@twinsun.com>
3991
3992         * nanosleep.h: Rename to....
3993         * timespec.h: New name for nanosleep.h.  All uses changed.
3994
3995         * gettime.c: New file.
3996         * settime.c: New file.
3997         * stime.c: Remove.
3998
3999         * Makefile.am (libfetish_a_SOURCES): Add gettime.c, settime.c,
4000         timespec.h.  Remove nanosleep.h.
4001
4002 2002-02-25  Paul Eggert  <eggert@twinsun.com>
4003
4004         * acl.c, acl.h: New files.
4005         * Makefile.am (libfetish_a_SOURCES): Add acl.h, acl.c.
4006
4007 2002-02-24  Jim Meyering  <meyering@lucent.com>
4008
4009         * strnlen.c (strnlen): Define-away/undef so that an inconsistent
4010         prototype in string.h (on at least AIX4.3.2.0 w/gcc-2.95.3) doesn't
4011         cause trouble.  Reported by Nelson Beebe.
4012
4013 2002-02-23  Paul Eggert  <eggert@twinsun.com>
4014
4015         * path-concat.c (xpath_concat): Reorder code to pacify
4016         compilers that don't know that xalloc_die never returns.
4017
4018 2002-02-20  Jim Meyering  <meyering@lucent.com>
4019
4020         * getdate.c: Regenerate using bison-1.33.
4021
4022 2002-02-15  Paul Eggert  <eggert@twinsun.com>
4023
4024         * posixver.c, posixver.h: New files.
4025         * Makefile.am (libfetish_a_SOURCES): Add them.
4026
4027 2002-02-02  Paul Eggert  <eggert@twinsun.com>
4028             Bruno Haible  <bruno@clisp.org>
4029
4030         * unicodeio.h (print_unicode_char): Add exit_on_error argument.
4031         (fwrite_success_callback): New declaration.
4032         * unicodeio.c (unicode_to_mb): New function, extracted from
4033         print_unicode_char. Call failure callback instead of error.
4034         (fwrite_success_callback): New function.
4035         (exit_failure_callback): New function.
4036         (fallback_failure_callback): New function.
4037         (print_unicode_char): Call unicode_to_mb.
4038
4039 2002-01-26  Jim Meyering  <meyering@lucent.com>
4040
4041         * Makefile.am (getdate$U.o): Depend on unlocked-io.h.
4042
4043 2002-01-22  Jim Meyering  <meyering@lucent.com>
4044
4045         * Makefile.am (Makefile): Don't depend on $(BUILT_SOURCES).
4046         Otherwise, some versions of automake would omit the rule that makes
4047         Makefile from Makefile.in.
4048
4049 2001-01-21  Paul Eggert  <eggert@twinsun.com>
4050
4051         * xmemcoll.h, xmemcoll.c: New files.
4052         * Makefile.am (libfetish_a_SOURCES): Add them.
4053         * memcoll.c: Include errno.h, and declare errno if not defined.
4054         (memcoll): Set errno to zero if there is no error.
4055
4056         * quotearg.c (quotearg_buffer_restyled):
4057         Fix bug with quoting buffers containing NUL when backslashing escapes.
4058         This bug was exposed by the other changes in this patch.
4059         (quotearg_n_options): New arg ARGSIZE.
4060         All callers changed.
4061         (quoting_options_from_style): New function.
4062         (quotearg_n_style): Use it.
4063         (quotearg_n_style_mem): New function.
4064
4065         * quotearg.h (quotearg_n_style_mem): New function.
4066
4067 2002-01-16  Jim Meyering  <meyering@lucent.com>
4068
4069         * getdate.y: Add three semicolons, each just before a closing brace.
4070         Bison (as of version 1.31) no longer papers over that mistake.
4071
4072 2002-02-14  Paul Eggert  <eggert@twinsun.com>
4073
4074         * backupfile.c (ISDIGIT): Comment fix.
4075         * getdate.y (ISDIGIT): Likewise.
4076         * posixtm.c (ISDIGIT, year): Likewise.
4077         * strverscmp.c (ISDIGIT): Likewise.
4078         * userspec.c (ISDIGIT): Likewise.
4079
4080 2002-01-05  Jim Meyering  <meyering@lucent.com>
4081
4082         * version-etc.c (version_etc_copyright): Update copyright year.
4083
4084 2001-01-19  Paul Eggert  <eggert@twinsun.com>
4085
4086         * closeout.c (close_stdout_status): If ferror (stdout), do
4087         not silently exit merely because the output buffer happens to
4088         have nothing pending.
4089
4090 2001-12-18  Paul Eggert  <eggert@twinsun.com>
4091
4092         See the big note in ../ChangeLog.
4093         * human.c (suffixes): Prefer K to k for 1024.
4094         (generate_suffix_backwards): New function.
4095         (human_readable_inexact): Use it.
4096         * xstrtol.c (__xstrtol): If there is no number but there
4097         is a valid suffix, assume 1.  "MB" now means decimal, "MiB" binary.
4098         Accept 'K' as well as 'k'.
4099
4100 2001-12-15  Jim Meyering  <meyering@lucent.com>
4101
4102         * regex.h (__restrict_arr): Update from libc.
4103
4104         * mountlist.h (ME_REMOTE): Recognize file systems of type smbfs
4105         as `remote' if the name starts with `//'.  Suggested by Michael Stone.
4106         (STREQ): Define.
4107
4108 2001-12-10  Jim Meyering  <meyering@lucent.com>
4109
4110         * linebuffer.c: Remove explicit declarations of xmalloc and xrealloc,
4111         Instead, include "xalloc.h".
4112         (initbuffer): Don't cast xmalloc return value to char*.
4113         (readline): Reword comment.
4114         Don't cast xrealloc return value to char*
4115         Return NULL, not 0.
4116
4117 2001-12-09  Jim Meyering  <meyering@lucent.com>
4118
4119         * modechange.c (mode_compile): Add cast to avoid pedantic warning about
4120         `signed and unsigned type in conditional expression'.
4121         * posixtm.c (posix_time_parse): Likewise.
4122
4123         * xreadlink.c (xreadlink): Add cast to avoid a pedantic warning.
4124
4125         * readtokens.c (readtoken): Declare an index to be of type unsigned
4126         to avoid a pedantic warning.
4127
4128         * getstr.c: Don't include assert.h.
4129         (getstr): Remove warning-evoking assertions.
4130         Return -1 if offset parameter is out of bounds.
4131         Change the type of a local from int to size_t.
4132
4133         * strftime.c (my_strftime_localtime_r): Include this function
4134         definition in the `#if ! HAVE_TM_GMTOFF' block.
4135
4136         * xgethostname.c: Remove declarations of xmalloc and xrealloc.
4137         Include xalloc.h instead.
4138
4139 2001-12-02  Jim Meyering  <meyering@lucent.com>
4140
4141         * tempname.c: Don't declare getenv, thus reverting the change of
4142         2001-11-18.  It's no longer necessary, now that stdlib.h is always
4143         included.
4144
4145         * regex.c [!__BOUNDED_POINTERS__]: Define away __bounded,
4146         __unbounded, and __ptrvalue.  Reported by Uwe H. Steinfeld.
4147
4148 2001-11-30  Akim Demaille  <akim@epita.fr>
4149
4150         * xstrdup.c: Include xalloc.h, so that xstrdup is declared
4151         before being defined.
4152
4153 2001-11-27  Paul Eggert  <eggert@twinsun.com>
4154
4155         * quotearg.h (quotearg_n, quotearg_n_style):
4156         First arg is int, not unsigned.
4157         * quotearg.c (quotearg_n, quotearg_n_style): Likewise.
4158         (SIZE_MAX, UINT_MAX): New macros.
4159         (quotearg_n_options): Abort if N is negative.
4160         Avoid overflow check on hosts where size_t is 64 bits and int
4161         is 32 bits, as overflow is impossible there.
4162         Fix off-by-one typo that caused unnecessary reallocation.
4163
4164 2001-11-27  Jim Meyering  <meyering@lucent.com>
4165
4166         * tempname.c: Merge with version from libc.
4167         * regex.c: Likewise.
4168
4169         * tempname.c: Include stdlib.h unconditionally.  On some old systems
4170         for which STDC_HEADERS is 0, it was not included, resulting in a
4171         warning about an integer-to-pointer conversion problem with getenv.
4172         Reported by Volker Borchert.
4173
4174 2001-11-26  Jim Meyering  <meyering@lucent.com>
4175
4176         * gtod.h: Remove file.
4177         * Makefile.am (libfetish_a_SOURCES): Remove gtod.h.
4178         * gettimeofday.c: Don't include gtod.h.
4179         (GTOD_init): Remove function.
4180         (rpl_gettimeofday): Do its job here instead, rather than aborting.
4181         Suggestion from Volker Borchert.
4182
4183 2001-11-23  Jim Meyering  <meyering@lucent.com>
4184
4185         * hash.h (struct hash_table): Don't define here.  Merely declare it.
4186         * hash.c (struct hash_table): Define it here instead.
4187
4188 2001-11-22  Jim Meyering  <meyering@lucent.com>
4189
4190         * hash.h: Bracket contents of file with #ifndef HASH_H_ ... #endif.
4191
4192 2001-11-18  Paul Eggert  <eggert@twinsun.com>
4193
4194         * tempname.c (TMP_MAX): Remove; no longer needed.
4195         (TEMPORARIES): New macro.
4196         (__gen_tempname): Use TEMPORARIES rather than TMP_MAX.  This
4197         removes an artificial limitation (e.g. HP-UX 10.20, where
4198         TMP_MAX is 17576).
4199
4200 2001-11-18  Jim Meyering  <meyering@lucent.com>
4201
4202         * tempname.c [!HAVE_DECL_GETENV]: Declare getenv to avoid warning
4203         on SunOS 4.
4204
4205         * Makefile.am (Makefile): Depend on $(BUILT_SOURCES), so those
4206         files will be created before anything else.
4207
4208 2001-11-17  Jim Meyering  <meyering@lucent.com>
4209
4210         * modechange.c (mode_adjust): Fix error introduced on 1999-04-26
4211         that made e.g., `chmod a=,o=w,g=o F' cause F to be group readable
4212         rather than group writable.  Patch by Juan F. Codagnone.
4213
4214         * readtokens.c: Remove explicit declarations of xmalloc and xrealloc,
4215         Instead, include "xalloc.h".
4216
4217         * mountlist.c: Include unlocked-io.h after all system headers.
4218         Remove explicit declarations of xmalloc, xrealloc,
4219         and xstrdup.  Instead, include "xalloc.h".
4220
4221         * argmatch.c, closeout.c, error.c, exclude.c: Include unlocked-io.h.
4222         * fatal.c, getdate.y, getpass.c, getstr.c, getusershell.c: Likewise.
4223         * mountlist.c, posixtm.c, readtokens.c, readutmp.c: Likewise.
4224
4225         * regex.c, sha.c, version-etc.c, yesno.c: Likewise.
4226         Reported by Padraig Brady.
4227
4228         * mkstemp.c: #undef mkstemp.
4229         Include config.h.
4230         (rpl_mkstemp): Rename from mkstemp.
4231         Protoize.
4232
4233 2001-11-16  Jim Meyering  <meyering@lucent.com>
4234
4235         * physmem.c [HAVE_SYS_PSTAT_H]: Include <sys/pstat.h>.
4236         (physmem_total) [HAVE_PSTAT_GETSTATIC]: If sysconf couldn't be used to
4237         determine the amount of total physical memory, use pstat_getstatic.
4238         HPUX-11 doesn't define _SC_PHYS_PAGES.
4239         (physmem_available) [HAVE_PSTAT_GETSTATIC && HAVE_PSTAT_GETDYNAMIC]:
4240         If sysconf couldn't be used to determine the amount of available
4241         physical memory, use both pstat_getstatic and pstat_getdynamic.
4242         Based on a patch from Bob Proulx.
4243
4244 2001-11-05  Jim Meyering  <meyering@lucent.com>
4245
4246         * xstat.in (slash_aware_lstat): Correct a misleading comment.
4247
4248 2001-11-03  Jim Meyering  <meyering@lucent.com>
4249
4250         * argmatch.h (ARGMATCH_TO_ARGUMENT): Remove casts of first two args
4251         in argmatch_to_argument call.
4252
4253         * dirfd.c (dirfd): Reflect the fact that DIR_TO_FD now takes an
4254         argument.
4255
4256         * hash.c (hash_clear): Fix a bug that could lead to an infloop or
4257         e.g., a fault due to an attempt to free a NULL pointer.
4258
4259 2001-11-01  Jim Meyering  <meyering@lucent.com>
4260
4261         * dirfd.c, dirfd.h: New files.
4262         * Makefile.am (libfetish_a_SOURCES): Add dirfd.h.
4263
4264         * hash.c (hash_print) [TESTING]: Clean up.
4265
4266 2001-10-22  Paul Eggert  <eggert@twinsun.com>
4267
4268         * hard-locale.c (alloca): Define to __builtin_alloca if __GNUC__,
4269         to avoid a warning if -Wall.
4270
4271 2001-10-21  Paul Eggert  <eggert@twinsun.com>
4272
4273         * regex.c (uintptr_t): Remove macro and decl; it's config.h's job.
4274
4275 2001-10-21  Jim Meyering  <meyering@lucent.com>
4276
4277         * obstack.c (_): Honor the setting of ENABLE_NLS.  Otherwise,
4278         this code would end up calling gettext even in packages built
4279         with --disable-nls.
4280         * getopt.c (_): Likewise.
4281         * regex.c (_): Likewise.
4282
4283 2001-10-20  Paul Eggert  <eggert@twinsun.com>
4284
4285         * error.c (strerror_r): Do not declare unless !_LIBC.
4286         Do not check for HAVE_DECL_STRERROR_R missing unless STRERROR_R_CHAR_P.
4287         Use strerror_r that is only a macro, even if it is not a function.
4288         (strerror): Check for HAVE_DECL_STRERROR before declaring.
4289         (private_strerror): Use prototypes, not old-style function definition.
4290         (print_errno_message): New function.
4291         Support the POSIX 'int'-flavored strerror_r, as well as the traditional
4292         char*-flavored one.
4293         (error_tail, error, error_at_line): Use it.
4294
4295 2001-10-11  Jim Meyering  <meyering@lucent.com>
4296
4297         * argmatch.c (argmatch_invalid): Use quotearg_n_style (0, ...
4298         and quote_n (1, ... to avoid clobbering a buffer.
4299
4300 2001-10-05  Jim Meyering  <meyering@lucent.com>
4301
4302         * Makefile.am: (libfetish_a_SOURCES): Add hash-pjw.c and hash-pjw.h.
4303         * hash-pjw.c: New file (factored out of fileutils' remove.c).
4304         * hash-pjw.h: New file.
4305
4306 2001-09-30  Jim Meyering  <meyering@lucent.com>
4307
4308         * mountlist.c [MOUNTED_GETFSSTAT]:
4309         Include <sys/ucred.h>, for Apple Darwin.
4310         Include sys/mount.h and sys/fs_types.h only if available.
4311         (FS_TYPE): Define.
4312         (read_filesystem_list): Use FS_TYPE.
4313
4314 2001-09-29  Paul Eggert  <eggert@twinsun.com>
4315
4316         * exclude.c (excluded_filename): 0 -> false, since it's
4317         a boolean context.
4318
4319 2001-09-28  Paul Eggert  <eggert@twinsun.com>
4320
4321         Fix bug reported by Petter Reinholdtsen for HP-UX 10.20, which
4322         #defines strtoimax.  Also treat the other strto* functions
4323         like strtoimax.
4324
4325         * xstrtol.c (strtol): Do not declare if HAVE_DECL_STRTOL.
4326         (strtoul): Do not declare if HAVE_DECL_STRTOUL.
4327         (strtoimax, strtoumax): Do not declare if already defined as a macro.
4328
4329 2001-09-26  Jim Meyering  <meyering@lucent.com>
4330
4331         Most macros in unlocked-io.h had the wrong number of arguments.
4332         * gen-uio: New script.
4333         (USE_UNLOCKED_IO): Define to 1 if not already defined.
4334         * unlocked-io.hin: Remove file.
4335         * Makefile.am (unlocked-io.h): Rewrite to use a separate script,
4336         rather than trying to embed it here.
4337         (EXTRA_DIST): Add gen-uio.  Remove unlocked-io.hin
4338         Reported by Padraig Brady.
4339
4340 2001-09-25  Volker Borchert  <bt@teknon.de>
4341
4342         * gettimeofday.c (rpl_gettimeofday): Declare local variable `result'.
4343
4344 2001-09-23  Jim Meyering  <meyering@lucent.com>
4345
4346         * mountlist.c: Remove useless parentheses in #if directives.
4347         (MOUNTED) [!defined MOUNTED]: Define to _PATH_MOUNTED, for when
4348         the deprecated MOUNTED symbol is no longer defined in mntent.h.
4349
4350 2001-09-22  Jim Meyering  <meyering@lucent.com>
4351
4352         * localcharset.c: Update from latest gettext.
4353         * config.charset: Likewise.
4354
4355 2001-09-20  Jim Meyering  <meyering@lucent.com>
4356
4357         * xstrtol.c (strtoimax): Guard declaration with
4358         `#if !HAVE_DECL_STRTOIMAX', rather than just `#ifndef strtoimax'.
4359         The latter fails because some systems (at least rs6000-ibm-aix4.3.3.0)
4360         have their own, conflicting declaration of strtoimax in sys/inttypes.h.
4361         (strtoumax): Likewise, for completeness (it wasn't necessary).
4362
4363 2001-09-06  Paul Eggert  <eggert@twinsun.com>
4364
4365         * strtoimax.c (HAVE_LONG_LONG):
4366         Redefine to HAVE_UNSIGNED_LONG_LONG if unsigned.
4367         (strtoimax): Use sizeof (long), not sizeof strtol (ptr, endptr, base),
4368         to work around bug in IBM C compiler.
4369
4370 2001-09-16  Jim Meyering  <meyering@lucent.com>
4371
4372         * mkdir.c: New file.
4373
4374 2001-09-04  Paul Eggert  <eggert@twinsun.com>
4375
4376         * xgetcwd.c: Revert some of the previous change; intead,
4377         fix the HAVE_GETCWD_NULL code to behave more like the
4378         !HAVE_GETCWD_NULL code used to.
4379
4380         Include "xalloc.h".
4381         (xgetcwd): Do not return NULL when memory is exhausted; instead,
4382         invoke xalloc_die.
4383
4384 2001-09-04  Paul Eggert  <eggert@twinsun.com>
4385
4386         * xreadlink.c (xreadlink): Omit size_t* arg.  All uses changed.
4387         Use ssize_t, not int, to store result of readlink.
4388         Check for ssize_t overflow as well as size_t overflow,
4389         as POSIX says the result of readlink is implementation-defined
4390         when ssize_t overflows.
4391         Remove unnecessary cast to char*.
4392         Use free+malloc instead of realloc, as the storage doesn't need
4393         to be preserved and it's clearer and can be more efficient that way.
4394         (SIZE_MAX, SSIZE_MAX): New macros, if <limits.h> doesn't declare.
4395         * xreadlink.h (xreadlink): Update prototype.
4396
4397 2001-09-03  Paul Eggert  <eggert@twinsun.com>
4398
4399         * exclude.c (fnmatch_no_wildcards): Fix confusion between
4400         usage of FNM_CASEFOLD and FNM_LEADING_DIR.  The bug was
4401         spotted by Jim Meyering.
4402
4403 2001-09-03  Jim Meyering  <meyering@lucent.com>
4404
4405         * xreadlink.c (xreadlink): Preserve errno around `free' during failure.
4406
4407 2001-09-03  Paul Eggert  <eggert@twinsun.com>
4408
4409         * xgetcwd.c: Fix the !HAVE_GETCWD_NULL code to behave more
4410         like the HAVE_GETCWD_NULL code.
4411         Include pathmax.h if not HAVE_GETCWD.
4412         Do not include xalloc.h.
4413         (INITIAL_BUFFER_SIZE): New symbol.
4414         Do not use xmalloc / xrealloc, since the caller is responsible for
4415         handling errors.  Preserve errno around `free' during failure.
4416         Do not overrun buffer when using getwd.
4417
4418 2001-09-03  Paul Eggert  <eggert@twinsun.com>
4419
4420         * xgetcwd.c (xgetcwd): Use HAVE_GETCWD_NULL, not (defined
4421         __GLIBC__ && __GLIBC__ >= 2), to decide whether to use getcwd (NULL, 0).
4422
4423 2001-09-02  Jim Meyering  <meyering@lucent.com>
4424
4425         * error.c: Update from GNU libc.
4426
4427 2001-09-01  Jim Meyering  <meyering@lucent.com>
4428
4429         * xreadlink.c: New file.
4430         * xreadlink.h: New file.
4431         * Makefile.am (libfetish_a_SOURCES): Add xreadlink.c and xreadlink.h.
4432
4433         * regex.c (uintptr_t) [!_LIBC]: Define to private_uintptr_t, so it
4434         doesn't conflict with sparc Solaris 7's definition in
4435         /usr/include/sys/int_types.h.
4436
4437         * exclude.c: Use `""', not `<>' to #include non-system header files.
4438         (fnmatch_no_wildcards): Rewrite not to use function names, strcasecmp
4439         and strncasecmp as r-values.  Unixware didn't have declarations.
4440
4441 2001-08-31  Jim Meyering  <meyering@lucent.com>
4442
4443         * xgetcwd.c (xgetcwd): Reorganize to avoid some duplication.
4444         Use an initial, malloc'd, buffer of length 128 rather than
4445         a statically allocated one of length 1024.
4446
4447 2001-08-30  Paul Eggert  <eggert@twinsun.com>
4448
4449         * xgetcwd.c: Don't include pathmax.h.
4450         Include stdlib.h and unistd.h if available.
4451         Include xalloc.h.
4452         (xmalloc, xstrdup, free): Remove decls.
4453         (xgetcwd): Don't assume sizes fit in unsigned.
4454         Check for overflow when computing sizes.
4455         Simplify reallocation code.
4456
4457 2001-08-28  Paul Eggert  <eggert@twinsun.com>
4458
4459         * Makefile.am (libfetish_a_SOURCES): Remove strtoxmax.c.
4460
4461         * strtoimax.c: Renamed from strtoxmax.c, removing the
4462         old strtoimax.c.
4463
4464         Also, make the following further changes to make this file's
4465         configuration more similar to that of strtol.c:
4466         (UNSIGNED): Renamed from STRTOUXMAX_UNSIGNED.  All uses changed.
4467         (strtoumax, uintmax_t, strtoull, strtol): Remove.
4468         (intmax_t, strtoimax, strtol, strtoll): New macros, if UNSIGNED.
4469         (strtoimax): Renamed from strtoumax.  All uses of unsigned values
4470         changed to signed values.
4471
4472         And make the following changes as well:
4473         Fix copyright notice, as 1999 was missing.
4474         (verify): New macro.
4475         (strtoimax): Check sizes at compile-time, not run-time.
4476         Prefer strtol to strtoll if both work.
4477         (main): Remove; it was not that useful and was a pain to maintain.
4478
4479         * strtoumax.c: Include strtoimax.c, not strtouxmax.c.
4480
4481 2001-08-30  Paul Eggert  <eggert@twinsun.com>
4482
4483         * savedir.c (savedir): Remove size parameter, as POSIX says that
4484         a directory's st_size can have an arbitrary value, so the old
4485         usage could waste an arbitrary amount of memory.  All uses
4486         changed.
4487         * savedir.h: Update prototype.
4488
4489 2001-08-30  Paul Eggert  <eggert@twinsun.com>
4490
4491         * xstrtol.c (strtoimax): New decl.
4492
4493 2001-08-28  Paul Eggert  <eggert@twinsun.com>
4494
4495         * xstrtol.h: Add copyright notice.
4496         (_DECLARE_XSTRTOL): Improve quality of diagnostic for
4497         LONGINT_INVALID_SUFFIX_CHAR.
4498
4499 2001-08-30  Paul Eggert  <eggert@twinsun.com>
4500
4501         * quotearg.c: BSD/OS 4.1 wchar.h requires FILE and struct
4502         tm to be declared.
4503
4504 2001-08-30  Paul Eggert  <eggert@twinsun.com>
4505
4506         * hash.c: Remove '2001' from copyright notice.
4507
4508 2001-08-30  Paul Eggert  <eggert@twinsun.com>
4509
4510         * full-write.h: New file.
4511         * Makefile.am (libfetish_a_SOURCES): Add full-write.h.
4512         * full-write.c: Correct credits, as cccp.c no longer
4513         exists and anyway it was so heavily changed from the old cccp
4514         code as to be unrecognizable.  Include full-write.h.
4515         (full_write) Return size_t, with short writes meaning failure.
4516         All callers changed.  This fixes a bug with large buffers
4517         on 64-bit hosts.
4518         * utime.c: Include full-write.h.
4519
4520 2001-08-30  Paul Eggert  <eggert@twinsun.com>
4521
4522         Merge 'exclude' changes from tar 1.13.22.
4523         This fixes one or two unlikely storage allocation overflow bugs,
4524         but doesn't change user-visible behavior otherwise.
4525
4526 2001-08-30  Paul Eggert  <eggert@twinsun.com>
4527
4528         * exclude.c (bool): Declare, perhaps by including stdbool.h.
4529         (<sys/types.h>): Include only if HAVE_SYS_TYPES_H.
4530         (<stdlib.h>, <string.h>, <strings.h>, <inttypes.h>, <stdint.h>):
4531         Include if available.
4532         (<xalloc.h>): Include
4533         (SIZE_MAX): Define if <stdint.h> or <inttypes.h> doesn't.
4534         (verify): New macro.  Use it to verify that EXCLUDE macros do not
4535         collide with FNM macros.
4536         (struct patopts): New struct.
4537         (struct exclude): Use it, as exclude patterns now come with options.
4538         (new_exclude): Support above changes.
4539         (new_exclude, add_exclude_file):
4540         Initial size must now be a power of two to simplify overflow checking.
4541         (free_exclude, fnmatch_no_wildcards): New function.
4542         (excluded_filename): No longer requires options arg, as the options
4543         are determined by add_exclude.  Now returns bool, not int.
4544         (excluded_filename, add_exclude):
4545         Add support for the fancy new exclusion options.
4546         (add_exclude, add_exclude_file): Now takes int options arg.
4547         Check for arithmetic overflow when computing sizes.
4548         (add_exclude_file): xrealloc might modify errno, so don't
4549         realloc until after errno might be used.
4550
4551         * exclude.h (EXCLUDE_ANCHORED, EXCLUDE_INCLUDE,EXCLUDE_WILDCARDS):
4552         New macros.
4553         (free_exclude): New decl.
4554         (add_exclude, add_exclude_file): Now takes int options arg.
4555         (excluded_filename): No longer requires options arg, as the options
4556         are determined by add_exclude.  Now returns bool, not int.
4557
4558 2001-08-30  Paul Eggert  <eggert@twinsun.com>
4559
4560         * alloca.c (alloca): Arg is of type size_t, not unsigned.
4561
4562 2001-08-27  Jim Meyering  <meyering@lucent.com>
4563
4564         * Makefile.am (libfetish_a_SOURCES): Add strtoxmax.c
4565
4566         * version-etc.c (N_): Remove definition.
4567         Revert most of last change.
4568         Instead, simply don't mark the `Copyright...' string for translation.
4569         Based on advice from Paul Eggert.
4570
4571         * strtoxmax.c: Tweak comment.
4572
4573 2001-08-26  Jim Meyering  <meyering@lucent.com>
4574
4575         * version-etc.c (version_etc_copyright_fmt): Replace literal year
4576         of copyright with `%s' so translators don't get an untranslated
4577         message in 2002.
4578         (COPYRIGHT_YEAR): Define.
4579         (version_etc): Use fprintf rather than fputs.
4580         Suggestion from Ulrich Drepper.
4581
4582         * Makefile.am (libfetish_a_SOURCES): Add xstrtoimax.c.
4583
4584         * strtoll.c: New file, from GNU libc.
4585         * xstrtoimax.c: New file.
4586
4587         * xstrtol.h: Add xstrtoimax.
4588         * strtoumax.c: New file.  Simply include "strtoumax.c".
4589         * strtoimax.c: New file.  Likewise, but first define STRTOUXMAX_SIGNED.
4590
4591         * strtoumax.c: Factor to work both for unsigned and signed types, ...
4592         * strtoxmax.c: ... then renamed to this.
4593
4594 2001-08-13  Paul Eggert  <eggert@twinsun.com>
4595
4596         * Makefile.am (unlocked-io.h): Do not append "_unlocked" twice.
4597         Port to Solaris 8, where 'sed' requires a space after the 'r'
4598         command, and where sh dislikes "$/".  Clean up the spacing a bit.
4599         Redirect output to $tmp just once.
4600
4601 2001-08-12  Paul Eggert  <eggert@sic.twinsun.com>
4602
4603         * addext.c (<errno.h>): Include.
4604         (errno): Declare if not defined.
4605         (addext): Work correctly when pathconf returns -1 and leaves
4606         errno alone because there is no limit.  Also, work even if
4607         pathconf returns a value greater than SIZE_MAX.
4608
4609 2001-08-12  Jim Meyering  <meyering@lucent.com>
4610
4611         * xgetcwd.c (xgetcwd) [defined __GLIBC__ && __GLIBC__ >= 2]:
4612         Simply `return getcwd (NULL, 0);'.
4613         [! (defined __GLIBC__ && __GLIBC__ >= 2)]:
4614         Use 1300 as initial value for length, not PATH_MAX.
4615
4616         * pathmax.h: Clean up cpp syntax.
4617
4618 2001-08-12  Jim Meyering  <meyering@lucent.com>
4619
4620         * gettimeofday.c: New file.
4621         * gtod.h: New file.
4622         * Makefile.am (libfetish_a_SOURCES): Add gtod.h.
4623
4624 2001-08-04  Jim Meyering  <meyering@lucent.com>
4625
4626         * error.h (__attribute__): Remove `|| __STRICT_ANSI__' from #if stmt,
4627         to get in sync with glibc.
4628
4629 2001-08-03  Paul Eggert  <eggert@twinsun.com>
4630
4631         The following changes are from gettext 0.10.39 as maintained by
4632         Bruno Haible.
4633
4634         * mbswidth.h (MBSW_REJECT_UNPRINTABLE, MBSW_REJECT_INVALID):
4635         Renamed from MBSW_ACCEPT_UNPRINTABLE and MBSW_ACCEPT_INVALID
4636         with inverted sense.  All uses changed.
4637
4638         * mbswidth.c: Don't include <limits.h>.
4639         Include <stdlib.h> and <string.h> unconditionally.
4640         (iswcntrl, mbsinit, ISCNTRL): New macros.
4641         (mbsnwidth): Use K&R style function declarations.
4642         Don't bother checking for MB_LEN_MAX == 1, since the compiler
4643         can optimize it when MB_CUR_MAX == 1.
4644         The width of control characters is zero, not 1.
4645
4646 2001-07-15  Jim Meyering  <meyering@lucent.com>
4647
4648         * Makefile.am (EXTRA_DIST): Add unlocked-io.hin.
4649         (BUILT_SOURCES): Add unlocked-io.h.
4650         (io_functions): Define.
4651         (unlocked-io.h): New rule.
4652         (DISTCLEANFILES): Add unlocked-io.h.
4653         (all-local): Depend on unlocked-io.h, to ensure it is created.
4654
4655         * unlocked-io.hin: New file
4656
4657         * regex.c: Update from glibc.
4658
4659 2001-07-05  Jim Meyering  <meyering@lucent.com>
4660
4661         * Makefile.am (noinst_HEADERS): Remove definition, per new automake
4662         recommendation.
4663         (libfetish_a_SOURCES): Put all .h files here instead.
4664         Remove a thus-exposed (better checks in automake) duplicate and
4665         two unnecessary .h files.
4666
4667 2001-06-11  Jim Meyering  <meyering@lucent.com>
4668
4669         * regex.c: Update from GNU libc.
4670
4671 2001-05-27  Jim Meyering  <meyering@lucent.com>
4672
4673         * readutmp.h (UT_TYPE): Define.
4674
4675 2001-05-24  Jim Meyering  <meyering@lucent.com>
4676
4677         * argmatch.c: Include "quote.h".
4678         (argmatch_invalid): Remove explicit `' quotes.  Instead, use the
4679         quote function.  Reported by Göran Uddeborg.
4680
4681 2001-05-20  Alexandre Duret-Lutz  <duret_g@epita.fr>
4682
4683         * dirname.c (dir_name): Compute append_dot using path, not newpath
4684         which is not yet declared.
4685
4686 2001-05-11  Paul Eggert  <eggert@twinsun.com>
4687
4688         * Makefile.am (libfetish_a_SOURCES):
4689         Add strftime.c, since we now compile it on all hosts.
4690
4691         * strftime.c (my_strftime):
4692         Define to nstrftime if emacs, but only if my_strftime is not defined.
4693         (extra_args, extra_args_spec, extra_args_spec_iso): Rename from
4694         ut_argument, ut_argument_spec, ut_argument_spec_iso, respectively.
4695         Add one more extra argument: a nanoseconds value.
4696         All uses changed.
4697         (ns): New macro.
4698         (my_strftime function): Add %N format.
4699         (emacs_strftimeu): Renamed from emacs_strftime,
4700         with extra ut argument.
4701
4702 2001-05-11  Paul Eggert  <eggert@twinsun.com>
4703
4704         dirname code cleanup.  base_name now behaves more compatibly
4705         with POSIX basename when given file names that have trailing
4706         slashes, and similarly for dir_name.  Add new primitives
4707         base_len and dir_len.  Put the directory-name-related decls
4708         into dirname.h.
4709
4710         * addext.c (ISSLASH, base_name): Remove; now in dirname.h.
4711         * backupfile.c (base_name): Likewise.
4712         * basename.c (FILESYSTEM_PREFIX_LEN, PARAMS, ISSLASH): Likewise.
4713         * dirname.c (FILESYSTEM_PREFIX_LEN, ISSLASH): Likewise.
4714         * makepath.c (strip_trailing_slashes): Likewise.
4715         * path-concat.c (DIRECTORY_SEPARATOR, FILESYSTEM_PREFIX_LEN, ISSLASH):
4716         Likewise.
4717         * rename.c (strip_trailing_slashes): Likewise.
4718         * same.c (base_name): Likewise.
4719         * stripslash.c (ISSLASH): Likewise.
4720
4721         * addext.c: Include <dirname.h> after size_t is defined.
4722         * backupfile.c: Likewise.
4723
4724         * addext.c (addext): Use base_len to trim redundant
4725         trailing slashes instead of doing it ourselves.
4726         But do not trim the last slash if it is not redundant.
4727
4728         * backupfile.c (find_backup_file_name,
4729         max_backup_version): Use base_len instead of rolling it ourselves.
4730         Handle the case of "" and (on DOS) "C:" correctly.
4731
4732         * basename.c: Do not include <stdio.h>, <assert.h>; no longer needed.
4733         Include <string.h>, <dirname.h>.
4734         (base_name): Allow file names ending in slashes, other than names
4735         that are all slashes.  In this case, return the basename followed
4736         by the slashes.  This is more general, and can be used in places
4737         where the original base_name purposely had an assertion failure.
4738         (base_len): New function.
4739
4740         * dirname.c: Include <string.h> instead of <stdlib.h>.
4741         Do not include <assert.h>; no longer needed.
4742         Include xalloc.h.
4743         (memrchr): Remove decl.
4744         (dir_name_r): Remove.
4745         (dir_len): Renamed from dirlen.  All callers changed.
4746         Rewrite in terms of base_name, for simplicity and consistency.
4747         (dir_name): Never return NULL.  All callers changed.
4748         Do not include <stdlib.h> in test program; no longer needed.
4749         return 0; is fine for test program.
4750
4751         * dirname.h (DIRECTORY_SEPARATOR, ISSLASH, FILESYSTEM_PREFIX_LEN):
4752         New macros.
4753         (base_name, base_len, dir_len, strip_trailing_slashes): New decls.
4754
4755         * path-concat.c (path_concat): Use base_len to compute
4756         base length, not strlen; this means we cannot rely on memcpy
4757         to null-terminate.
4758
4759         * same.c (STREQ): Remove.
4760         (same_name): Handle the case where the basename ends in trailing '/'.
4761
4762         * stripslash.c (strip_trailing_slashes): Return nonzero if
4763         a slash was stripped.  Do not strip the last slash after a
4764         file system prefix.
4765
4766 2001-04-08  Jim Meyering  <meyering@lucent.com>
4767
4768         * getdate.y (get_date): Set tm_isdst to -1 to ensure that it is
4769         recomputed; that's necessary when the offset spans a DST transition.
4770         Patch by David J. MacKenzie.  Reported by Hon-Yin Kok.
4771
4772 2001-04-02  Jim Meyering  <meyering@lucent.com>
4773
4774         * regex.h, regex.c: Update from GNU libc.
4775
4776 2001-03-19  Paul Eggert  <eggert@twinsun.com>
4777
4778         * version-etc.c (version_etc_copyright): Update to 2001.
4779
4780 2001-03-16  Paul Eggert  <eggert@twinsun.com>
4781
4782         * tempname.c (uint64_t): Define to uintmax_t if
4783         not defined, and if UINT64_MAX is not defined.
4784         Required at least for Vax Ultrix4.3, which doesn't define uint64_t.
4785         Reported by John David Anglin.
4786
4787 2001-03-10  Bruno Haible  <haible@clisp.cons.org>
4788
4789         * localcharset.c (locale_charset): Allow wildcard syntax. Also resolve
4790         alias if codeset is empty.
4791         * config.charset (BeOS): Use wildcard syntax.
4792
4793 2001-03-13  Jim Meyering  <meyering@lucent.com>
4794
4795         * path-concat.c (path_concat) [FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX]:
4796         Don't insert a backslash when concatenating e.g., `C:' and `foo'.
4797         From Bruno Haible.
4798
4799 2001-03-06  Bruno Haible  <haible@clisp.cons.org>
4800
4801         * localcharset.c (locale_charset): Don't use setlocale(LC_CTYPE,NULL).
4802         Don't return NULL.
4803         * unicodeio.c (print_unicode_char): Simplify accordingly.
4804
4805 2001-03-06  Bruno Haible  <haible@clisp.cons.org>
4806
4807         * config.charset: Update for FreeBSD 4.2 and OSF/1 5.1. Add
4808         support for DOS/DJGPP.
4809
4810 2001-02-28  Paul Eggert  <eggert@twinsun.com>
4811
4812         * Makefile.am (libfetish_a_SOURCES):
4813         Add dup-safer.c, fopen-safer.c.
4814         (noinst_HEADERS): Add stdio-safer.h, unistd-safer.h.
4815
4816         * dup-safer.c, fopen-safer.c, stdio-safer.h, unistd-safer.h: New files.
4817
4818 2001-02-25  Paul Eggert  <eggert@twinsun.com>
4819
4820         The mkstemp replacement is taken from glibc 2.2.2, with some
4821         portability fixes for use outside glibc, as follows:
4822
4823         * tempname.c (struct_stat64): New macro.
4824         (direxists, __gen_tempname): Use it.
4825         This avoids a portability problem with Solaris 8.
4826
4827         * tempname.c (<config.h>): Include if HAVE_CONFIG_H.
4828         (<stddef.h>, <stdint.h>, <string.h>):
4829         Include only if STDC_HEADERS || _LIBC.
4830         (<fcntl.h>): Include only if HAVE_FCNTL_H || _LIBC.
4831         (<unistd.h>): Include only if HAVE_UNISTD_H || _LIBC.
4832         (<sys/time.h>): Include only if HAVE_SYS_TIME_H || _LIBC.
4833         (__set_errno): Define this macro if <errno.h> doesn't.
4834         (P_tmpdir, TMP_MAX, __GT_FILE, __GT_BIGFILE, __GT_DIR, __GT_NOCREATE):
4835         Define these macros if <stdio.h> doesn't.
4836         (S_ISDIR, S_IRUSR, S_IWUSR, S_IXUSR):
4837         Define these macros if <sys/stat.h>
4838         doesn't.  Ignore <sys/stat.h> S_ISDIR if STAT_MACROS_BROKEN.
4839         (stat64, __getpid, __gettimeofday, __mkdir, __open, __open64, lxstat64,
4840         __xstat64): Define if not _LIBC.
4841         (__secure_getenv): Define if ! (HAVE___SECURE_GETENV || _LIBC).
4842         (__gen_tempname): Invoke gettimeofday only if
4843         HAVE_GETTIMEOFDAY || _LIBC;
4844         otherwise, fall back on plain "time".
4845         Use macros like S_IRUSR | S_IWUSR rather than octal values like 0600.
4846
4847         * mkstemp.c (__GT_FILE): Define to zero if not defined.
4848
4849         * mkstemp.c, tempname.c: New files, taken from glibc 2.2.2.
4850
4851 2001-02-17  Jim Meyering  <meyering@lucent.com>
4852
4853         * strtoul.c: Sync from GNU libc.  Use double quotes, not <...>
4854         around included file name.
4855
4856         * strnlen.c (__strnlen): Merge in a change from GNU libc.
4857
4858         * strftime.c: Update from GNU libc (the only changes were to comments).
4859
4860 2001-02-13  Bruno Haible  <haible@clisp.cons.org>
4861
4862         * mbswidth.h (mbswidth): Also define as macro, to avoid prototype clash.
4863
4864 2001-02-17  Paul Eggert  <eggert@twinsun.com>
4865
4866         * mbswidth.c, quotearg.c (mbrtowc, mbsinit):
4867         Remove workaround macros for hosts that have mbrtowc but not
4868         mbstate_t, as we now insist on proper declarations for both
4869         before using mbrtowc.
4870
4871 2001-02-17  Jim Meyering  <meyering@lucent.com>
4872
4873         * regex.c: Update from libc.
4874
4875 2001-02-16  Paul Eggert  <eggert@twinsun.com>
4876
4877         * alloca.c (malloc): Undef before defining, since stdlib.h
4878         may have defined it.  Needed for Encore Umax-3.0.9.16b systems.
4879         Reported by Mark Hounschell via Paul Eggert.
4880
4881 2001-01-30  Bruno Haible  <haible@clisp.cons.org>
4882
4883         * config.charset: Update for FreeBSD 4.2.
4884
4885 2001-01-26  Jim Meyering  <meyering@lucent.com>
4886
4887         * quotearg.c: Include stddef.h.
4888         * quote.c: Include stddef.h.
4889         Reported by Axel Kittenberger.
4890
4891         * xmalloc.c [HAVE_DONE_WORKING_MALLOC_CHECK]: Enclose error-evoking
4892         line in double quotes so that it evokes a better diagnostic.
4893         [HAVE_DONE_WORKING_REALLOC_CHECK]: Likewise.
4894         Reported by Axel Kittenberger.
4895
4896 2001-01-15  Bruno Haible  <haible@clisp.cons.org>
4897
4898         * unicodeio.c (print_unicode_char): Cast the second iconv() arg,
4899         to avoid a warning.  Add back 'const' to inptr.
4900
4901 2001-01-16  Jim Meyering  <meyering@lucent.com>
4902
4903         * basename.c: Include <stdio.h>, needed by assert on SunOS 4.
4904         From Bruno Haible.
4905
4906 2001-01-14  Jim Meyering  <meyering@lucent.com>
4907
4908         * rename.c: New file.  From Volker Borchert.
4909         Include stdlib.h, string.h or strings.h, and xalloc.h.
4910         Use strip_trailing_slashes rather than open-coding it.
4911
4912 2001-01-03  Paul Eggert  <eggert@twinsun.com>
4913
4914         * strftime.c: Sync with glibc time/strftime.c 1.81.
4915
4916 2001-01-03  Jim Meyering  <meyering@lucent.com>
4917
4918         * unicodeio.c (print_unicode_char): Remove `const' from declaration of
4919         local `inptr' to avoid warning with some system declarations of iconv.
4920
4921 2000-12-29  Paul Eggert  <eggert@twinsun.com>
4922
4923         * modechange.c: Do not assume that mode_t uses the
4924         traditional octal encoding.  E.g. "chmod 1 FOO" should set
4925         the other-execute bit of FOO even if S_IXOTH != 1.
4926
4927         (SUID, SGID, SVTX, RUSR, WUSR, XUSR, RGRP, WGRP, XGRP, ROTH,
4928         WOTH, XOTH, ALLM): New macros.
4929         (S_ISUID, S_ISGID, S_ISVTX, S_IRUSR, S_IWUSR, S_IXUSR,
4930          S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH, S_IXOTH):
4931         Use them.
4932         (S_ISGID): Fix typo; it was defaulting to the same value as S_ISUID.
4933         (S_IRWXU, S_IRWXG, S_IRWXO): Specify defaults in terms of the above.
4934         (mode_compile):
4935         No need to use uintmax_t; unsigned long is long enough.
4936         Don't bother to get suffix since we don't use it.
4937
4938 2000-12-24  Jim Meyering  <meyering@lucent.com>
4939
4940         * hash.c (is_prime): Return explicit boolean values.
4941         (hash_get_first): Return NULL to appease Irix5.6's 89.
4942         Reported by Nelson Beebe.
4943
4944 2000-10-31  Bruno Haible  <haible@clisp.cons.org>
4945
4946         * localcharset.c (locale_charset): Add support for Win32.
4947
4948 2000-12-18  Paul Eggert  <eggert@twinsun.com>
4949
4950         * physmem.h, physmem.c: New files.
4951
4952         * Makefile.am (libfetish_a_SOURCES): Add physmem.c.
4953         (noinst_HEADERS): Add physmem.h.
4954
4955         * xstrtol.c (__xstrtol): Add undocumented suffixes 'g' and
4956         't' for compatibility with Solaris 8 sort.
4957
4958 2000-12-18  Bruno Haible  <haible@clisp.cons.org>
4959
4960         * config.charset: Add support for BeOS.
4961
4962 2000-12-16  Jim Meyering  <meyering@lucent.com>
4963
4964         * getusershell.c [!SHELLS_FILE && __DJGPP__]: Define
4965         SHELLS_FILE to a file name that's useful on djgpp systems.
4966         Include stdlib.h.
4967         (ADDITIONAL_DEFAULT_SHELLS): Define.
4968         (default_shells): Prepend ADDITIONAL_DEFAULT_SHELLS.
4969         Based mostly on a patch from Prashant TR.
4970
4971 2000-12-16  Jim Meyering  <meyering@lucent.com>
4972
4973         This bug had a serious impact on chown: `chown N:M FILE' (for integer
4974         N and M) would have treated it like `chown N:N FILE'.
4975
4976         * userspec.c (parse_user_spec): Fix typo: s/u/g/.
4977
4978 2000-10-31  Bruno Haible  <haible@clisp.cons.org>
4979
4980         * config.charset: Add ISO-8859-3, BIG5HKSCS, GB18030, JOHAB, VISCII,
4981         CP874, CP949, CP950, CP1250, CP1253, CP1254, CP1255, CP1256, CP1257
4982         to the list of canonical encodings. Rename EUC-CN to GB2312.
4983
4984 2000-12-08  Andreas Schwab  <schwab@suse.de>
4985
4986         * mbswidth.c (mbsnwidth): Don't loop endlessly when called with an
4987         invalid mulitbyte sequence and with the MBSW_ACCEPT_INVALID flag set.
4988
4989 2000-12-07  Jim Meyering  <meyering@lucent.com>
4990
4991         * stripslash.c (ISSLASH): Define.
4992         (strip_trailing_slashes): Use ISSLASH rather than comparing against `/'.
4993         From Prashant TR.
4994
4995         * dirname.c (FILESYSTEM_PREFIX_LEN): Define.
4996         (dir_name_r): Declare this function as static.
4997         [BACKSLASH_IS_PATH_SEPARATOR]: Fix a bug that'd
4998         manifest itself on a name containing a mix of slashes and
4999         backslashes.
5000         Make this function work with names starting with a DOS-style
5001         drive letter and colon prefix.
5002         (dir_name): Append `.' if necessary.
5003         Based mostly on patches from Prashant TR and Eli Zaretskii.
5004
5005         * dirname.h (dir_name_r): Remove prototype.
5006
5007 2000-12-05  Jim Meyering  <meyering@lucent.com>
5008
5009         * dirname.c (dir_name_r): Add `const' in a few local declarations.
5010
5011 2000-12-04  Jim Meyering  <meyering@lucent.com>
5012
5013         * path-concat.c: [!HAVE_DECL_MALLOC]: Declare malloc.
5014         Also include memory.h, stdlib.h, unistd.h if appropriate.
5015         Reported by Andreas Jaeger (conflicting declaration of malloc).
5016
5017 2000-12-02  Jim Meyering  <meyering@lucent.com>
5018
5019         * closeout.h: Make idempotent, to avoid some obscure warnings.
5020
5021 2000-12-01  Paul Eggert  <eggert@twinsun.com>
5022
5023         * memrchr.c: Include <config.h> before any system include file.
5024
5025 2000-11-29  Paul Eggert  <eggert@twinsun.com>
5026
5027         * dirname.c (dir_name_r): Fix typo: int -> size_t.
5028
5029 2000-11-26  Jim Meyering  <meyering@lucent.com>
5030
5031         * memcoll.c: Include sys/types.h.  From Werner Almesberger.
5032
5033 2000-11-22  Paul Eggert  <eggert@twinsun.com>
5034
5035         * strftime.c (my_strftime): Do not invoke mbrlen with a
5036         size of (size_t) -1; it's not portable.
5037
5038 2000-11-17  Akim Demaille  <akim@epita.fr>
5039
5040         * obstack.h: Formatting changes.
5041         (obstack_grow, obstack_grow0): Don't cast WHERE at all: that would
5042         prevent type checking.
5043         (obstack_ptr_grow, obstack_ptr_grow_fast): When assigning, don't
5044         cast the value to (void *): assigning a `foo *' to a `void *'
5045         variable is valid.
5046         (obstack_int_grow, obstack_int_grow_fast): Don't cast AINT to int.
5047
5048 2000-11-17  Jim Meyering  <meyering@lucent.com>
5049
5050         * strstr.c: Update from GNU libc.
5051
5052 2000-11-16  Jim Meyering  <meyering@lucent.com>
5053
5054         * strverscmp.c: Incorporate weak-alias-related changes from glibc.
5055
5056 2000-11-11  Jim Meyering  <meyering@lucent.com>
5057
5058         * error.c: Add a couple #includes, merging from GNU libc version.
5059
5060 2000-11-10  Jim Meyering  <meyering@lucent.com>
5061
5062         * obstack.h: Update from GNU libc.
5063         * obstack.c: Likewise.
5064
5065 2000-11-06  Paul Eggert  <eggert@twinsun.com>
5066
5067         * getusershell.c (setusershell): Use rewind rather than
5068         fseek/fseeko, to avoid configuration hassles with fseeko.
5069         Don't bother opening SHELLS_FILE if shellstream is NULL;
5070         it's not necessary.
5071
5072 2000-11-05  Jim Meyering  <meyering@lucent.com>
5073
5074         * makepath.h (make_dir): Declare.
5075         * makepath.c (make_dir): Remove `static' attribute.
5076         Tweak a comment.
5077
5078 2000-11-04  Alexandre Duret-Lutz  <duret_g@epita.fr>
5079
5080         * hash.c (hash_get_next): Fix a thinko:  when ENTRY is the
5081         last one in a bucket, advance to the next bucket.
5082
5083 2000-11-02  Vesselin Atanasov  <vesselin@bgnet.bg>
5084
5085         * fnmatch.c: Do not comment out all the code if we are using
5086         the GNU C library, because in some cases we are replacing buggy
5087         code in the GNU C library itself.
5088
5089 2000-10-30  Paul Eggert  <eggert@twinsun.com>
5090
5091         * error.h, getline.h, modechange.h:
5092         Remove "2000" from Copyright line, as the file hasn't been
5093         changed this year other than in the copyright notice.
5094
5095         * xalloc.h: Add "2000" to Copyright line, as this file
5096         was changed this year.
5097
5098 2000-10-30  Paul Eggert  <eggert@twinsun.com>
5099
5100         * fnmatch.c (FOLD): Do not assume that characters are unsigned.
5101         (fnmatch): Fix some FNM_FILE_NAME and FNM_LEADING_DIR bugs,
5102         e.g. fnmatch("d*/*1", "d/s/1", FNM_FILE_NAME) incorrectly yielded zero.
5103
5104 2000-10-29  Greg Louis  <glouis@dynamicro.on.ca>
5105
5106         * regex.h (__restrict_arr): Move definition out of #ifndef block.
5107         Required because egcs-2.91.66 (aka 1.1.2) defines __restrict, but
5108         doesn't define __restrict_arr.
5109
5110 2000-10-29  Jim Meyering  <meyering@lucent.com>
5111
5112         * xstat.in: Fix grammar in comment.
5113
5114 2000-10-28  Jim Meyering  <meyering@lucent.com>
5115
5116         * memchr.c: Update from libc.
5117         Adjust for portability:
5118         [HAVE_STDLIB_H]: Include stdlib.h.
5119         [HAVE_BP_SYM_H || _LIBC]: Guard inclusion of bp-sym.h.
5120         Undef __memchr, too.
5121         [!weak_alias]: Define __memchr to memchr.
5122
5123         * regex.c: Update from libc.
5124         * regex.h: Likewise.
5125         * getopt1.c: Likewise.
5126         * memcmp.c: Likewise.
5127
5128         * getusershell.c (setusershell) [HAVE_FSEEKO]: Use fseeko.
5129         Avoid using fseek, when possible -- it's broken by design.
5130         Patch by Ulrich Drepper.
5131
5132 2000-10-26  Jim Meyering  <meyering@lucent.com>
5133
5134         * strftime.c: Update from libc.
5135
5136 2000-10-25  Jim Meyering  <meyering@lucent.com>
5137
5138         * obstack.c: Update from libc.
5139
5140 2000-10-23  Jim Meyering  <meyering@lucent.com>
5141
5142         * hard-locale.c (hard_locale): Revert last change -- it was simply
5143         wrong.  That set_locale call must not have any side effects.
5144         From Paul Eggert.
5145
5146 2000-10-22  Jim Meyering  <meyering@lucent.com>
5147
5148         * md5.c (md5_process_block) [OP]: Use `rol', not CYCLIC.
5149         [CYCLIC]: Remove now-unused definition.
5150
5151         * save-cwd.c (O_DIRECTORY): Define, if needed.
5152         (save_cwd) [HAVE_FCHDIR]: Use O_DIRECTORY when opening ".".
5153         Suggestion from Ulrich Drepper.
5154
5155 2000-10-21  Jim Meyering  <meyering@lucent.com>
5156
5157         * dirname.c (dir_name_r): New function, factored out of dir_name.
5158         (dir_name): Use dir_name_r.
5159         * dirname.h (dir_name_r): Declare it.
5160
5161 2000-10-21  Jim Meyering  <meyering@lucent.com>
5162
5163         * dirname.c (memrchr): Declare if necessary.
5164         (dir_name): Remove the restriction that there be no
5165         trailing slashes.  Now, this code skips past them, effectively
5166         ignoring them.
5167         [TEST_DIRNAME] (main): New unit tests.
5168
5169         * memrchr.c: New file from GNU libc.
5170         Undef __memrchr, too.
5171         [!weak_alias]: Define __memrchr to memrchr.
5172         Guard weak_alias use with `#ifdef weak_alias'.
5173
5174 2000-10-17  Jim Meyering  <meyering@lucent.com>
5175
5176         * quote.h (PARAMS): Define and use.
5177         Reported by Akim Demaille.
5178
5179         * getopt.c: Update from libc.
5180
5181 2000-10-16  Jim Meyering  <meyering@lucent.com>
5182
5183         * hard-locale.c (hard_locale): Use "", not 0 as 2nd arg to setlocale.
5184         From Jan Fedak.
5185
5186 2000-09-25  Jim Meyering  <meyering@lucent.com>
5187
5188         * md5.h (rol): Define (from GnuPG).
5189
5190         * sha.c: Give credit (GnuPG) where due.
5191         (M): Use rol rather than open-coding it.
5192         Add a FIXME comment.
5193
5194 2000-09-21  Jim Meyering  <meyering@lucent.com>
5195
5196         * userspec.c (parse_user_spec): Remove debugging printf I'd added.
5197         Reported by Michael Stone.
5198
5199 2000-09-20  Jim Meyering  <meyering@lucent.com>
5200
5201         * Makefile.am (libfetish_a_SOURCES): Add sha.c.
5202         (noinst_HEADERS): Add sha.h.
5203         Based on code from Scott G. Miller and from GnuPG.
5204
5205 2000-09-15  Jim Meyering  <meyering@lucent.com>
5206
5207         * regex.c: Update from libc.
5208
5209 2000-09-10  Jim Meyering  <meyering@lucent.com>
5210
5211         * getopt.c (_getopt_internal): Update from glibc.
5212
5213 2000-09-09  Jim Meyering  <meyering@lucent.com>
5214
5215         * quotearg.c: Rename ISASCII to IN_CTYPE_DOMAIN, so people don't
5216         think it should be used as a general replacement for isascii.
5217         * fnmatch.c: Likewise.
5218         * mbswidth.c: Likewise
5219         * regex.c: Likewise.
5220
5221         Don't use atoi.
5222         * userspec.c: Include sys/param.h and limits.h.
5223         Include xstrtol.h.
5224         (CHAR_BIT, TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM): Define.
5225         (UID_T_MAX, GID_T_MAX, MAXUID, MAXGID): Define.
5226         (parse_user_spec): Use xstrtoul, not atoi when converting numeric
5227         UID, GID.  Check range.
5228
5229 2000-09-06  Jim Meyering  <meyering@lucent.com>
5230
5231         * getopt.c (_getopt_internal): Update from glibc.
5232
5233 2000-08-30  Jim Meyering  <meyering@lucent.com>
5234
5235         * strftime.c: Merge in changes from GNU libc.
5236
5237 2000-08-26  Jim Meyering  <meyering@lucent.com>
5238
5239         * closeout.c: Include "__fpending.h".
5240         (close_stdout_status): Return right away if there's nothing to flush.
5241
5242         * Makefile.am (noinst_HEADERS): Add __fpending.h.
5243         * __fpending.c: New file.
5244         * __fpending.h: New file.
5245
5246 2000-08-07  Paul Eggert  <eggert@twinsun.com>
5247
5248         Standardize on "memory exhausted" instead of "Memory exhausted"
5249         or "virtual memory exhausted".
5250         * obstack.c (print_and_abort): Use "memory exhausted", not
5251         "virtual memory exhausted".
5252         * same.c (same_name): Invoke xalloc_die instead of printing
5253         our own message.
5254         * userspec.c (parse_user_spec): Likewise.
5255         * bumpalloc.h: comment fix
5256         * same.c, userspec.c: Include xalloc.h.
5257
5258         * xalloc.h (xalloc_msg_memory_exhausted): Now char const[],
5259         not char *const and pointing to a constant array.
5260         * xmalloc.c (xalloc_msg_memory_exhausted): Likewise.
5261         (xrealloc): Comment fix.
5262
5263         * userspec.c (parse_user_spec):
5264         Don't translate a message until just before returning,
5265         to avoid unnecessary translation.
5266
5267 2000-08-07  Jim Meyering  <meyering@lucent.com>
5268
5269         * addext.c, argmatch.c, argmatch.h, backupfile.h, bumpalloc.h,
5270         chown.c, diacrit.h, dirname.h, dup2.c, exclude.h, fileblocks.c,
5271         fnmatch.c, fnmatch.h, fsusage.c, fsusage.h, getdate.h,
5272         getgroups.c, gethostname.c, getopt.h, group-member.c,
5273         hard-locale.c, hash.h, isdir.c, lchown.c, linebuffer.c,
5274         linebuffer.h, long-options.h, malloc.c, md5.c, md5.h, memchr.c,
5275         memcmp.c, memcoll.c, memset.c, mktime.c, modechange.h, obstack.h,
5276         pathmax.h, realloc.c, rmdir.c, safe-read.c, save-cwd.c, stime.c,
5277         stpcpy.c, strcasecmp.c, strcspn.c, strdup.c, stripslash.c,
5278         strstr.c, strtod.c, strtol.c, strtoul.c, strtoull.c, strtoumax.c,
5279         utime.c, version-etc.h, xalloc.h, xstrdup.c, xstrtoumax.c,
5280         yesno.c: Back out Copyright date changes for each file with no change
5281         this year.  This eases coordination with other programs using the same
5282         source code modules.  From Paul Eggert.
5283
5284 2000-08-03  Greg McGary  <greg@mcgary.org>
5285
5286         * regex.c (SET_HIGH_BOUND, MOVE_BUFFER_POINTER,
5287         ELSE_EXTEND_BUFFER_HIGH_BOUND): New macros.
5288         (EXTEND_BUFFER): Use them.
5289
5290 2000-08-01  Jim Meyering  <meyering@lucent.com>
5291
5292         * dirname.c (ISSLASH): Define.
5293         (BACKSLASH_IS_PATH_SEPARATOR): Define.
5294         (dir_name) [BACKSLASH_IS_PATH_SEPARATOR]: Handle the case in which
5295         both `\' and `/' may be use as path separators.
5296         Based on a patch from Prashant TR.
5297
5298 2000-07-31  Paul Eggert  <eggert@twinsun.com>
5299
5300         * quotearg.c (quotearg_n_options): Don't make the initial
5301         slot vector a constant, since it might get modified.
5302
5303 2000-07-31  Jim Meyering  <meyering@lucent.com>
5304
5305         * xmalloc.c: Use `virtual memory exhausted', not `Memory exhausted'.
5306         * obstack.c (print_and_abort): Likewise.
5307
5308 2000-07-30  Paul Eggert  <eggert@twinsun.com>
5309
5310         * quotearg.c (quotearg_n_options): Preallocate a slot 0
5311         buffer, so that the caller can always quote one small
5312         component of a "memory exhausted" message in slot 0.
5313         From a suggestion by Jim Meyering.
5314
5315 2000-07-30  Jim Meyering  <meyering@lucent.com>
5316
5317         * makepath.c (make_path): Quote the other instance, too.
5318
5319         * quotearg.c (N_STATIC_SLOTVECS): Define.
5320         (STATIC_BUF_SIZE): Define.
5321         (quotearg_n_options): Use only statically allocated storage when
5322         N < N_STATIC_SLOTVECS and the length of the quoted result is smaller
5323         than STATIC_BUF_SIZE.
5324
5325 2000-07-29  Jim Meyering  <meyering@lucent.com>
5326
5327         * diacrit.c (diacrit_diac): Use __MSDOS__ in favor of MSDOS.
5328         * dirname.c (dir_name): Likewise.
5329
5330         * basename.c (base_name): Use ISSLASH rather than comparing against `/'.
5331
5332         * dirname.c (dir_name) [MSDOS]: Declare `lim' to be const.
5333         (dir_name): Assert that there are no trailing slashes.
5334
5335 2000-07-18  Bruno Haible  <haible@clisp.cons.org>
5336
5337         * mbswidth.h (mbswidth): Add a flags argument.
5338         (mbswidth): New declaration.
5339         (MBSW_ACCEPT_INVALID, MBSW_ACCEPT_UNPRINTABLE): New macros.
5340         * mbswidth.c (mbswidth): Add a flags argument.
5341         (mbsnwidth): New function.
5342
5343 2000-07-24  Jim Meyering  <meyering@lucent.com>
5344
5345         * mbswidth.c: Remove useless #else.  From Bruno Haible.
5346
5347 2000-07-23  Paul Eggert  <eggert@twinsun.com>
5348
5349         * mbswidth.c (_XOPEN_SOURCE):
5350         Don't define; this causes problems on Solaris 7.
5351         (wcwidth) [!HAVE_DECL_WCWIDTH]: Declare.
5352
5353 2000-07-23  Paul Eggert  <eggert@twinsun.com>
5354
5355         * quotearg.c:
5356         Include <wchar.h> even if ! (HAVE_MBRTOWC && 1 < MB_LEN_MAX),
5357         so that mbstate_t is always defined.
5358
5359         Do not inspect MB_LEN_MAX, since it's incorrectly defined to
5360         be 1 in at least one GCC installation, and this configuration
5361         error is likely to be common.  Ignoring MB_LEN_MAX hurts
5362         performance on hosts that have mbrtowc but have only unibyte
5363         locales, but I assume these hosts are rare.
5364
5365 2000-07-23  Paul Eggert  <eggert@twinsun.com>
5366
5367         * quotearg.c: Streamline by invoking multibyte code only if needed.
5368         <wchar.h>: Include only if HAVE_MBRTOWC && 1 < MB_LEN_MAX.
5369         (MB_CUR_MAX): Redefine to 1 if ! (HAVE_MBRTOWC && 1 < MB_LEN_MAX).
5370         (quotearg_buffer_restyled): If a unibyte locale, don't bother to
5371         invoke multibyte primitives.
5372
5373 2000-07-23  Jim Meyering  <meyering@lucent.com>
5374
5375         * basename.c (base_name): Add an assertion.
5376
5377 2000-07-15  Bruno Haible  <clisp.cons.org>
5378
5379         * quotearg.c: When the system forces us to redefine mbstate_t,
5380         shadow its mbsinit function.
5381
5382 2000-07-16  Bruno Haible  <haible@clisp.cons.org>
5383
5384         * mbswidth.h: New file.
5385         * mbswidth.c: New file.
5386         * Makefile.am (libfetish_a_SOURCES): Add mbswidth.c.
5387         (noinst_HEADERS): Add mbswidth.h.
5388
5389 2000-07-17  Bruno Haible  <haible@clisp.cons.org>
5390
5391         * config.charset: Add support for FreeBSD. Improve support for HP-UX
5392         and IRIX 6.
5393
5394 2000-07-15  Jim Meyering  <meyering@lucent.com>
5395
5396         * makepath.c: Include quote.h.
5397         (make_path): Convert "`%s'" in format strings to "%s", and wrap each
5398         corresponding argument in a `quote (...)' call.
5399         Give better diagnostics.
5400
5401         * Makefile.am (libfetish_a_SOURCES): Add quote.c.
5402         (noinst_HEADERS): Add quote.h.
5403
5404         * quote.c (quote, quote_n): New file.  Two functions taken verbatim
5405         from tar's src/misc.c.
5406         * quote.h: New file.  Prototypes for same.
5407
5408 2000-07-10  Paul Eggert  <eggert@twinsun.com>
5409
5410         From a suggestion by Bruno Haible.
5411         * quotearg.c (mbrtowc): Do not use HAVE_WCHAR_H in the definition.
5412         Use defined mbstate_t, not HAVE_MBSTATE_T_OBJECT,
5413         to decide whether to define the BeOS workaround macro;
5414         this adjusts to the change to AC_MBSTATE_T.
5415
5416 2000-07-13  Paul Eggert  <eggert@twinsun.com>
5417
5418         * quotearg.h (enum quoting style): New enum clocale_quoting_style.
5419
5420         * quotearg.c (quoting_style_args, quoting_style_vals,
5421         quotearg_buffer_restyled): Add support for
5422         clocale_quoting_style.  Undo previous change to
5423         locale_quoting_style behavior, and undo the "{LEFT QUOTATION MARK}"
5424         and "{RIGHT QUOTATION MARK}" msgids.
5425
5426 2000-07-05  Paul Eggert  <eggert@twinsun.com>
5427
5428         The old behavior of quoting `like this' doesn't look good with
5429         newer, ISO-style fonts.  See:
5430         http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html
5431
5432         Instead, quote "like this" by default.  Let the translator
5433         tailor the locale-specific quoting behavior by providing
5434         translations for {LEFT QUOTATION MARK} and {RIGHT QUOTATION MARK}.
5435
5436         * quotearg.c (N_): New macro.
5437         (gettext_default): New function.
5438         (quotearg_buffer_restyled): Use
5439         gettext_default ("{LEFT QUOTATION MARK}", "\"") for left quote, and
5440         gettext_default ("{RIGHT QUOTATION MARK}", "\"") for right quote.
5441
5442 2000-07-09  Jim Meyering  <meyering@lucent.com>
5443
5444         * Most files: Update copyright dates to include 2000.
5445
5446 2000-07-08  Jim Meyering  <meyering@lucent.com>
5447
5448         * xgethostname.c (ENAMETOOLONG): Define to an unlikely value
5449         if not defined.
5450         (xgethostname): Remove now-unnecessary #ifdef.
5451         Move declaration of `err' into loop where it's used.
5452
5453 2000-07-05  Bruno Haible  <haible@clisp.cons.org>
5454
5455         * xgethostname.c (xgethostname): Protect against the SunOS 5.5 bug
5456         by allocating a larger buffer. Test the gethostname return value for
5457         being >= 0, not == 0, for BeOS.  Don't exhaust memory if gethostname
5458         returns an error and ENAMETOOLONG isn't defined.
5459
5460 2000-07-05  Paul Eggert  <eggert@twinsun.com>
5461         and Bruno Haible  <haible@clisp.cons.org>
5462
5463         * quotearg.c (mbrtowc): Declare returned type, since BeOS doesn't.
5464
5465 2000-07-05  Bruno Haible  <haible@clisp.cons.org>
5466
5467         * quotearg.c (struct quoting_options): Simplify quote_these_too
5468         dimension.
5469
5470 2000-07-03  Jim Meyering  <meyering@lucent.com>
5471
5472         * strndup.c: [!HAVE_DECL_STRNLEN]: Declare strnlen.
5473         Reported by Bruno Haible.
5474
5475 2000-07-04  Jim Meyering  <meyering@lucent.com>
5476
5477         * quotearg.c: Make inclusion of <wchar.h> independent of whether
5478         HAVE_MBRTOWC is set.  Required at least for irix-5.6, which
5479         lacks mbrtowc.
5480
5481 2000-07-03  Paul Eggert  <eggert@twinsun.com>
5482         and Bruno Haible  <haible@clisp.cons.org>
5483
5484         * quotearg.c (mbrtowc):
5485         Assign to *pwc, and return 1 only if result is nonzero.
5486         (iswprint): Use ISPRINT when substituting our own mbrtowc.
5487
5488 2000-07-03  Jim Meyering  <meyering@lucent.com>
5489
5490         * readutmp.h: [HAVE_UTMPX_H]: Include <utmp.h> if HAVE_UTMP_H.
5491         This is necessary to get a definition of e.g., UTMP_FILE on HP-UX 10.20.
5492         From Bob Proulx.
5493
5494 2000-07-02  Jim Meyering  <meyering@lucent.com>
5495
5496         * quotearg.c (mbstate_t): Don't define here.
5497
5498 2000-07-02  Jim Meyering  <meyering@lucent.com>
5499
5500         * nanosleep.c (SIGCONT): Define if not already defined.
5501
5502 2000-06-17  Bruno Haible  <haible@clisp.cons.org>
5503
5504         * mountlist.c: Use MOUNTED_FS_STAT_DEV instead of MOUNTED_NEXT_DEV,
5505         per change in ../m4/ls-mntd-fs.m4.
5506         (read_filesystem_list): Ignore symbolic links.
5507
5508 2000-06-29  Jim Meyering  <meyering@lucent.com>
5509
5510         * same.c: Include <string.h> or <strings.h>, as appropriate,
5511         for declaration of strcmp.
5512
5513         * long-options.c: Include <stdlib.h>, for declaration of exit.
5514
5515         * mountlist.c (fsp_to_string) [HAVE_F_FSTYPENAME_IN_STATFS]:
5516         Avoid warning by casting result to `char *' to remove `const'.
5517
5518 2000-06-17  Bruno Haible  <haible@clisp.cons.org>
5519
5520         * Makefile.am (libfetish_a_SOURCES): Remove readutmp.c.
5521
5522 2000-06-26  Paul Eggert  <eggert@twinsun.com>
5523
5524         savedir now sets errno on failure and invokes xmalloc to get memory.
5525         Fix a couple of other minor bugs while we're at it.
5526
5527         * savedir.c (<unistd.h>): Do not include; there's no need.
5528         (NAMLEN): Remove macro.
5529         (malloc, realloc): Remove decls.
5530         (stpcpy): Likewise.
5531         ("xalloc.h"): Include.
5532         (NAME_SIZE_DEFAULT): New macro.
5533         (savedir): Use xmalloc / xrealloc to allocate memory.
5534         Use NAME_SIZE_DEFAULT if name_size is negative or overflows to zero.
5535         Skip "" directory entries.
5536         Use strlen to calculate directory entry length, since the old method
5537         is rarely used these days and isn't worth supporting.
5538         Don't use a pointer after freeing it.
5539         Check for integer overflow when calculating allocation size.
5540         Use memcpy to copy entries, instead of stpcpy.
5541         Set errno properly when returning NULL.
5542         Check for readdir error.
5543
5544 2000-06-26  Jim Meyering  <meyering@lucent.com>
5545
5546         * posixtm.c [HAVE_STDLIB_H]: Include stdlib.h, for decl of abort.
5547
5548 2000-06-17  Bruno Haible  <haible@clisp.cons.org>
5549
5550         * getusershell.c (xmalloc, xrealloc): Remove functions.
5551         Include xalloc.h.
5552         Don't include <stdlib.h>.  Don't declare malloc, realloc.
5553
5554 2000-06-23  Bruno Haible  <haible@clisp.cons.org>
5555
5556         * unicodeio.c (print_unicode_char): Work around ansi2knr deficiency.
5557
5558 2000-06-24  Jim Meyering  <meyering@lucent.com>
5559
5560         * error.c [!HAVE_DECL_STRERROR_R]: Declare strerror_r.
5561
5562 2000-06-21  Jim Meyering  <meyering@lucent.com>
5563
5564         * getpass.c: New file, from Bruno Haible.  Required for BeOS.
5565
5566 2000-06-19  Paul Eggert  <eggert@twinsun.com>
5567
5568         * quotearg.c: Include <wctype.h> after <wchar.h>, for Solaris 2.5.
5569         (mbrtowc, mbstate_t): Define substitutes if
5570         HAVE_MBRTOWC && HAVE_WCHAR_H && !HAVE_MBSTATE_T_OBJECT.
5571         (iswprint): Define to 1 if !defined iswprint && !HAVE_ISWPRINT,
5572         not if ! (HAVE_MBRTOWC && HAVE_WCHAR_H).
5573
5574 2000-06-17  Bruno Haible  <haible@clisp.cons.org>
5575
5576         * xgetcwd.c (xgetcwd): If the required pathname length is smaller
5577         than 1024, return a memory chunk of least possible size, instead
5578         of size PATH_MAX + 2. In the loop, increment the size proportionally.
5579         Use free/xmalloc instead of xrealloc to avoid copying for very long
5580         paths.
5581
5582 2000-06-17  Bruno Haible  <haible@clisp.cons.org>
5583
5584         * canon-host.c (canon_host): Use malloc and memcpy to copy an
5585         address, not strdup.  Include <stdlib.h> and don't declare free().
5586
5587 2000-06-17  Bruno Haible  <haible@clisp.cons.org>
5588
5589         * path-concat.c (path_concat): Don't access dir[-1] if dir is
5590         the empty string.
5591
5592 2000-06-21  Jim Meyering  <meyering@lucent.com>
5593
5594         * Makefile.am (libfetish_a_SOURCES): Add getstr.c.
5595         (noinst_HEADERS): Add getstr.h.
5596
5597         * getline.c (getstr): Move into a separate file.
5598         * getstr.c (getstr): New file, extracted from getline.c, with
5599         the following changes: new parameter, delim2; both delim[12]
5600         parameters have type `int', not `char'.  The latter would lose
5601         with 8-bit delimiters.
5602         * getstr.h: New file.
5603
5604 2000-06-19  Jim Meyering  <meyering@lucent.com>
5605
5606         * getloadavg.c [HAVE_NLIST_H] (NLIST_STRUCT): Define.
5607
5608 2000-06-18  Jim Meyering  <meyering@lucent.com>
5609
5610         * mkdir.c: Remove file, due mainly to copyright incompatibility.
5611         Besides, these days every porting target provides a mkdir function.
5612
5613         * strnlen.c: Include memory.h, string.h, and/or strings.h as needed.
5614         (this snippet comes from src/system.h).
5615
5616 2000-06-15  Paul Eggert  <eggert@twinsun.com>
5617
5618         * human.c (adjust_value): New function.
5619         (human_readable_inexact): Apply rounding style even when
5620         printing approximate values.
5621
5622 2000-06-14  Paul Eggert  <eggert@twinsun.com>
5623
5624         * human.c (human_readable_inexact): Allow an input block
5625         size that is not a multiple of the output block size, and vice versa.
5626         Reported by Piergiorgio Sartor.
5627
5628 2000-06-14  Paul Eggert  <eggert@twinsun.com>
5629
5630         * getdate.y (get_date): Apply relative times after time
5631         zone indicator, not before.  Reported by Todd A. Jacobs.
5632
5633 2000-06-13  Jim Meyering  <meyering@lucent.com>
5634
5635         * Makefile.am (all-local): Depend on lstat.c and stat.c.
5636
5637         * xstat.in [!HAVE_DECL_FREE]: Declare free in lstat.c.
5638
5639 2000-06-12  Paul Eggert  <eggert@twinsun.com>
5640
5641         * xstat.in: Include <stdlib.h> in lstat, to declare "free".
5642
5643 2000-06-04  Paul Eggert  <eggert@twinsun.com>
5644
5645         * strnlen.c: Include <config.h> if HAVE_CONFIG_H.
5646
5647 2000-06-04  Jim Meyering  <meyering@lucent.com>
5648
5649         * getugroups.c (getugroups): Cast -1 to gid_t, for systems like
5650         SunOS 4.1.4 for which gid_t is an unsigned type.
5651
5652 2000-06-03  Jim Meyering  <meyering@lucent.com>
5653
5654         * strnlen.c [!HAVE_DECL_MEMCHR]: Declare memchr.
5655
5656 2000-05-26  Bruno Haible  <haible@clisp.cons.org>
5657
5658         * Makefile.am (install-exec-local): On systems with glibc-2.1 or
5659         newer, don't install charset.alias.
5660         * config.charset: Change the Linux/glibc rules so they become empty
5661         on glibc-2.1 or newer.
5662
5663 2000-06-02  Jim Meyering  <meyering@lucent.com>
5664
5665         * mountlist.c: Back out last change.  Instead, do this...
5666         * mountlist.c (read_filesystem_list) [MOUNTED_VMOUNT]: Set the me_dummy
5667         member using the same `ignore'-testing code.
5668         * mountlist.h (ME_DUMMY): Add `autofs' to the list of ignored
5669         fs_type strings.
5670         From Mark D. Roth.
5671
5672 2000-05-29  Jim Meyering  <meyering@lucent.com>
5673
5674         * mountlist.c (read_filesystem_list) [MOUNTED_VMOUNT]: Ignore mounts
5675         with the `ignore' attribute.  Based on a patch from Mark D. Roth.
5676
5677 2000-05-22  Jim Meyering  <meyering@lucent.com>
5678
5679         * makepath.c: Remove old, now-unnecessary `#ifdef __MSDOS__' block.
5680
5681 2000-05-18  Jim Meyering  <meyering@lucent.com>
5682
5683         * hash.c (hash_rehash): Fix a nasty bug: copy the free entry list
5684         back, too, since it may have been modified by allocate_entry.
5685         (hash_delete): Rewrite to use neither the assignment operator
5686         nor the comma operator in an if-expression.
5687
5688 2000-05-15  Paul Eggert  <eggert@twinsun.com>
5689
5690         * closeout.c:
5691         <sys/stat.h>, <sys/types.h>, <unistd.h>, (STDOUT_FILENO):
5692         Remove; no longer needed.
5693         "quotearg.h": Add include.
5694         (file_name): Do not bother to explicitly initialize to NULL; it's less
5695         efficient on some hosts.
5696         (close_stdout_status): Remove test as to whether stdout was already
5697         closed; it breaks for the case "echo x | sort >&-".
5698         Quote file name colons.
5699         Do not assume that _("write error") lacks format strings.
5700
5701 2000-05-15  Jim Meyering  <meyering@lucent.com>
5702
5703         * version-etc.c (version_etc_copyright): Update the copyright string
5704         used in all --version output.
5705
5706 2000-05-14  Jim Meyering  <meyering@lucent.com>
5707
5708         * closeout.c (close_stdout_set_file_name): New function.
5709         (close_stdout_status): Use new file-scoped global.
5710         Return right away if fstat says the stdout file descriptor is invalid.
5711         * closeout.h (close_stdout_set_file_name): Declare.
5712
5713 2000-05-10  Jim Meyering  <meyering@lucent.com>
5714
5715         * closeout.c [default_exit_status]: New file-scoped variable.
5716         (close_stdout_set_status): New function.
5717         * closeout.h (close_stdout_set_status): Declare.
5718
5719 2000-05-08  Jim Meyering  <meyering@lucent.com>
5720
5721         * long-options.c: Don't include closeout.h.
5722         (parse_long_options): Don't call close_stdout for --version.
5723
5724 2000-05-06  Jim Meyering  <meyering@lucent.com>
5725
5726         * strnlen.c: Undefine __strnlen and strnlen.
5727         [!weak_alias]: Define __strnlen to strnlen.
5728
5729         * atexit.c: New file, from libiberty.
5730
5731 2000-05-06  Jim Meyering  <meyering@lucent.com>
5732
5733         * closeout.c (close_stdout_status): Also check for errors on the
5734         stderr stream.
5735
5736 2000-05-05  Bruno Haible  <haible@clisp.cons.org>
5737
5738         * localcharset.c (get_charset_aliases): Use malloc, realloc and memcpy
5739         instead of xmalloc, xrealloc, path_concat.
5740         (locale_charset): Treat empty environment variables as absent.
5741         (DIRECTORY_SEPARATOR, ISSLASH): New macros.
5742
5743 2000-05-04  Jim Meyering  <meyering@lucent.com>
5744
5745         * getopt.c: Update from glibc.
5746         * obstack.c: Likewise.
5747         * obstack.h: Likewise.
5748         * regex.c: Likewise.  NB: K&R compiler support is dropped for this file
5749
5750         * regex.h: Likewise.
5751         * strndup.c: Likewise.
5752         * strnlen.c: New file, from glibc.
5753
5754 2000-05-01  Jim Meyering  <meyering@lucent.com>
5755
5756         * full-write.c (full_write): Remove `FIXME' part of comment.
5757
5758 2000-04-29  Jim Meyering  <meyering@lucent.com>
5759
5760         * path-concat.c: Declare strdup only if it's not defined.
5761         * canon-host.c: Likewise.
5762
5763 2000-04-28  Jim Meyering  <meyering@lucent.com>
5764
5765         * rpmatch.c [HAVE_LIMITS_H]: Include limits.h before regex.h to avoid
5766         redefinition warning on some systems (HPUX).  Otherwise, regex.h is
5767         included first, then limits.h is included by locale.h by libintl.h.
5768         From John David Anglin.
5769
5770 2000-04-25  Jim Meyering  <meyering@lucent.com>
5771
5772         * makepath.c (S_IRWXUGO): Define.
5773         (make_path): Always perform explicit chmod if MODE specifies any
5774         of the `special' permission bits.  Prompted by a bug report against
5775         install from Mate Wierdl and Joost van Baal.
5776
5777 2000-04-18  Jim Meyering  <meyering@lucent.com>
5778
5779         * README: New file.
5780
5781         * getpagesize.h [!getpagesize && HAVE_OS_H && B_PAGE_SIZE]: Define
5782         getpagesize.  For BeOS.  Based on a patch from Bruno Haible.
5783
5784 2000-04-17  Jim Meyering  <meyering@lucent.com>
5785
5786         * strftime.c (my_strftime) [strftime]: Declare strftime here, since
5787         the definition of it to rpl_strftime also defined-away the system's
5788         declaration.
5789
5790 2000-04-15  Jim Meyering  <meyering@lucent.com>
5791
5792         Use `C' to denote so-called `contiguous' files, the same way
5793         that tar does.
5794         * filemode.c (S_ISCTG) [!S_ISCTG && S_IFCTG]: Define.
5795         (ftypelet): Use S_ISCTG.
5796         From Michael Deutschmann.
5797
5798 2000-04-14  Jim Meyering  <meyering@lucent.com>
5799
5800         * strftime.c (my_strftime) [#ifdef strftime]: Declare strftime.
5801
5802 2000-04-08  Jim Meyering  <meyering@lucent.com>
5803
5804         * Makefile.am (charset.alias): Use t-$@, not $@-t so the DOS 8.3
5805         names don't conflict.  Reported by Eli Zaretskii.
5806
5807 2000-03-28  Bruno Haible  <haible@clisp.cons.org>
5808
5809         * unicodeio.c (print_unicode_char): Avoid triggering Solaris iconv
5810         bug.  Deal with the different error behavior of Irix iconv.
5811
5812 2000-04-07  Jim Meyering  <meyering@lucent.com>
5813
5814         * putenv.c: Move inclusion of errno.h so it follows that of sys/types.h,
5815         to work around system header problems on AIX 3.2.5.  From Bruno Haible.
5816
5817 2000-04-05  Jim Meyering  <meyering@lucent.com>
5818
5819         Portability tweaks required for ultrix4.3.
5820         * readutmp.h [HAVE_UTMPX_H && !HAVE_DECL_GETUTENT]: Declare getutent.
5821         * readutmp.c: Include sys/types.h before sys/stat.h.
5822         * canon-host.c: Declare strdup.
5823         * path-concat.c: Likewise.
5824         From John David Anglin.
5825
5826 2000-04-04  Jim Meyering  <meyering@lucent.com>
5827
5828         Be more DOS 8.3-friendly.
5829         * ref-add.sin: Renamed from ref-add.sed.in.
5830         * ref-del.sin: Renamed from ref-del.sed.in.
5831         * Makefile.am: Reflect renaming.
5832         Reported by Eli Zaretskii.
5833
5834         Use a temporary file name that won't clash with `charset.alias'
5835         in the DOS 8.3 name space.
5836         * Makefile.am (charset_tmp): Define.
5837         (install-exec-local): Use $(charset_tmp) instead of $(charset_alias)-t.
5838         (uninstall-local): Likewise.
5839         Reported by Eli Zaretskii.
5840
5841 2000-03-29  Paul Eggert  <eggert@twinsun.com>
5842
5843         * time/strftime.c (my_strftime): Make sure we call the system
5844         strftime, not ourselves, when invoking the underlying strftime.
5845
5846 2000-03-24  Jim Meyering  <meyering@lucent.com>
5847
5848         * Makefile.am (EXTRA_DIST): Add ref-add.sed.in and ref-del.sed.in.
5849         (charset_alias): Define.
5850         (install-exec-local): Factor out common code.
5851         (uninstall-local): Split lines longer than 80.
5852         (ref-add.sed, ref-del.sed): Remove rules... (do the following instead)
5853         (SUFFIXES): Define.
5854         (.sed.in.sed): New rule.  Don't redirect directly to $@.
5855         (CLEANFILES): Add ref-add.sed and ref-del.sed.
5856
5857 2000-03-19  Bruno Haible  <haible@clisp.cons.org>
5858
5859         * config.charset: Output a line containing "Packages using this file".
5860         * ref-add.sed.in, ref-del.sed.in: New files.
5861         * Makefile.am (install-exec-local, uninstall-local, ref-add.sed,
5862         ref-del.sed): New rules.
5863
5864 2000-03-17  Jim Meyering  <meyering@lucent.com>
5865
5866         * unicodeio.c (<string.h>): Include only #if HAVE_STRING_H.
5867         Otherwise, include <strings.h>
5868
5869 2000-03-17  Bruno Haible  <haible@clisp.cons.org>
5870
5871         * unicodeio.c (utf8_wctomb): New function.
5872         (print_unicode_char): Pass the Unicode character to iconv in UTF-8
5873         format instead of in UCS-4 with platform dependent endianness.
5874
5875 2000-03-07  Paul Eggert  <eggert@twinsun.com>
5876
5877         * savedir.c (savedir): Work even if directory size is
5878         negative; this can happen with some screwy NFS configurations.
5879
5880 2000-03-06  Jim Meyering  <meyering@lucent.com>
5881
5882         * localcharset.c (get_charset_aliases): Don't try to free file_name
5883         if it's NULL (because we ran out of memory).  From Bruno Haible.
5884
5885 2000-03-05  Jim Meyering  <meyering@lucent.com>
5886
5887         * localcharset.c ("path-concat.h"): Include.
5888         (get_charset_aliases): Use path_concat instead of ANSI string
5889         concatenation.
5890
5891         * unicodeio.h (PARAMS): Define.
5892         Use it to guard prototype.
5893
5894 2000-03-04  Jim Meyering  <meyering@lucent.com>
5895
5896         * Makefile.am (install-exec-local): Create $(libdir) before installing
5897         into it.
5898         (uninstall-local): Uncomment this rule so `make distcheck' works
5899         once again.
5900
5901         * unicodeio.c (<errno.h>): Include it.
5902         (errno): Declare if not defined.
5903
5904         * localcharset.c: Add Bruno's comment justifying use of volatile.
5905
5906         * config.charset: New version, incorporating remarks from a linux
5907         i18n mailing list.  From Bruno Haible.
5908
5909 2000-03-02  Jim Meyering  <meyering@lucent.com>
5910
5911         * Makefile.am (EXTRA_DIST): Add config.charset.
5912
5913 2000-03-01  Jim Meyering  <meyering@lucent.com>
5914
5915         * localcharset.c: Guard some #includes with `#if HAVE_...'.
5916         * unicodeio.c: Likewise.
5917
5918 2000-02-02  Bruno Haible  <haible@clisp.cons.org>
5919
5920         * config.charset: New file.
5921         * localcharset.c: New file.
5922         * unicodeio.h, unicodeio.c: New files.
5923         * Makefile.am (DEFS): Add -DLIBDIR=...
5924         (libfetish_a_SOURCES): Add localcharset.c and unicodeio.c.
5925         (noinst_HEADERS): Add unicodeio.h.
5926         (all-local, install-exec-local, charset.alias): New targets.
5927
5928 2000-02-28  Paul Eggert  <eggert@twinsun.com>
5929
5930         * quotearg.c (ALERT_CHAR): New macro.
5931         (quotearg_buffer_restyled): Use it.
5932
5933 2000-02-27  Jim Meyering  <meyering@lucent.com>
5934
5935         * strtoumax.c: Fix typo in decl of strtoul: s/long long/long/.
5936         Guard declaration of strtoull also with `&& HAVE_UNSIGNED_LONG_LONG'.
5937
5938         * backupfile.c: Guard inclusion of stdlib.h with `#if HAVE_STDLIB_H',
5939         not `#if STDC_HEADERS'.
5940         Declare malloc if needed.
5941
5942         * backupfile.c: Use `#if !HAVE_DECL...' instead of `#ifndef HAVE_DECL..'
5943         now that autoconf always defines the HAVE_DECL_ symbols.
5944         * human.c: Likewise.
5945         * same.c: Likewise.
5946         * strtoumax.c: Likewise.
5947
5948         * backupfile.c: Arrange for cpp to fail if the configure-time
5949         declaration check was not run.
5950         * hash.c: Likewise.
5951         * human.c: Likewise.
5952         * same.c: Likewise.
5953         * strtoumax.c: Likewise.
5954
5955         * userspec.c (parse_user_spec): If there is no `:' but there is a `.',
5956         then first look up the entire `.'-containing string as a login name.
5957
5958 2000-02-18  Paul Eggert  <eggert@twinsun.com>
5959
5960         * getdate.y: Handle two-digit years with leading zeros correctly.
5961         (textint): New typedef.
5962         (parser_control): Member year changed from int to textint.
5963         All uses changed.
5964         (YYSTYPE): Removed; replaced by %union with int and textint members.
5965         (tDAY, tDAY_UNIT, tDAYZONE, tHOUR_UNIT, tID, tLOCAL_ZONE, tMERIDIAN,
5966         tMINUTE_UNIT, tMONTH, tMONTH_UNIT tSEC_UNIT, tSNUMBER, tUNUMBER,
5967         tYEAR_UNIT, tZONE, o_merid): Now of type <intval>.
5968         (tSNUMBER, tUNUMBER): Now of type <textintval>.
5969         (date, number, to_year): Use width of number in digits, not its value,
5970         to determine whether it's a 2-digit year, or a 2-digit time.
5971         (yylex): Store number of digits of numeric tokens.
5972         Reported by John Kendall.
5973
5974         (parser_control): Changed from struct parser_control to typedef (for
5975         consistency).  All uses changed.
5976
5977         (tID): Removed; not used.
5978         (yylex): Return '?' for unknown identifiers, rather than (unused) tID.
5979
5980 2000-02-14  Paul Eggert  <eggert@twinsun.com>
5981
5982         * getpagesize.h (getpagesize): Port to VMS for Alpha;
5983         adapted from changes to grep getpagesize.h by Martin P.J. Zinser.
5984
5985 2000-02-12  Jim Meyering  <meyering@lucent.com>
5986
5987         * userspec.c (ISDIGIT): Define it.
5988         (isdigit): Remove definition.
5989         (is_number): Use ISDIGIT, not isdigit.
5990         <libintl.h>: Include.
5991         (_ and N_): Define.
5992         (parse_user_spec): Mark translatable strings.
5993
5994 2000-02-10  Jim Meyering  <meyering@lucent.com>
5995
5996         With these changes, nanosleep.[ch] are finally enough like the other
5997         lib/* replacement files to compile on a few more losing systems.
5998
5999         * nanosleep.h: Don't include config.h.
6000         Remove prototype from declaration of nanosleep.
6001         (PARAMS): Remove now-unneeded definition.
6002         * nanosleep.c: #undef nanosleep.
6003         (rpl_nanosleep): Rename from nanosleep.
6004
6005 2000-02-03  Jim Meyering  <meyering@lucent.com>
6006
6007         * readutmp.c (read_utmp): Guard with `#ifdef UTMP_NAME_FUNCTION',
6008         rather than with `#if HAVE_UTMPNAME'.
6009
6010 2000-02-01  Jim Meyering  <meyering@lucent.com>
6011
6012         * readutmp.h (UT_USER): Add parens.  From Andreas Schwab.
6013
6014 2000-01-31  Jim Meyering  <meyering@lucent.com>
6015
6016         * nanosleep.h (nanosleep): Guard declaration with
6017         `#if ! HAVE_DECL_NANOSLEEP'.
6018         Without this, OFS gets a redeclaration error for rpl_nanosleep, due to
6019         the declaration in that vendor's sys/timers.h.
6020         Reported by Christian Krackowizer.
6021
6022         * quotearg.c (ISASCII): Add #undef and move definition to follow
6023         inclusion of wctype.h to work around Solaris 2.6 namespace pollution.
6024         (ISPRINT): Likewise.
6025         Reported by Tom Tromey.
6026
6027 2000-01-30  Jim Meyering  <meyering@lucent.com>
6028
6029         * readutmp.c (extract_trimmed_name): Use UT_USER instead of hard-coding
6030         uses of ->ut_name.  The latter doesn't work with new Linux header files
6031         where only utmpx.ut_user is declared.
6032
6033         * readutmp.h (UT_USER): Define.
6034
6035 2000-01-23  Jim Meyering  <meyering@lucent.com>
6036
6037         * Makefile.am (libfetish_a_SOURCES): Remove explicit mention of
6038         obstack.c.
6039
6040 2000-01-22  Jim Meyering  <meyering@lucent.com>
6041
6042         * strtoumax.c: [! HAVE_DECL_STRTOUL]: Declare strtoul.
6043         [! HAVE_DECL_STRTOULL]: Declare strtoull.
6044         Required for some AIX systems.  Reported by Christian Krackowizer.
6045         [TESTING] (main): New function.
6046
6047         1997-10-17  Eli Zaretskii  <eliz@is.elta.co.il>
6048         * dirname.c (dir_name): Support for DOS-style file names with drive
6049         letters.
6050
6051         * quotearg.c [HAVE_WCTYPE_H]: Include <wctype.h> for decl of iswprint.
6052
6053         * strverscmp.c (ISDIGIT): Define.
6054         (strverscmp): Use ISDIGIT, not isdigit.
6055
6056 2000-01-17  Paul Eggert  <eggert@twinsun.com>
6057
6058         * nanosleep.c (nanosleep):
6059         Don't use SA_INTERRUPT to decide whether to call sigaction, as
6060         POSIX.1 doesn't require SA_INTERRUPT and some systems
6061         (e.g. Solaris 7) don't define it.  Use SA_NOCLDSTOP instead;
6062         it's been part of POSIX.1 since day 1 (in 1988).
6063
6064 2000-01-17  Jim Meyering  <meyering@lucent.com>
6065
6066         * interlock: Remove unused file.  Reported by François Pinard.
6067
6068 2000-01-16  Paul Eggert  <eggert@twinsun.com>
6069
6070         * quotearg.c (quotearg_buffer_restyled): Do not quote
6071         alert, backslash, formfeed, and vertical tab unnecessarily in
6072         shell quoting style.
6073
6074
6075 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
6076   Free Software Foundation, Inc.
6077 Copying and distribution of this file, with or without modification,
6078 are permitted provided the copyright notice and this notice are preserved.