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