| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
1) Add missing parens around assignment that is compared to zero.
2) Make some variables that only take non-negative values unsigned.
3) Some casts/type changes to fix other constness warnings.
4) Make one variable a const char *.
5) Make sure termwidth is positive, it doesn't make sense for it to be negative.
Approved by: dds
|
|
|
|
| |
Found by: CScout
|
|
|
|
|
|
|
|
|
|
|
| |
whether we should ignore case, determine the flag by calling
compile_flags() first. Also, make sure that we obtain an
initialized cmd->u.s buffer before processing further. We
may want to refine this solution later, but for now, make
the changes in order to unbreak world build after a sed(1)
with rev. 1.29 of compile.c is installed.
Approved by: re (hrs)
|
|
|
|
|
|
|
|
|
| |
For example,
sed /foo/Id
sed s/foo/bar/Ig
Reviewed by: dds
Approved by: re (hrs)
|
|
|
|
|
|
|
| |
anything but the pattern space anyway. Apply style(9)
to the macro.
Tested with: md5(1)
|
|
|
|
|
|
|
|
| |
when in -i mode so that each file gets a clean context of its own.
Add a regression test for the bug.
Tested with: regression tests
|
|
|
|
|
|
|
| |
and mf_fgets(): APPEND. So use it instead of a 0 constant for
clarity.
Tested with: md5(1)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
each file independently from other files. The new semantics are
desired in the most of practical cases, e.g.: delete lines 5-9
from each file.
Keep the previous semantics of -i under a new option, -I, which
uses a single continuous address space covering all files to edit
in-place -- they are too cool to just drop them.
Add regression tests for -i and -I.
Approved by: dds
Compared with: GNU sed
Discussed on: -hackers
MFC after: 2 weeks
|
|
|
|
|
|
| |
Use a single space before $FreeBSD$ to avoid terminal line overflow.
Pointed out by: ru (The All-Seeing Eye)
|
|
|
|
| |
second address is a line number.
|
|
|
|
| |
Add $FreeBSD$ to please commit_prep.pl.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
and had no chance to match it by the 2nd address precisely.
Otherwise the unclosed range would bogusly extend to the end
of stream.
Add a basic regression test for the bug fixed. (This change
also fixes the more complex case 5.3 from `multitest.t'.)
Compared with: SUN and GNU seds
Tested by: regression tests
MFC after: 1 week
|
|
|
|
|
|
|
|
| |
in parentheses. The ?: operator has a remarkably low precedence, so
expressions like (MATCH(foo) && bar) would have an unexpected meaning
w/o the parentheses around MATCH().
Tested with: md5(1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
them are related to the `c' function's need to know if we are at
the actual end of the address range. (It must print the text not
earlier than the whole pattern space was deleted.) It appears the
only sed function with this requirement.
There is `lastaddr' set by applies(), which is to notify the `c'
function, but it can't always help because it's false when we are
hitting the end of file early. There is also a bug in applies()
due to which `lastaddr' isn't set to true on degenerate ranges such
as `$,$' or `N,$' if N appears the last line number.
Handling early EOF condition in applies() could look more logical,
but it would effectively revert sed to the unreasonable behaviour
rev. 1.26 of main.c fought against, as it would require lastline()
be called for each line within each address range. So it's better
to call lastline() only if needed by the `c' function.
Together with this change to sed go regression tests for the bugs
fixed (c1-c3). A basic test of `c' (c0) is also added as it helped
me to spot my own error.
Discussed with: dds
Tested by: the regression tests
MFC after: 1 week
|
| |
|
|
|
|
| |
into the regression testing framework.
|
|
|
|
|
|
|
|
|
|
| |
used once on a non-empty pattern space and then again on an empty
pattern space, the second usage restores the pattern space length to
the length that it had when the first "P" was used.
PR: bin/96052
Submitted by: Andrey Zholos <aaz@althenia.net>
MFC after: 7 days
|
|
|
|
| |
Submitted by: Leonardo Chiquitto Filho
|
|
|
|
|
|
|
|
| |
cause the next substitute flag to be ignored.
While working at it, detect and report overflows.
Reported by: Jingsong Liu
MFC after: 1 week
|
|
|
|
| |
Approved by: re (blanket)
|
|
|
|
|
|
| |
PR: bin/78692
Submitted by: Eugene Grosbein
MFC after: 2 weeks
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
software (original contributor).
Reviewed by: imp
|
|
|
|
| |
delimiters with the 's' and 'y' commands.
|
| |
|
| |
|
| |
|
|
|
|
| |
up more than one column position, and null bytes.
|
|
|
|
| |
by POSIX.
|
| |
|
| |
|
|
|
|
|
|
|
| |
When sed is asked to inline-edit files, it forgets to close the temporary
file and runs out of descriptors for long command lines (assuming you reset
kern.maxfilesperproc to something sane that's less than the number of files
passed to sed).
|
|
|
|
|
|
| |
from the original author of math.sed.
Submitted by: K S Braunsdorf <sed@ksb.npcguild.org>
|
| |
|
|
|
|
|
| |
Discovered by: Vladimir Kravchenko <jimson@mostcom.ru>
Pointy hat to: des
|
|
|
|
|
|
|
| |
make an effort to preserve the ownership and mode of the file we are
editing.
Sponsored by: Registrar AS
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
subtract one unsigned number from another potentially smaller
one, leading to wraparound (and heap corruption, eventually).
PR: 58813
MFC after: 2 weeks
|
|
|
|
|
| |
Reviewed by: schweikh (mentor)
MFC after: 2 weeks
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
regular expression as the first argument to a substitute command. If
used to test a sed which (erroneously) evaluates this at translation
time rather than at execution time, the bugged sed is put into an
infinite loop. This mode of failure seems excessive. Such a failing
sed is the Free Software Foundation's sed 3.02.
The specific test was also not being executed for the BSD sed.
Both problems are now fixed.
PR: misc/25585
Submitted by: Walter Briscoe <w.briscoe@ponl.com>
Approved by: schweikh (mentor)
MFC after: 2 weeks
|
|
|
|
|
|
|
|
| |
whose true and false clauses were equivalent with a check that we are
not about to stumble off the end of the line.
Reported by: peter
Pointy hat to: fanf
|
|
|
|
|
|
|
|
|
| |
There are two bugs: in the s///g case, the substitution didn't occur
at the end of the line; in the s///N case, the code didn't count
forwards along the line properly. See the sg, s3, s4, and s5 tests
in src/tools/regression/usr.bin/sed/.
Reviewed by: tjr
|