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