summaryrefslogtreecommitdiff
path: root/src/unexpand.c
AgeCommit message (Collapse)Author
2012-01-27maint: use single copyright year rangeJim Meyering
Run "make update-copyright".
2012-01-09maint: src/*.c: change remaining quotes (without embedded spaces)Jim Meyering
Run this (twice): git grep -E -l '`[^ ]+'\' src/*.c \ |xargs perl -pi -e 's/`([^ ]+'\'')/'\''$1/'
2012-01-07maint: use new emit_try_help in place of equivalent fprintfJim Meyering
Run this command: perl -0777 -pi -e \ 's/fprintf \(stderr, _\("Try `%s --help.*\n.*;/emit_try_help ();/m'\ src/*.c
2012-01-01maint: update all copyright year number rangesJim Meyering
Run "make update-copyright".
2011-07-20unexpand: fix misalignment when spaces span a tabstopPádraig Brady
The following dropped the space from the first field printf "1234567 \t1\n" | unexpand -a Note POSIX says that spaces should not precede tabs. Also a single trailing space should not be converted if the next field starts with non blank characters. So we enforce those rules too, with this change. * src/unexpand.c (unexpand): Implement as per POSIX rules. * tests/misc/unexpand: Add tests, and adjust existing tests as per POSIX rules. * NEWS: Mention the fix. Reported by Hallvard B Furuseth
2011-01-01maint: update all copyright year number rangesJim Meyering
Run "make update-copyright".
2010-07-22provide POSIX_FADV_SEQUENTIAL hint to appropriate utilsPádraig Brady
Following on from commit dae35bac, 01-03-2010, "sort: inform the system about our input access pattern" apply the same hint to all appropriate utils. This currently gives around a 5% speedup for reading large files from fast flash devices on GNU/Linux. * src/base64.c: Call fadvise (..., FADVISE_SEQUENTIAL); * src/cat.c: Likewise. * src/cksum.c: Likewise. * src/comm.c: Likewise. * src/cut.c: Likewise. * src/expand.c: Likewise. * src/fmt.c: Likewise. * src/fold.c: Likewise. * src/join.c: Likewise. * src/md5sum.c: Likewise. * src/nl.c: Likewise. * src/paste.c: Likewise. * src/pr.c: Likewise. * src/ptx.c: Likewise. * src/shuf.c: Likewise. * src/sum.c: Likewise. * src/tee.c: Likewise. * src/tr.c: Likewise. * src/tsort.c: Likewise. * src/unexpand.c: Likewise. * src/uniq.c: Likewise. * src/wc.c: Likewise, unless we don't actually read().
2010-05-31maint: make spacing around "=" consistent, even in IF_LINTJim Meyering
E.g., - size_t desired_width IF_LINT (= 0); + size_t desired_width IF_LINT ( = 0); Use this command: g grep -l IF_LINT | grep '\.[ch]$' \ | xargs perl -pi -e 's/(IF_LINT \()= /$1 = /'
2010-05-31maint: replace each "for (;;)" with "while (true)"Jim Meyering
Run this command: git ls-files | grep '\.[ch]$' \ | xargs perl -pi -e 's/for \(;;\)/while (true)/g' ...except for randint.c, which does not include stdbool.h. In that case, use "while (1)". * gl/lib/randint.c (randint_genmax): Use "while (1)" for infloops. * src/cat.c (simple_cat, cat): Use "while (true)" for infloops. * gl/lib/randread.c (readsource, readisaac): Likewise. * src/copy.c (copy_reg): Likewise. * src/csplit.c (record_line_starts, process_regexp): Likewise. * src/cut.c (set_fields): Likewise. * src/dd.c (iread, parse_symbols): Likewise. * src/df.c (find_mount_point, main): Likewise. * src/du.c (main): Likewise. * src/expand.c (expand): Likewise. * src/factor.c (factor_using_division, do_stdin): Likewise. * src/fmt.c (get_space): Likewise. * src/ls.c (decode_switches): Likewise. * src/od.c (main): Likewise. * src/pr.c (main, read_line): Likewise. * src/shred.c (dopass, genpattern): Likewise. * src/sort.c (initbuf, fillbuf, getmonth, keycompare): Likewise. * src/split.c (bytes_split, lines_split): Likewise. * src/tac.c (tac_seekable): Likewise. * src/test.c (and, or): Likewise. * src/tr.c (squeeze_filter, main): Likewise. * src/tsort.c (search_item): Likewise. * src/unexpand.c (unexpand): Likewise. * src/uniq.c (main): Likewise. * src/yes.c (main): Likewise.
2010-01-01maint: update all FSF copyright year lists to include 2010Jim Meyering
Use this command: git ls-files | grep -v COPYING \ | xargs env UPDATE_COPYRIGHT_USE_INTERVALS=1 \ build-aux/update-copyright
2009-09-23maint: Use logical rather than bitwise operators on boolsPádraig Brady
This is because bitwise operators are: - confusing and inconsistent in a boolean context - non short circuiting - brittle in C89 where bool can be an int (so > 1)
2009-09-21doc: mention the texinfo documentation in --helpPádraig Brady
* src/system.h: Rename emit_bug_reporting_address() to emit_ancillary_info() and update it to not print the translation project address in en_* locales, and _do_ print it in the 'C' (and other) locales so that it's included in the default man page. Also mention how to invoke the texinfo documentation for each command. Also move the "hard-locale.h" include to the 8 files that now use it. * man/help2man: Strip the newly added texinfo reference from the --help output as a more verbose version is already added by help2man. Suggestion from C de-Avillez
2009-08-25global: convert indentation-TABs to spacesJim Meyering
Transformed via this shell code: t=$'\t' git ls-files \ | grep -vE '(^|/)((GNU)?[Mm]akefile|ChangeLog)|\.(am|mk)$' \ | grep -vE 'tests/pr/|help2man' \ | xargs grep -lE "^ *$t" \ | xargs perl -MText::Tabs -ni -le \ '$m=/^( *\t[ \t]*)(.*)/; print $m ? expand($1) . $2 : $_'
2009-03-06maint: avoid new unused-macro warnings from gccJim Meyering
* src/ls.c (ASSERT_MATCHING_DEV_INO): Comment-out unused definition, to match commented-out use. * src/install.c (INITIAL_HASH_MODULE, INITIAL_ENTRY_TAB_SIZE): (READ_SIZE): Remove definitions of unused macros. * src/mv.c (INITIAL_HASH_MODULE, INITIAL_ENTRY_TAB_SIZE): Likewise. * src/dd.c (max): Likewise. * src/expand.c (OUTPUT_BLOCK): Likewise. * src/csplit.c (ALLOC_SIZE): Likewise. * src/pr.c (NULLCOL): Likewise. * src/ptx.c (Sword): Likewise. * src/unexpand.c (OUTPUT_BLOCK): Likewise. * src/factor.c (NDEBUG): Likewise.
2008-11-10avoid warnings about discarding "qualifiers from pointer target type"Jim Meyering
Use the new "bad_cast" function or an actual cast-to-"(char *)" to avoid warnings. * src/system.h (bad_cast): Define. * src/chown.c (main): * src/chroot.c (main): * src/date.c (main): * src/du.c (main): * src/expand.c (stdin_argv): * src/ls.c (decode_switches): * src/md5sum.c (main): * src/paste.c (main): * src/pr.c (col_sep_string, column_separator, line_separator, main): * src/sort.c (main): * src/split.c (main): * src/tail.c (main): * src/unexpand.c (stdin_argv): * src/yes.c (main):
2008-06-16remove redundant const directivesJim Meyering
In 1463824d8e7f72c31f1d803d7cfe2b608ccafc5c, I added some missing "const" directives, as well as some new, redundant ones. This removes the redundant ones. Pointed out by Eric Blake. * base64.c, cat.c, chcon.c, chgrp.c, chmod.c, chown.c, comm.c: * cp.c, csplit.c, cut.c, date.c, dd.c, df.c, dircolors.c, du.c: * env.c, expand.c, fmt.c, fold.c, groups.c, head.c, id.c: * install.c, join.c, kill.c, ln.c, ls.c, md5sum.c, mkdir.c: * mkfifo.c, mknod.c, mktemp.c, mv.c, nice.c, nl.c, od.c: * paste.c, pathchk.c, pinky.c, pr.c, ptx.c, readlink.c, rm.c: * rmdir.c, runcon.c, seq.c, shred.c, shuf.c, sort.c, split.c: * stat.c, stty.c, su.c, sum.c, tac.c, tail.c, tee.c, timeout.c: * touch.c, tr.c, truncate.c, tty.c, uname.c, unexpand.c, uniq.c: * wc.c, who.c: Remove redundant const directives. * maint.mk (sc_const_long_option): Don't require redundant "const".
2008-06-14add "const" attribute, where possibleJim Meyering
* maint.mk (sc_const_long_option): New rule. Enforce global change. * src/base64.c (long_options): Use "const" where possible. * src/cat.c (main): Likewise. * src/chcon.c (long_options): Likewise. * src/chgrp.c (long_options): Likewise. * src/chmod.c (long_options): Likewise. * src/chown.c (long_options): Likewise. * src/comm.c (long_options, OUTPUT_DELIMITER_OPTION): Likewise. * src/cp.c (long_opts): Likewise. * src/csplit.c (longopts): Likewise. * src/cut.c (longopts): Likewise. * src/date.c (long_options): Likewise. * src/dd.c (conversions, flags, statuses): Likewise. * src/df.c (long_options): Likewise. * src/dircolors.c (long_options): Likewise. * src/du.c (long_options): Likewise. * src/env.c (longopts): Likewise. * src/expand.c (longopts): Likewise. * src/fmt.c (long_options): Likewise. * src/fold.c (longopts): Likewise. * src/groups.c (longopts): Likewise. * src/head.c (long_options): Likewise. * src/id.c (longopts): Likewise. * src/install.c (long_options): Likewise. * src/join.c (longopts): Likewise. * src/kill.c (long_options): Likewise. * src/ln.c (long_options): Likewise. * src/ls.c (long_time_format, long_options, sort_functions): Likewise. * src/md5sum.c (long_options): Likewise. * src/mkdir.c (longopts): Likewise. * src/mkfifo.c (longopts): Likewise. * src/mknod.c (longopts): Likewise. * src/mktemp.c (longopts): Likewise. * src/mv.c (long_options): Likewise. * src/nice.c (longopts): Likewise. * src/nl.c (longopts): Likewise. * src/od.c (charname, long_options): Likewise. * src/paste.c (longopts): Likewise. * src/pathchk.c (longopts): Likewise. * src/pinky.c (longopts): Likewise. * src/pr.c (long_options): Likewise. * src/ptx.c (long_options): Likewise. * src/readlink.c (longopts): Likewise. * src/rm.c (long_opts): Likewise. * src/rmdir.c (longopts): Likewise. * src/runcon.c (long_options): Likewise. * src/seq.c (long_options): Likewise. * src/shred.c (long_opts): Likewise. * src/shuf.c (long_opts): Likewise. * src/sort.c (monthtab, long_options): Likewise. * src/split.c (longopts): Likewise. * src/stat.c (long_options): Likewise. * src/stty.c (mode_info, control_info, longopts, set_mode) Likewise. (set_control_char, speeds): Likewise. * src/su.c (longopts): Likewise. * src/sum.c (longopts): Likewise. * src/tac.c (longopts): Likewise. * src/tail.c (long_options): Likewise. * src/tee.c (long_options): Likewise. * src/timeout.c (long_options): Likewise. * src/touch.c (longopts): Likewise. * src/tr.c (long_options): Likewise. * src/truncate.c (longopts): Likewise. * src/tty.c (longopts): Likewise. * src/uname.c (uname_long_options, arch_long_options): Likewise. * src/unexpand.c (longopts): Likewise. * src/uniq.c (longopts): Likewise. * src/wc.c (longopts): Likewise. * src/who.c (longopts): Likewise.
2008-06-03use gnulib's progname moduleJim Meyering
* bootstrap.conf (gnulib_modules): Add progname. * src/*.c (program_name): Remove declaration. * (main): Call set_program_name rather than setting program_name. * src/nice.c (main): Cast program_name to "(char *)". * src/prog-fprintf.c: Include "system.h" * src/system.h: Include "progname.h". * maint.mk (sc_program_name): Adjust rule. Suggestion from Eric Blake.
2008-06-02declare program_name consistentlyJim Meyering
* src/base64.c: Likewise. * src/basename.c: Likewise. * src/cat.c: Likewise. * src/chcon.c: Likewise. * src/chgrp.c: Likewise. * src/chmod.c: Likewise. * src/chown.c: Likewise. * src/chroot.c: Likewise. * src/cksum.c: Likewise. * src/comm.c: Likewise. * src/cp.c: Likewise. * src/csplit.c: Likewise. * src/cut.c: Likewise. * src/date.c: Likewise. * src/dd.c: Likewise. * src/df.c: Likewise. * src/dircolors.c: Likewise. * src/dirname.c: Likewise. * src/du.c: Likewise. * src/echo.c: Likewise. * src/env.c: Likewise. * src/expand.c: Likewise. * src/expr.c: Likewise. * src/factor.c: Likewise. * src/fmt.c: Likewise. * src/fold.c: Likewise. * src/groups.c: Likewise. * src/head.c: Likewise. * src/hostid.c: Likewise. * src/hostname.c: Likewise. * src/id.c: Likewise. * src/install.c: Likewise. * src/join.c: Likewise. * src/kill.c: Likewise. * src/link.c: Likewise. * src/ln.c: Likewise. * src/logname.c: Likewise. * src/ls.c: Likewise. * src/md5sum.c: Likewise. * src/mkdir.c: Likewise. * src/mkfifo.c: Likewise. * src/mknod.c: Likewise. * src/mktemp.c: Likewise. * src/mv.c: Likewise. * src/nice.c: Likewise. * src/nl.c: Likewise. * src/nohup.c: Likewise. * src/od.c: Likewise. * src/paste.c: Likewise. * src/pathchk.c: Likewise. * src/pinky.c: Likewise. * src/pr.c: Likewise. * src/printenv.c: Likewise. * src/printf.c: Likewise. * src/ptx.c: Likewise. * src/pwd.c: Likewise. * src/readlink.c: Likewise. * src/rm.c: Likewise. * src/rmdir.c: Likewise. * src/runcon.c: Likewise. * src/seq.c: Likewise. * src/setuidgid.c: Likewise. * src/shuf.c: Likewise. * src/sleep.c: Likewise. * src/sort.c: Likewise. * src/split.c: Likewise. * src/stat.c: Likewise. * src/stty.c: Likewise. * src/su.c: Likewise. * src/sum.c: Likewise. * src/sync.c: Likewise. * src/tac.c: Likewise. * src/tail.c: Likewise. * src/tee.c: Likewise. * src/test.c: Likewise. * src/timeout.c: Likewise. * src/touch.c: Likewise. * src/tr.c: Likewise. * src/true.c: Likewise. * src/tsort.c: Likewise. * src/tty.c: Likewise. * src/uname.c: Likewise. * src/unexpand.c: Likewise. * src/uniq.c: Likewise. * src/unlink.c: Likewise. * src/uptime.c: Likewise. * src/users.c: Likewise. * src/wc.c: Likewise. * src/who.c: Likewise. * src/whoami.c: Likewise. * src/yes.c: Likewise.
2008-05-26adjust copyright datesJim Meyering
2008-05-26convert single-author programs to use proper_nameJim Meyering
g grep -E -l 'define AUTHORS "[^,]+"$'|xargs perl -pi -e \ 's/(define AUTHORS) ("[^,]+")$/$1 proper_name ($2)/'
2007-07-23Update all copyright notices to use the newer form.Jim Meyering
2007-07-10Change "version 2" to "version 3" in all copyright notices.Jim Meyering
2007-03-28Help translators include translation team's web or email address.Jim Meyering
* src/system.h (emit_bug_reporting_address): New function. * src/base64.c: Use it rather than a literal printf. * src/basename.c, src/cat.c, src/chgrp.c, src/chmod.c: * src/chown.c, src/chroot.c, src/cksum.c, src/comm.c, src/cp.c: * src/csplit.c, src/cut.c, src/date.c, src/dd.c, src/df.c: * src/dircolors.c, src/dirname.c, src/du.c, src/echo.c, src/env.c: * src/expand.c, src/expr.c, src/factor.c, src/fmt.c, src/fold.c: * src/head.c, src/hostid.c, src/hostname.c, src/id.c, src/install.c: * src/join.c, src/kill.c, src/link.c, src/ln.c, src/logname.c: * src/ls.c, src/md5sum.c, src/mkdir.c, src/mkfifo.c, src/mknod.c: * src/mv.c, src/nice.c, src/nl.c, src/nohup.c, src/od.c: * src/paste.c, src/pathchk.c, src/pinky.c, src/pr.c, src/printenv.c: * src/printf.c, src/ptx.c, src/pwd.c, src/readlink.c, src/rm.c: * src/rmdir.c, src/seq.c, src/setuidgid.c, src/shred.c, src/shuf.c: * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c: * src/su.c, src/sum.c, src/sync.c, src/system.h, src/tac.c: * src/tail.c, src/tee.c, src/test.c, src/touch.c, src/tr.c: * src/true.c, src/tsort.c, src/tty.c, src/uname.c, src/unexpand.c: * src/uniq.c, src/unlink.c, src/uptime.c, src/users.c, src/wc.c: * src/who.c, src/whoami.c, src/yes.c: Likewise.
2006-07-09(unexpand): Don't assume that isprint etc. returnPaul Eggert
booleans (needed for pre-C99 hosts).
2006-02-06(usage): Use two spaces (not one) to separate theJim Meyering
--first-only option string from its description, so help2man formats the derived man page properly.
2005-10-24* src/expand.c (parse_tab_stops): Add comment to make this functionJim Meyering
identical to the one in unexpand.c. * src/unexpand.c (parse_tab_stops): Adjust syntax to make this function identical to the one in expand.c.
2005-08-12Cosmetic: use X2NREALLOC (only two arguments) rather than x2nrealloc (with ↵Jim Meyering
three).
2005-07-11(unexpand): Always copy in text mode. POSIX saysPaul Eggert
the input and output must be text.
2005-07-05Adjust to the change to DECIMAL_DIGIT_ACCUMULATE: its last arg is nowPaul Eggert
a type, not a value.
2005-05-14Update FSF postal mail address.Jim Meyering
2005-05-14Update FSF postal mail address.Jim Meyering
2005-04-26Remove posixver.h and its uses.Paul Eggert
(main): Don't complain about -TAB.
2005-04-11(next_file): Don't assume fopen cannot return stdin.Paul Eggert
2005-03-25(parse_tab_stops, main): Update use of DECIMAL_DIGIT_ACCUMULATE.Jim Meyering
2005-03-17(parse_tab_stops, main): Use DECIMAL_DIGIT_ACCUMULATE macro inJim Meyering
place of nearly-equivalent code.
2005-01-11(main): Check for overflow in tabstop valuesJim Meyering
specified via the obsolete form. E.g., now this command fails: _POSIX2_VERSION=1 ./unexpand -$(echo '2^64+1'|bc) Before it would act like `_POSIX2_VERSION=1 ./unexpand -1'.
2005-01-11(add_tab_stop): Properly diagnose a tabstop list with decreasing values.Jim Meyering
2004-09-22Remove trailing blanks.Jim Meyering
2004-09-21Remove unused "case 0".Paul Eggert
2004-08-24(add_tab_stop): Renamed from add_tabstop. All uses changed.Paul Eggert
(parse_tab_stop): Renamed from parse_tabstop. All uses changed. (validate_tab_stop): Renamed from validate_tabstop. All uses changed. (next_file, main): Check fclose against 0, not EOF. (unexpand): Remove unnecessary casts. Add another loop nesting level, for lines, so that per-line variables are initialized cleanly. Revamp tab checking. Check for write error immediately, rather than just once at the end of the program. (TAB_STOP_SENTINEL): Remove. (tab_size): Now size_t, not uintmax_t, since we need to store the sequences of blanks. (max_column_width): New var. (usage): Say "blank" where POSIX requires this. (add_tab_stop): Calculate maximum column width. (unexpand): Store the pending blanks, instead of merely counting them. Follow POSIX's rules about -a requiring two blanks before a tab stop. Get rid of internal label and goto.
2004-08-03Int cleanup and minor reorganization to be more like src/expand.c.Paul Eggert
Include quote.h, xstrndup.h. (TAB_STOP_SENTINEL): Increase from INT_MAX to INTMAX_MAX. (convert_entire_line, have_read_stdin, parse_tabstops, next_file, unexpand, main): Use bool for booleans. (tab_size, tab_list, add_tabstop, validate_tabstops, unexpand): Use uintmax_t for column counts. (first_free_tab, validate_tabstops, unexpand): Use size_t for sizes. (add_tabstop, parse_tabstops, main): Don't reserve UINTMAX_MAX as a tab stop. (parse_tabstops): Don't use ISBLANK on possibly-signed char. Detect overflow in tab stop string. (next_file, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0. (unexpand): Concatenate input files the same way expand does.
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.
2004-01-04(n_tabs_allocated): New global.Jim Meyering
(add_tabstop): Use x2nrealloc rather than xrealloc.
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-23(unexpand): Save errno after input error, to report proper errno value.Jim Meyering
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-07-23Don't include headers already included by system.h:Jim Meyering
Don't include closeout.h.
2003-06-17(main): Call initialize_main.Jim Meyering
2003-05-10(main): Handle argc < optind.Jim Meyering