Jim Meyering [Fri, 28 Jan 2000 08:32:01 +0000 (08:32 +0000)]
(wrapf): Emit a newline only if 0 < current_col.
(screen_columns): Use xstrtol, not atoi.
If get_win_size fails and $COLUMNS == 0, then return 80, not `0'.
Jim Meyering [Tue, 25 Jan 2000 12:03:15 +0000 (12:03 +0000)]
tsort now works more like the traditional UNIX tsort. Before it would
exit when it found a loop. Now it continues and outputs all items.
(exit_status): New variable.
(loop): New varibale.
(count_items, scan_zeroes): Change return type to int.
(detect_loop): Complete rewrite to correctly implement detection
of loops. Also change return type to int.
(recurse_tree): Stop if ACTION returns non-zero. This involves
changing the return type of this function and ACTION to int.
(walk_tree): Change return type of ACTION to int.
(tsort): Continue sort after a loop has been detected (and
broken). Set exit_status to 1 if a loop was detected.
(main): Use exit_status to determine exit code.
Jim Meyering [Mon, 24 Jan 2000 13:48:12 +0000 (13:48 +0000)]
(main): Don't expect array index `n_files - 1' to evaluate
to `-1' for unsigned int n_files == 0. Doing so lead to a segfault on
alpha. From Michael Stone.
Jim Meyering [Sun, 23 Jan 2000 09:31:06 +0000 (09:31 +0000)]
(OPTIONAL_BIN_PROGS, OPTIONAL_BIN_ZCRIPTS, MAN):
AC_SUBST these here, rather than just in sh-util/configure.in, so
that the now-shared-by-fileutils-and-textutils lib/Makefile.am are
all the same.
Jim Meyering [Sat, 22 Jan 2000 22:43:31 +0000 (22:43 +0000)]
[! HAVE_DECL_STRTOUL]: Declare strtoul.
[! HAVE_DECL_STRTOULL]: Declare strtoull.
Required for some AIX systems. Reported by Christian Krackowizer.
[TESTING] (main): New function.
Jim Meyering [Sat, 22 Jan 2000 10:09:29 +0000 (10:09 +0000)]
Add support for octal and hexadecimal output.
(intconv): New variable.
(usage): Update.
(main): Call scan_arg instead of scan_double_arg. Call check_format
before scan_arg.
(scan_int_arg, scan_arg): New functions.
(check_format): Add intconv argument. Accept %d, %u, %o, %x, %X.
(print_numbers): If intconv is true, pass an int argument to printf.
Jim Meyering [Sat, 22 Jan 2000 09:31:19 +0000 (09:31 +0000)]
("xstrtol.h"): Include.
(Filter): Rename from PFL.
(non_neg_strtol): Remove function.
(find_bracketed_repeat): Use xstrtoul instead of non_neg_strtol.
(squeeze_filter, set_initialize, main): Use size_t and ssize_t in
place of long and int in several decls.
(read_and_delete, read_and_xlate): Likewise, and remove assertion.
Jim Meyering [Wed, 19 Jan 2000 22:43:33 +0000 (22:43 +0000)]
Tweak sort performance.
(hard_LC_CTYPE): Remove.
(keylist): Renamed from keyhead. Now a pointer, not a
mostly-unused struct. All uses changed.
(findlines, keycompare, CMP_WITH_IGNORE, compare, checkfp, mergefps,
sort): Tune and use a more consistent style for reallocation.
(keycompare, main): Don't worry about LC_CTYPE;
it's buggy with multibyte chars anyway.
(compare): Invoke alloca (0) after each call to keycompare,
not just the ones that return nonzero. This avoids a memory
leak on architectures without builtin alloca that occurs
sometimes when a file contains all duplicate lines.
Jim Meyering [Wed, 19 Jan 2000 20:40:51 +0000 (20:40 +0000)]
(jm_FUNC_NANOSLEEP): Include <sys/time.h>, too.
Use AC_HEADER_TIME. Volker Borchert reported that OpenBSD-2.3/sparc
defines `struct timespec' in <sys/time.h>