Commit Graph
122 Commits
Author SHA1 Message Date
Paolo Bonzini e8066f09db do not open input files with "rt" mode, do not assume "rt" is supported
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.
2012-02-13 15:46:14 +01:00
Paolo Bonzini a085906489 add -z/--null-data
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.
2012-02-05 12:08:57 +01:00
Paolo Bonzini 727d6fa860 document that . does not match newline in multi-line mode
2011-11-23  Paolo Bonzini  <bonzini@gnu.org>

	* doc/sed-in.texi: Document how multiline mode affects matching
	newlines against period.  Reported by Dmitry Bolshakov.
2011-11-23 14:58:14 +01:00
Paolo Bonzini dd275ee12a fix help text for -i
2011-08-29  Paolo Bonzini  <bonzini@gnu.org>

	* sed/sed.c (usage): Fix documentation for -i.  Reported by
	Dennis Bartlett.
2011-08-29 10:29:16 +02:00
Jim Meyering bed0c78aa7 avoid silent data loss when an input line is 231 bytes or longer
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.
2011-07-11 18:37:21 +02:00
Pádraig Brady 629ef76a75 avoid reopening stdin
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.
2011-07-04 12:45:19 +02:00
Paolo Bonzini 607d56e084 document corner case of \l and \u, and simplify the code handling it
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.
2011-05-27 09:37:25 +02:00
Paolo Bonzini b63b148631 fix incorrect comments in the "Increment a number" example.
2011-05-27  Paolo Bonzini  <bonzini@gnu.org>

	* doc/sed-in.texi: Fix incorrect comment in the "Increment a
	number" example.  Reported by Wu Liang and Micah Cowan.
        * doc/sed.texi: Regenerate.
2011-05-27 09:26:56 +02:00
Paolo Bonzini ad08a50484 clang analyzer cleanups
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.
2011-03-11 13:25:11 +01:00
Jari Aalto 5b1925c3c9 order command alphabetically in man page
2010-11-13  Jari Aalto  <jari.aalto@cante.net>

	* doc/sed.x: Order commands alphabetically.
2010-12-13 14:05:34 +01:00
Paolo Bonzini 3ce4f9f423 small fixes to "rename files" example
2010-11-10  Paolo Bonzini  <bonzini@gnu.org>

	* doc/sed-in.texi: Fix double negation in comment, escape
	file names.
2010-12-10 08:58:24 +01:00
Eric Blake 5c350ae11f avoid compiler warnings regarding ctype functions
* basicdefs.h (ISDIGIT): Avoid compiler warning on cygwin.
* sed/compile.c (normalize_text): Avoid undefined behavior.
2010-11-03 17:13:59 +01:00
Eric Blake c25e88a930 avoid compiler warning
* sed/sed.c (includes): Supply missing header.
2010-11-03 17:13:49 +01:00
Eric Blake d7b21d511a avoid compiler warning
* sed/sed.c (includes): Supply missing header.
2010-11-03 17:13:12 +01:00
Paolo Bonzini ddf5e28afb downgrade minimum requested version of gettext to 0.17.
2010-11-01  Paolo Bonzini  <bonzini@gnu.org>

	* autoboot.conf: Replace gettext with gettext-h.  Suggested by
	Gerald Pfeifer and Eric Blake.
	* configure.ac: Downgrade minimum requested version of gettext
	to 0.17.
2010-11-01 15:34:18 +01:00
Paolo Bonzini 699fd06fad Commit regenerated doc/sed.texi 2010-11-01 15:33:53 +01:00
Paolo Bonzini 8eee8cbf0e 2010-10-31 Gerald Pfeifer <gerald@pfeifer.com>
* doc/sed-in.texi (Extended regexps): Add '|' to the list of
	differences.  Note that "\|" is a GNU extension to begin with.
2010-10-31 22:56:15 +01:00
Paolo Bonzini 30b44d95a2 fix lseek errors from flushing input pipes on interix
2010-10-20  Paolo Bonzini  <bonzini@gnu.org>

	* autoboot.conf: Add fwriting.
	* sed/utils.c: Use it.
2010-10-20 19:57:31 +02:00
Paolo Bonzini 1c3de3387c change bug reporting address to bug-sed@gnu.org
2010-09-20  Paolo Bonzini  <bonzini@gnu.org>

	* doc/configure.ac: Mention bug-sed@gnu.org.
	* doc/sed.x: Mention bug-sed@gnu.org.
	* doc/sed-in.texi: Mention bug-sed@gnu.org.
2010-10-20 19:57:09 +02:00
Paolo Bonzini a9bf076c0b use version-etc-fsf
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.
2010-08-30 12:18:50 +02:00
Paolo Bonzini 7355d316a5 use "w" or "wb" modes for sed -i, s///w, w' and W' depending on --binary
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.
2010-08-17 01:56:55 +02:00
Paolo Bonzini e1c76b0344 fix imprecision in the documentation of `D'
2010-08-17  Paolo Bonzini  <bonzini@gnu.org>

	Fix imprecision in the documentation of `D'.
	* doc/sed-in.texi (D command): Fix documentation of behavior for
	pattern space ending with \n and with no other newline.
	Reported by Randall Cotton.
	* doc/sed.x (D command): Fix documentation of behavior for
	pattern space ending with \n and with no other newline.
	* doc/sed.texi: Regenerate.
	* doc/sed.1: Regenerate.

2010-07-19  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2010-08-17 01:56:36 +02:00
Ralf Wildenhues fbf10902f7 Let --posix turn off nonportable scripts ending in backslash.
* 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.
2010-08-17 01:56:36 +02:00
Paolo Bonzini a85e83d0db use mkostemp(template, 0) instead of mkstemp to work around Cygwin oddity
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.
2010-07-16 22:01:35 +02:00
Paolo Bonzini 9c560534c8 fix typo in the manual
2010-05-03  Timothy Baker  <timothypaulbaker@gmail.com> (tiny change)

	* doc/sed.texi (Regular expressions): Fix typo.
2010-05-03 09:27:07 +02:00
Ralf Wildenhues 84066bf615 add F command.
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.
2009-12-27 17:18:29 +01:00
Paolo Bonzini 5d7d2b1cc2 fix debian bug 559539
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".
2009-12-07 14:40:18 +01:00
Paolo Bonzini 896b696912 fix ordering of chmod/chown operations
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>
2009-10-15 19:59:17 +02:00
Paolo Bonzini 20f68fb1ab handle incomplete sequences as if they were invalid
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.
2009-10-15 19:59:10 +02:00
Paolo Bonzini db462e5466 update .pot file
2009-10-14  Paolo Bonzini  <bonzini@gnu.org>

	* po/sed.pot: Update.
2009-10-14 11:18:30 +02:00
Paolo Bonzini db7165280c more configury simplification
2009-10-14  Paolo Bonzini  <bonzini@gnu.org>

	* configure.ac: Use cache variables rather than AC_CHECK_FUNC.
2009-10-14 11:11:42 +02:00
Paolo Bonzini 089b72a0fe simplify some configury
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.
2009-10-14 11:06:05 +02:00
Yury G. Kudryashov 8507c64bf5 override LC_ALL in testsuite rather than LANG
2009-10-14  Yuri G. Kudryashov  <urkud.urkud@gmail.com> (tiny change)

	* testsuite/Makefile.tests: Override LC_ALL, not LANG.
2009-10-14 10:52:16 +02:00
Ralf Wildenhues 0827424285 manual fixes
2009-10-12  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

	* doc/sed-in.texi (Invoking sed): Add index entries for --posix,
	-s, --separate.
	(Other Commands): Fix typo.
	* doc/sed.texi: Regenerate.
2009-10-12 11:03:58 +02:00
Paolo Bonzini 365065b1d4 document how to separate commands
2009-09-07  Dmitry Chistikov <dd1email@gmail.com> (tiny change)

	* doc/sed-in.texi: Document how to separate commands.
2009-09-07 08:55:31 +02:00
Paolo Bonzini aa30554331 configury tweaks
2009-08-30  Paolo Bonzini  <bonzini@gnu.org>

	* autoboot.conf: Add ssize_t.
	* configure.ac: Remove useless stuff, bump gettext requirement to 0.17.
2009-08-31 10:16:39 +02:00
Bake Timmons 593ca11bb8 Fix documentation typo.
2009-08-10  Bake Timmons  <b3timmons@speedymail.org> (tiny change)

	* doc/sed-in.texi: Fix typo.
2009-08-10 20:08:03 +02:00
Paolo Bonzini feaa20792f bump version number to 4.2.1
2009-06-27  Paolo Bonzini  <bonzini@gnu.org>

	* configure.ac: Bump version.
	* NEWS: Bump version.
	* gnulib: Update.
	* doc/sed.1: Regenerate.
2009-06-27 15:25:59 +02:00
Paolo Bonzini fa01dd7e73 preserve security contexts too on sed -i
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.
2009-06-26 12:13:56 +02:00
Paolo Bonzini 5156c19b23 security fixes for partially created files
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.
2009-06-26 12:03:10 +02:00
Paolo Bonzini 06f17e218d do not use GIT_CONFIG_LOCAL
2009-06-26  Paolo Bonzini  <bonzini@gnu.org>

	* autoboot: Do not use GIT_CONFIG_LOCAL.
2009-06-26 12:01:50 +02:00
Paolo Bonzini db28fcc669 add memchr module from gnulib again
2009-06-15  Paolo Bonzini  <bonzini@gnu.org>

	* autoboot.conf: Add memchr again.
	* gnulib: Update.
2009-06-15 11:05:36 +02:00
Paolo Bonzini a9841cc3f2 fix off-by-one bug causing -i problems under Cygwin
2009-06-11  Sergey Farbotka  <z8sergey8z@gmail.com>  (tiny change)

	* sed/execute.c (open_next_file): Fix off-by-one causing problems
	under Cygwin.
2009-06-11 12:09:31 +02:00
Paolo Bonzini 601f290184 fix bug with s/[[[]//
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>
2009-05-11 10:47:06 +02:00
Paolo Bonzini ff839b08be fix copyright years and notice
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.
2009-05-11 10:47:05 +02:00
Paolo Bonzini af03c28be2 declare bool arguments as int instead to please AIX XLC
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.
2009-04-30 10:47:30 +02:00
Paolo Bonzini 4381be08bd bump version 2009-04-28 08:55:08 +02:00
Paolo Bonzini d42713f37e fix readin test properly
2009-04-27  Paolo Bonzini  <bonzini@gnu.org>

	* configure.ac: Do not create homonymous links from builddir to srcdir.
	* testsuite/Makefile.tests: Create readin.in2 here.
	* testsuite/Makefile.am: Do not distribute it.
2009-04-28 08:55:08 +02:00
Paolo Bonzini f83ff94827 add rename module from gnulib
2009-04-27  Paolo Bonzini  <bonzini@gnu.org>

	* autoboot.conf: Add rename.
	* gnulib: Update.

2009-04-27  Paolo Bonzini  <bonzini@gnu.org>
2009-04-28 08:55:07 +02:00
Paolo Bonzini 03c3b0f2dc XFAIL utf8 tests where appropriate
2009-04-27  Paolo Bonzini  <bonzini@gnu.org>

	* configure.ac: XFAIL UTF-8 tests where appropriate.
2009-04-28 08:55:07 +02:00