summaryrefslogtreecommitdiff
path: root/src/wc.c
AgeCommit message (Collapse)Author
2006-10-10* src/ls.c (quote_name): Use initializer rather than memset toPaul Eggert
initialize an object to zero. This is easier to read and is less likely to introduce an runtime error due to a mixup. It causes gcc -W to issue a warning, but you can work around this by appending -Wno-missing-field-initializers. * src/pathchk.c (portable_chars_only): Likewise. * src/shred.c (main): Likewise. * src/stty.c (main): Likewise. * src/tr.c (card_of_complement): Likewise. * src/wc.c (wc): Likewise.
2006-08-21Add a bootstrap procedure, so that the CVS version contains fewerPaul Eggert
files and we bootstrap the rest from gnulib, gettext, etc. * README-cvs: New file. * bootstrap: New file. * bootstrap.conf: New file. * .x-sc_trailing_blank: Remove config-log, .gdb-history. Add .po. * configure.ac (AC_PREREQ): Move here from m4/*.m4, for benefit of gnulib-tool. (gl_DEFAULT_POSIX2_VERSION, gl_USE_SYSTEM_EXTENSIONS, gl_PERL): (gl_IGNORE_UNUSED_LIBRARIES): Remove; now done by gnulib. (gl_EARLY): Add. (gl_MACROS): Call just after gl_EARLY, just for clarity. * src/c99-to-c98.diff: Remove patch to ls.c; no longer needed. * src/kill.c (strtoimax): Remove decl. * src/ls.c: Include "wcwidth.h" instead of rolling it ourselves. * src/wc.c: Likewise. * src/ls.c (sort_files): Rewrite to avoid need for C99-style declaration, so that we don't need to patch this file. * src/printf.c (strtoimax, strtoumax): Remove decls. * src/su.c: Include getpass.h. (getpass): remove. * src/system.h: Include mempcpy.h, stpcpy.h, strpbrk.h. Include inttypes.h unconditionally; remove decls it handles. * lib/Makefile.am: include gnulib.mk, so that we can remove most of this file. (AM_CPPFLAGS): Don't mention -I$(srcdir), since that's now done for us. (noinst_LIBRARIES, LDDADD, DEFS): Remove. (libcoreutils_a_SOURCES): Trim down greatly, just to the files that aren't in gnulib. Remove defns gnulib does for us. * m4/check-decl.m4 (gl_CHECK_DECLS): Don't include stdio.h, string.h, stdlib.h, unistd.h, sys/time.h, time.h. Use AC_CHECK_DECLS_ONCE for free, getenv, geteuid, getlogin, getuid, lseek, malloc, memchr, realloc. Don't check for getutent, memrchr, nanosleep, stpcpy, strndup, strnlen, strstr, strtoul, strtoull. (_gl_DECL_HEADERS): Remove; all uses removed. * m4/jm-macros.m4 (gl_MACROS): Move AC_PREREQ into configure.ac for the benefit of gnulib-tool. Call gl_INIT. Do not call or require macros that gnulib will handle for us. Don't check for fchmod, hasmntopt, isascii, lchown, listmntent, mempcpy, realpath, wcrtomb, tzset. (gl_CHECK_ALL_HEADERS): Don't check for sys/statvfs.h, sys/vfs.h, sys/mount.h. (gl_CHECK_ALL_TYPES): Require AC_TYPE_UNSIGNED_LONG_LONG_INT. Don't check for struct stat.st_blksize. Don't require AC_STRUCT_ST_DM_MODE, gt_TYPE_SSIZE_T, gl_AC_TYPE_UINT32_T, gl_AC_TYPE_UINTMAX_T, gl_AC_TYPE_UINTPTR_T, gl_AC_TYPE_UNSIGNED_LONG_LONG. * m4/prereq.m4 (gl_PREREQ): Require gl_FUNC_XFTS, gl_ROOT_DEV_INO. Don't require macros that gnulib does for us. * m4/stat-prog.m4 (cu_PREREQ_STAT_PROG): Don't check for sys/sysmacros.h. Don't check for statvfs. Use AC_CHECK_HEADERS_ONCE for netinet/in.h, nfs/nfs_clnt.h, nfs/vfs.h. Don't require gl_AC_TYPE_LONG_LONG, gt_HEADER_INTTYPES_H.
2006-07-09Adjust to today's renaming changes in system.h.Paul Eggert
2006-06-26Avoid a segfault for wc --files0=- < /dev/null.Jim Meyering
* src/wc.c (compute_number_width): Return right away if nfiles == 0.
2006-06-25* NEWS: wc accepts a new option --files0-from=FILE, where FILEJim Meyering
contains a list of NUL-separated file names. * src/wc.c: Include "readtokens.h". (usage): Describe the new option, and adjust the `Usage': with this option, no FILE may be specified on the command line. (main): Handle the new option. * tests/misc/wc-files0: New tests, for the above. * tests/misc/wc-files0-from: Likewise. * tests/misc/Makefile.am (TESTS): Add wc-files0.
2005-08-13Don't define mbrtowc at all.Jim Meyering
If mbstate_t is not defined, then AC_TYPE_MBSTATE_T will define it to `int' for us.
2005-08-12Test `!defined HAVE_MBSTATE_T' rather thanJim Meyering
`defined mbstate_t' to detect missing support for mbstate_t. The latter didn't work for HP-UX 11.23.
2005-07-11(wc): Avoid setmode; use POSIX-specified routines instead.Paul Eggert
(wc_file): FILE might be null now. (main): Simplify code a bit, so that fewer places need the setmode fixes.
2005-05-14Update FSF postal mail address.Jim Meyering
2005-05-14Update FSF postal mail address.Jim Meyering
2005-05-13"bytes, words and lines" -> "lines, words, and bytes" in commentPaul Eggert
2005-03-06Remove `register' keyword.Jim Meyering
2004-09-21Remove unused "case 0".Paul Eggert
2004-08-03(iswspace, wc): Use to_uchar rather than a cast.Paul Eggert
(print_lines, print_words, print_chars, print_bytes, print_linelength, have_read_stdin, wc, wc_file, main): Use bool for booleans. (exit_status): Remove. (wc, wc_file): Return bool status. All callers changed.
2004-05-06(get_input_fstatus): Use xnmalloc, rather than xmalloc.Jim Meyering
2004-01-21(usage): Use EXIT_SUCCESS, not 0, for clarity.Jim Meyering
(usage): Don't bother normalizing exit status since the arg is already the correct exit status now.
2003-11-06(main): Free `fstatus' so there is no confusion aboutJim Meyering
whether it's leaked or not.
2003-10-18Most .c files (AUTHORS): Revert the WRITTEN_BY/AUTHORS changeJim Meyering
of 2003-09-19. Now, AUTHORS is a comma-separated list of strings. Update the call to parse_long_options so that `AUTHORS, NULL' are the last parameters. * src/true.c (main): Append NULL to version_etc argument list. * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
2003-09-18(WRITTEN_BY): Rename from AUTHORS.Jim Meyering
Begin each WRITTEN_BY string with `Written by ' and end it with `.'. Mark each WRITTEN_BY string as translatable.
2003-09-18revert previous changeJim Meyering
2003-09-18Update AUTHORS definition to be a comma-separated list of strings and/or updateJim Meyering
the call to parse_long_options so that `AUTHORS, NULL' are the last parameters.
2003-08-09Tweak Solaris OS version number in comment.Jim Meyering
2003-07-23Don't include headers already included by system.h:Jim Meyering
Don't include closeout.h.
2003-07-23(wc): Fix typo in computation of file from file_x,Jim Meyering
which caused the former to be used uninitialized if file_x was nonzero.
2003-07-20(get_input_fstatus): Fix typo: `stat' was beingJim Meyering
invoked with a null pointer when there were no file arguments.
2003-07-20(write_counts): Add a comment.Jim Meyering
(wc): Rename `file' parameter. Set new local, `file', to be the file name, or (when it's NULL) _("standard output") so that all uses of `file' use the proper value. Use STREQ, not strcmp.
2003-07-20(number_width): New var.Jim Meyering
(posixly_correct): Remove. (struct fstatus): New struct. (write_counts): Output fields of width number_width. Do not worry about POSIXLY_CORRECT. Use null file, not empty-string file, to denote stdin, since "" is a valid file name on some hosts. (wc, wc_file): New arg fstatus. Use it to avoid invoking fstat if possible. (wc): Avoid problems if end_pos - current_pos overflows. Do not print odd message if stdin has a read error. (get_input_fstatus, compute_number_width): New functions. (main): Use them to implement the new behavior. Ignore POSIXLY_CORRECT.
2003-06-17(main): Call initialize_main.Jim Meyering
2003-06-12(usage): Correct wording: wc prints counts in the order `newline, word, byte'.Jim Meyering
2002-11-05(write_counts, wc):Jim Meyering
Use primitives from inttostr.h, not human.h, to print large numbers simply.
2002-10-09(wc): Adapt to new safe_read ABI.Jim Meyering
2002-09-22Remove all inclusions of inttypes.h,Jim Meyering
since it's already included from sys2.h via system.h.
2002-08-31Change `exit (0)' to `exit (EXIT_SUCCESS)',Jim Meyering
`exit (1)' to `exit (EXIT_FAILURE)', and `usage (1)' to `usage (EXIT_FAILURE)'.
2002-08-25(main): Close STDIN_FILENO rather than a literal `0'.Jim Meyering
2002-07-02(usage): Use the PACKAGE_BUGREPORT e-mail address, rather than hard-coding it.Jim Meyering
2002-04-25(usage): Adjust ordering to match that of default output.Jim Meyering
2001-12-13(wc): Use ISSPACE and iswspace in addition to hard-codingJim Meyering
the ASCII space character.
2001-12-01Reflect renaming to, and new usage of these macros:Jim Meyering
HELP_OPTION_DESCRIPTION and VERSION_OPTION_DESCRIPTION.
2001-12-01(usage): Use new macros, EMIT_HELP_DESCRIPTION and EMIT_VERSION_DESCRIPTIONJim Meyering
instead of hard-coding --help and --version descriptions.
2001-11-23Factor out some common strings to make translation easier.Jim Meyering
Split usage strings so that --help and --version descriptions are alone in their own string. Likewise for the one that says: Mandatory arguments to long options are mandatory for short options too.
2001-11-11(usage): Split --help output into smaller pieces.Jim Meyering
Use fputs, not printf.
2001-08-13(AUTHORS): Mark string for translation, since it contains the English word ↵Jim Meyering
`and'.
2001-04-14(usage): Tweak --help output: s/line,/newline,/Jim Meyering
2001-02-19(wc): Rename innermost `buf' to avoid shadowing warning.Jim Meyering
(wc): Rename local `wc' to avoid shadowing function name.
2000-10-30Include "system.h" after wctype.h (not before) to avoidJim Meyering
a compilation error on Solaris 5.5.1 systems.
2000-08-11Add support for multi-byte locales.Jim Meyering
(iswprint, mbrtowc, wcwidth): Provide default definitions. (total_bytes): New variable. (print_bytes): New variable. (longopts): Change abbreviation for --chars from 'c' to 'm'. (usage): Update. (write_counts): Add `bytes' argument. (wc): New variables `bytes', `count_bytes', `count_chars', `count_complicated'. The old code determines `bytes', not `chars'. New case for MB_CUR_MAX > 1. A non-printable non-space character does not increment the line position or start a word. Update `total_bytes'. (main): Initialize `print_bytes' and `total_bytes' to 0. Accept 'm' option. Pass `total_bytes' to write_counts.
2000-05-20Arrange to call close_stdout upon exit. Don't close stdout explicitly.Jim Meyering
1999-07-20(posixly_correct): Declare global.Jim Meyering
(write_counts): Use it to select printf formats. (main): Set posixly_correct from the POSIXLY_CORRECT envvar. From Peter Moulder.
1999-04-04Standardize --help and --version processing.Jim Meyering
1999-04-03Use AUTHORS in place of string in parse_long_options call.Jim Meyering