summaryrefslogtreecommitdiff
path: root/sed
Commit message (Collapse)AuthorAgeFilesLines
* maint: convert obsolescent @VAR@ notation to $(VAR)Jim Meyering2014-11-301-3/+1
| | | | * sed/Makefile.am (sed_LDADD): Use $(VAR), no @VAR@.
* maint: update copyright dates; use gnulib's update-copyright moduleJim Meyering2014-11-309-16/+20
| | | | | | * bootstrap.conf (gnulib_modules): Add update-copyright. Then, run "make update-copyright". * Makefile.am: Add copyright header.
* maint: remove all trailing white spaceJim Meyering2014-11-304-36/+36
| | | | | | | | | | | First, run this command: git grep -l ' $'|xargs perl -pi -e 's/[ \t]+$//' Then some minor fix-up to make the two newly-failing tests pass once again: * testsuite/mac-mf.sed: Append this, s/ $//, to eliminate trailing spaces in the actual output. * testsuite/y-newline.good: Manually remove a trailing space between two concatenated prompts.
* fix "y" to work with NUL in the RHSJim Meyering2014-09-061-1/+2
| | | | | | | | | | | | | * sed/execute.c (do_list) [case 'y']: Handle NUL bytes in the RHS of a y/LHS/RHS/ transliteration. * testsuite/y-zero.good: New test-related files. * testsuite/y-zero.inp: * testsuite/y-zero.sed: * testsuite/Makefile.am (SEDTESTS): Add y-zero here. * testsuite/Makefile.tests: And here. * NEWS (Bug fixes): Describe it. The bug was reported by table@inventati.org, with the execute.c change mostly by Paolo Bonzini.
* Modify documentation to note sed "-E" option, now in POSIX, for EREs.David A. Wheeler2013-10-171-3/+3
| | | | | | | | | | | | | 2013-10-16 David A. Wheeler <dwheeler@dwheeler.com> * doc/sed-in.texi: Document "-E" option to use EREs. GNU sed already supported "-E" as an undocumented synonym for "-r", but "-E" is now in POSIX. See: http://austingroupbugs.net/view.php?id=528. * doc/sed.1: Likewise. * doc/sed.texi: Likewise. * doc/sed.x: Likewise. * sed/sed.c: Likewise.
* Set PATH_MAX to some constant in case it is not defined in systemJose E. Marchesi2013-10-061-2/+1
| | | | | | | | | | | | headers. 2013-10-06 Jose E. Marchesi <jemarch@gnu.org> * basicdefs.h (PATH_MAX): Defined to some constant in case it is not defined by system headers. * sed/utils.c: Do not include pathmax.h anymore. * bootstrap.conf (gnulib_modules): Do not use the gnulib module pathmax.
* fix \x26 on RHS of s commandPaolo Bonzini2012-04-131-20/+25
| | | | | | | | | | | 2012-04-13 Paolo Bonzini <bonzini@gnu.org> * sed/compile.c (convert_number): Remove default_char argument, expect buf to point to it. Remove maxdigits argument and compute it on the fly. (normalize_text): Unify calls to convert_number under the convert label. For TEXT_REPLACEMENT add a backslash to the output if convert_number returns ch == '&'.
* switch to the wonderful world of function prototypesPaolo Bonzini2012-03-167-132/+117
| | | | | | | | | | | | | 2012-03-16 Paolo Bonzini <bonzini@gnu.org> * basicdefs.h (P_): Remove. * sed/compile.c: Adjust. * sed/execute.c: Likewise. * sed/fmt.c: Likewise. * sed/sed.c: Likewise. * sed/sed.h: Likewise. * sed/utils.c: Likewise. * sed/utils.h: Likewise.
* remove ck_freePaolo Bonzini2012-03-165-31/+21
| | | | | | | | | | | 2012-03-16 Paolo Bonzini <bonzini@gnu.org> * basicdefs.h (FREE): Remove. * sed/compile.c: Adjust. * sed/execute.c: Adjust. * sed/regexp.c: Adjust. * sed/utils.c: Adjust, remove ck_free. * sed/utils.h: Adjust, remove ck_free.
* rip out old macrosPaolo Bonzini2012-03-165-51/+51
| | | | | | | | | | | 2012-03-16 Paolo Bonzini <bonzini@gnu.org> * basicdefs.h (CAST, VCAST, VOID, MEMCPY, MEMMOVE): Rip out. * sed/compile.c: Adjust. * sed/execute.c: Adjust. * sed/regexp.c: Adjust. * sed/utils.c: Adjust. * sed/utils.h: Adjust.
* unconditionally compile for MBCSPaolo Bonzini2012-03-163-73/+0
| | | | | | | | 2012-03-16 Paolo Bonzini <bonzini@gnu.org> * sed/execute.c: Unconditionally compile for MBCS. * sed/mbcs.c: Unconditionally compile for MBCS. * sed/sed.h: Unconditionally compile for MBCS.
* clean up header inclusionsPaolo Bonzini2012-03-166-110/+17
| | | | | | | | | | | | 2012-03-16 Paolo Bonzini <bonzini@gnu.org> * basicdefs.h: Enjoy gnulib's headers. * sed/compile.c: Likewise. * sed/execute.c: Likewise. * sed/regexp.c: Likewise. * sed/sed.c: Likewise. * sed/sed.h: Likewise. * sed/utils.c: Likewise.
* remove bootstrap scriptPaolo Bonzini2012-03-163-45/+1
| | | | | | | | | | | | 2012-03-16 Paolo Bonzini <bonzini@gnu.org> * bootstrap.sh.in: Remove. * bootstrap.sh: Remove. * configure.ac: Do not create bootstrap.sh. * basicdefs.h [BOOTSTRAP]: Remove guards. * sed/execute.c [BOOTSTRAP]: Remove guards. * sed/sed.c [BOOTSTRAP]: Remove guards. * sed/sed.h [BOOTSTRAP]: Remove guards.
* do not open input files with "rt" mode, do not assume "rt" is supportedPaolo Bonzini2012-02-132-3/+9
| | | | | | | | 2012-02-13 Paolo Bonzini <bonzini@gnu.org> * configure.ac: Test whether fopen("foo", "rt") works. * sed/compile.c: Do not open scripts with "rt" mode if it doesn't. * sed/sed.c: Never open input files with "rt" mode.
* add -z/--null-dataPaolo Bonzini2012-02-055-17/+33
| | | | | | | | | | | | | | | 2012-02-05 Paolo Bonzini <bonzini@gnu.org> Jim Hill <gjthill@gmail.com> * autoboot.conf: Change getline to getdelim. * doc/sed-in.texi: Document -z/--null-data. * doc/sed.texi: Regenerate. * sed/execute.c: Change '\n' to buffer_delimiter. * sed/sed.c: Add support for -z/--null-data. * sed/sed.h: Add buffer_delimiter. * sed/utils.c: Change ck_getline to ck_getdelim. * sed/utils.h: Change ck_getline to ck_getdelim. * NEWS: Document new option.
* fix help text for -iPaolo Bonzini2011-08-291-1/+1
| | | | | | | 2011-08-29 Paolo Bonzini <bonzini@gnu.org> * sed/sed.c (usage): Fix documentation for -i. Reported by Dennis Bartlett.
* avoid silent data loss when an input line is 231 bytes or longerJim Meyering2011-07-111-2/+2
| | | | | | | | | | | | If one line in a file has length (including newline) of 231, then applying sed -i to that file truncates it to size 0. I first noticed it like this: Create a file with line of length 231-1 $ perl -le 'print "v"x(2**31-1)' > k Then prepend a byte to that line: $ sed -i 's/^/v/' k Surprise! The file is empty. * sed/utils.c (ck_getline): Declare "result" to be of type ssize_t, rather than int, to match the return type of getline.
* avoid reopening stdinPádraig Brady2011-07-041-0/+4
| | | | | | | | | | | This adjusts the change made in 3a8e165a, to not reopen stdin on platforms where there is no separate "binary mode". That added some overhead and also precludes the use of tools like `stdbuf -i...`. * execute.c (open_next_file): Only reopen stdin on windos.
* document corner case of \l and \u, and simplify the code handling itPaolo Bonzini2011-05-271-7/+5
| | | | | | | | | | 2011-05-27 Paolo Bonzini <bonzini@gnu.org> * doc/sed-in.texi: Explain behavior of \l and \u at the end of the replacement text. * doc/sed.texi: Regenerate. * sed/execute.c (append_replacement, do_subst): Further simplification.
* clang analyzer cleanupsPaolo Bonzini2011-03-113-12/+15
| | | | | | | | 2011-03-11 Paolo Bonzini <bonzini@gnu.org> * sed/compile.c (normalize_text): Clang analyzer cleanup. * sed/execute.c (append_replacement, do_subst): Same. * sed/utils.c (ck_getline): Same.
* avoid compiler warningEric Blake2010-11-032-3/+5
| | | | * sed/sed.c (includes): Supply missing header.
* fix previous commitPaolo Bonzini2010-10-201-0/+1
|
* fix lseek errors from flushing input pipes on interixPaolo Bonzini2010-10-201-0/+3
| | | | | | | 2010-10-20 Paolo Bonzini <bonzini@gnu.org> * autoboot.conf: Add fwriting. * sed/utils.c: Use it.
* use version-etc-fsfPaolo Bonzini2010-08-301-13/+8
| | | | | | | | | | | | 2010-08-30 Paolo Bonzini <bonzini@gnu.org> * Makefile.am (dist-hook): Remove COPYRIGHT_YEAR check. * autoboot.conf (gnulib_modules): Add version-etc-fsf. * configure.ac (COPYRIGHT_YEAR): Remove. Change package name to "GNU sed". * doc/sed.1: Regenerate. * sed/sed.c (AUTHORS): New. (main): Use version_etc.
* use "w" or "wb" modes for sed -i, s///w, `w' and `W' depending on --binaryPaolo Bonzini2010-08-176-9/+15
| | | | | | | | | | | | | 2010-07-18 Paolo Bonzini <bonzini@gnu.org> * sed.c (write_mode): New. (main): Initialize it to "wb" if --binary is passed. * sed.h (write_mode): New. * compile.c (mark_subst_opts, compile_program): Use it instead of "w". * execute.c (open_next_file): Pass write_mode to ck_mkstemp. * utils.c (ck_mkstemp): Accept mode, pass it to fdopen. Constify. * utils.h (ck_mkstemp): Adjust prototype.
* Let --posix turn off nonportable scripts ending in backslash.Ralf Wildenhues2010-08-171-2/+6
| | | | | | | | * sed/compile.c (errors, INCOMPLETE_CMD): New error string. (compile_program): In strict posix mode, complain about incomplete command. * NEWS: Update. Report by Bruno Haible.
* use mkostemp(template, 0) instead of mkstemp to work around Cygwin oddityPaolo Bonzini2010-07-161-2/+4
| | | | | | | | | | | 2010-07-16 Paolo Bonzini <bonzini@gnu.org> * autoboot.conf (gnulib_modules): Replace mkstemp with mkostemp. * bootstrap.sh.in: Compile mkostemp.c instead of mkstemp.c. * gnulib: Update. * NEWS: Mention change. * sed/utils.c (ck_mkstemp): Use mkostemp to work around Cygwin oddity. Reported by Stepan Kasal.
* add F command.Ralf Wildenhues2009-12-272-20/+28
| | | | | | | | | | | | 2009-11-15 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> * doc/sed.texi (Extended Commands): Document F command. * doc/sed-in.texi: Regenerate. * sed/compile.c (compile_program): Accept 'F' if not --posix. * sed/execute.c (open_next_file): Always initialize in_file_name. (execute_program): Handle 'F'. * configure.ac: Bump SED_FEATURE_VERSION. * NEWS: Update.
* fix debian bug 559539Paolo Bonzini2009-12-071-1/+1
| | | | | | | 2009-12-07 Clint Adams <schizo@debian.org> (tiny change) * sed/execute.c (open_next_file): If is_selinux_enabled returns -1, treat it as "disabled".
* fix ordering of chmod/chown operationsPaolo Bonzini2009-10-151-3/+3
| | | | | | | | | 2009-10-15 Paolo Bonzini <bonzini@gnu.org> * sed/execute.c (closedown): First change owner (while permissions stay 0?00), then mode. 2009-10-15 Paolo Bonzini <bonzini@gnu.org>
* handle incomplete sequences as if they were invalidPaolo Bonzini2009-10-151-3/+3
| | | | | | | | 2009-10-15 Paolo Bonzini <bonzini@gnu.org> WANG Yunfeng <uhuruh@gmail.com> * sed/execute.c (str_append, str_append_modified): Handle incomplete sequences as if they were invalid.
* simplify some configuryPaolo Bonzini2009-10-142-20/+1
| | | | | | | | 2009-10-14 Paolo Bonzini <bonzini@gnu.org> * configure.ac: Remove obselete configure tests. * sed/fmt.c: Assume limits.h is always present. * sed/utils.c: Assume vfprintf is always present.
* make -u unbuffer input files as per the documentationPádraig Brady2009-07-223-6/+11
| | | | | | * sed/execute.c: call setvbuf() to turn off input buffering * sed/sed.c: rename unbuffered_output to more accurate unbuffered * sed/sed.h: ditto
* preserve security contexts too on sed -iPaolo Bonzini2009-06-262-1/+42
| | | | | | | 2009-06-25 Paolo Bonzini <bonzini@gnu.org> * autoboot.conf: Add selinux-h. * execute.c: Copy over file creation context before creating a new file.
* security fixes for partially created filesPaolo Bonzini2009-06-262-15/+26
| | | | | | | 2009-06-25 Paolo Bonzini <bonzini@gnu.org> * execute.c: Do not copy ACLs until the file is copied. * utils.c (ck_mkstemp): Set a restrictive umask on temporary files.
* fix off-by-one bug causing -i problems under CygwinPaolo Bonzini2009-06-111-1/+1
| | | | | | | 2009-06-11 Sergey Farbotka <z8sergey8z@gmail.com> (tiny change) * sed/execute.c (open_next_file): Fix off-by-one causing problems under Cygwin.
* fix bug with s/[[[]//Paolo Bonzini2009-05-111-3/+4
| | | | | | | | | | | | | | | 2009-05-11 Paolo Bonzini <bonzini@gnu.org> * sed/compile.c (snarf_char_class): Fix logic bug with [[[ in regular expressions (and a possibly uninitialized use of variable delim stemming from the bug). Uninitialized variable bug reported by Zhongxing Xu. * testsuite/brackets.good: New. * testsuite/brackets.inp: New. * testsuite/brackets.sed: New. * testsuite/Makefile.am: Add test. * testsuite/Makefile.tests: Add test. 2009-05-11 Paolo Bonzini <bonzini@gnu.org>
* fix copyright years and noticePaolo Bonzini2009-05-113-7/+5
| | | | | | | | | | | | 2009-05-11 Paolo Bonzini <bonzini@gnu.org> * configure.ac: Define COPYRIGHT_YEAR. * Makefile.am (dist-hook): Test it. * sed/mbcs.c: Fix copyright years. * sed/sed.c: Fix copyright years. Change COPYRIGHT_NOTICE to COPYRIGHT_YEAR. * sed/utils.c: Fix copyright years. * testsuite/version.gin: Use COPYRIGHT_YEAR.
* declare bool arguments as int instead to please AIX XLCPaolo Bonzini2009-04-304-17/+17
| | | | | | | | | 2009-04-30 Paolo Bonzini <bonzini@gnu.org> * sed/compile.c: Declare bool arguments as int instead to please AIX XLC. * sed/execute.c: Declare bool arguments as int instead to please AIX XLC. * sed/utils.c: Declare bool arguments as int instead to please AIX XLC. * sed/utils.h: Declare bool arguments as int instead to please AIX XLC.
* fixes after Bruno's testingPaolo Bonzini2009-04-274-20/+12
| | | | | | | | | | | | | | | | 2009-04-27 Paolo Bonzini <bonzini@gnu.org> * configure.ac: Link readin.in2 into builddir. * configure: Regenerate. * doc/Makefile.am: Do not distribute sed.html. Do not update sed.texi if the output does not change. * sed/Makefile.am: Order libraries according to their dependencies. * sed/compile.c (get_openfile): Declare FAIL as int. * sed/sed.c: Avoid printf ("") if REG_PERL is not defined. * testsuite/eval.in2: Do not include in the repository. * testsuite/Makefile.am: Clean always eval.in2 and never readin.in2. * testsuite/Makefile.tests: Provide a default empty definition of TIME and remove rules for readin.in2.
* improve `sed --version' outputPaolo Bonzini2009-03-311-16/+21
| | | | | | | | | | | | | | | | | 2009-03-31 Paolo Bonzini <bonzini@gnu.org> * sed/sed.c (contact): New. (usage): From here. (main): Use it for `sed --version' too. * configure.ac: Point to GNU project mailing lists. * sed/sed.c (contact): Use PACKAGE_BUGREPORT. * testsuite/version.gin: Likewise. * testsuite/version.good: Regenerate. * doc/sed.1: Regenerate. * bootstrap.sh.in (PACKAGE_BUGREPORT): New. * bootstrap.sh: Regenerate.
* include homepage URL in help messages.Paolo Bonzini2009-02-171-1/+6
| | | | | | | 2009-02-17 Paolo Bonzini <bonzini@gnu.org> * sed/sed.c (usage): Print homepage URL. * testsuite/version.gin: Update.
* do not print the bug report address when --help is printed and exit status != 0Paolo Bonzini2009-01-281-1/+10
| | | | | | | | | 2009-01-28 Paolo Bonzini <bonzini@gnu.org> * sed/sed.c (usage): Only print the bug report address for `sed --help'. (main): Print it for `sed --version' too. * testsuite/version.gin: Adapt. * testsuite/Makefile.tests: Refine help message test.
* fixPaolo Bonzini2009-01-231-1/+1
|
* fix parsing of s commands for MBCS codes including \x5cPaolo Bonzini2009-01-232-6/+7
| | | | | | | | 2009-01-23 Paolo Bonzini <bonzini@gnu.org> Hideo AOKI <hideo.aoki.tk@hitachi.com> * sed/compile.c (match_slash): Fix MBCS behavior. * sed/sed.h (MBSINIT): New.
* fix "x", "g", "G" commands with "sed -i" to match BSD sedPaolo Bonzini2009-01-051-1/+2
| | | | | | | 2009-01-05 Paolo Bonzini <bonzini@gnu.org> * execute.c (read_pattern_space): Reset hold space at end-of-file if input->reset_at_next_file.
* Let --posix turn off more GNU extensions.Ralf Wildenhues2008-12-311-5/+18
| | | | | | | | | | | | | 2008-12-31 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> Let --posix turn off more GNU extensions. * sed/compile.c (mark_subst_opts): Turn off subst options i, I, s, S, x, X, m, and M in --posix mode. (compile_address): Disallow address modifiers, `FIRST~STEP', `ADDR1,+N', and `ADDR1,~N' in --posix mode. (compile_program): In --posix mode, do not accept e or z commands; do not accept text between an a, c, or i command and the following backslash; do not accept an argument to the l command.
* switch to external gettextJim Meyering2008-10-031-3/+2
| | | | | | | | | | 2008-10-03 Paolo Bonzini <bonzini@gnu.org> Jim Meyering <meyering@redhat.com> * Makefile.am: Remove intl subdir. Require Automake 1.10. * configure.ac: Remove useless macros, switch to external gettext. * lib/Makefile.am: Remove intl subdir from CPPFLAGS. * sed/Makefile.am: Remove intl subdir from CPPFLAGS.
* add `z' extensionPaolo Bonzini2008-09-292-0/+5
| | | | | | | | | | | | | | | 2008-09-29 Paolo Bonzini <bonzini@gnu.org> * BUGS: Document s/.*.// behavior with invalid multibyte sequences. * NEWS: Document `z' extension. * doc/sed-in.texi: Document both things. * sed/compile.c (compile_program): Recognize `z'. * sed/execute.c (execute_program): Execute `z'. * testsuite/Makefile.am: Add badenc test. * testsuite/Makefile.tests: Add badenc test. * testsuite/badenc.good: New. * testsuite/badenc.inp: New. * testsuite/badenc.sed: New.
* update gnulibPaolo Bonzini2008-09-281-0/+2
| | | | | | | | | | 2008-09-28 Paolo Bonzini <bonzini@gnu.org> * basicdefs.h: Replace alloca cruft with alloca.h. * bootstrap.sh.in: Update for new gnulib. * bootstrap.sh: Update for new gnulib. * configure.ac: Move gnulib macros earlier. * sed/execute.c: Do not include acl.h when bootstrapping.