Commit Graph

171 Commits

Author SHA1 Message Date
Glenn L McGrath
8aac05bfe5 Patch from Rob Landley
Fixed a memory leak in add_cmd/add_cmd_str by moving the allocation
of sed_cmd down to where it's actually first needed.
                                                                                
In get_address, if index_of_next_unescaped_regexp_delim ever failed, we
wouldn't notice because the return value was added to idx, which was 
already guaranteed to be > 0.  (This is buried in the changes made when 
I redid get_address to be based on pointer arithmetic, because all the tests 
were gratuitously dereferencing with a constant zero, which wasn't obvious.)
         
Comment in parse_regex_delim was wrong: 's' and 'y' both call it.
 
The reason "sed_cmd->num_backrefs = 0;" isn't needed is that sed_cmd was
allocated with cmalloc, which zeroes memory.

Different handling of space after \ in i...

Different handling of pattern "s/a/b s/c/d"

Cool, resursive reads don't cause a crash. :)

Fixed "sed -f blah filename - < filename" since GNU sed was handling 
both - and filenames on the same line.  (You can even list - more than 
once, although it's immediate EOF...)
2003-09-14 04:06:12 +00:00
Glenn L McGrath
7c59a83a77 Stupid typo 2003-09-14 02:37:46 +00:00
Glenn L McGrath
4dc1d25a30 Fix some memory allocation problems 2003-09-14 01:25:31 +00:00
Glenn L McGrath
f36635cec6 Fix the following testcase by disabling global substitution if the regex
is anchored to the start of line, there can be only one subst.
echo "aah" | sed 's/^a/b/g'
2003-09-13 15:12:22 +00:00
Glenn L McGrath
c18ce373a2 Fix the following testcase by storing the state of the adress match with
the command.
# cat strings
a
b
c
d
e
f
g
# ./busybox sed '1,2d;4,$d' <strings
c
# ./busybox sed '4,$d;1,2d' <strings
# sed '4,$d;1,2d' <strings
c
# sed '1,2d;4,$d' <strings
c
2003-09-13 06:57:39 +00:00
Glenn L McGrath
9b04f1841e Fix the substitution print subcommand, it should only print if its
own substitution matched, not previous ones.
e.g
echo fooba | sed -n 's/foo//;s/bar/found/p'
shouldnt print anything
2003-08-30 04:35:07 +00:00
Eric Andersen
9c3c38da55 Patch from Terje Kvernes adding quite a lot of missing documentation 2003-07-22 09:59:34 +00:00
Eric Andersen
cb81e6484d Update a bunch of docs. Run a script to update my email addr. 2003-07-14 21:21:08 +00:00
Eric Andersen
e5642119ee Patch from Thomas Cameron:
Hello all,
	    This patch adds more "Help" text to the config system.  Almost
    all applets now have a help entry.  Also, I cleaned up the spacing of
    the existing text so that things are consistent.  This patch is against
    this morning's CVS.

    Thomas Cameron
    CEI Systems, Inc.
2003-07-14 19:37:08 +00:00
Eric Andersen
65e20a33c2 Patch from Kent Robotti adding a bunch of needed docs!
-Erik
2003-07-05 07:52:35 +00:00
Glenn L McGrath
655d814d75 New applet: patch, applies a unified diff 2003-06-22 15:32:41 +00:00
Glenn L McGrath
91e1978ff0 New commands, 'G' and 'H' 2003-04-26 07:40:07 +00:00
Glenn L McGrath
fc4cb4dbb5 Fix logic error in grouped commands 2003-04-12 16:10:42 +00:00
Glenn L McGrath
d4185b0e15 Fix up indenting 2003-04-11 17:10:23 +00:00
Glenn L McGrath
d7fe39b587 Really fix the 'r' command 2003-04-09 15:52:32 +00:00
Glenn L McGrath
d87a7ac269 Fix the sed 'r' command 2003-04-09 15:26:14 +00:00
Glenn L McGrath
2410386611 fix substitution when replacing with &, we shouldnt check for an escape charcter. Its already been taken care of _somewhere_ else 2003-04-09 07:51:43 +00:00
Glenn L McGrath
bd9b32bc0d Label ends at a newline, update comments, rename linked list field 2003-04-09 01:43:54 +00:00
Glenn L McGrath
8d6395d41a Run through indent 2003-04-08 11:56:11 +00:00
Glenn L McGrath
c1d95076f0 Fixes block commands to correctly identify end of block, recognise the #n directive, fix substitue command when regex isnt specified 2003-04-08 06:42:45 +00:00
Glenn L McGrath
7ce9e247f0 Add hold space commands 'g', 'h', 'x' 2003-04-07 16:04:14 +00:00
Glenn L McGrath
c6adada158 Rename "line" to pattern_space to be more descriptive and closer to the POSIX description 2003-04-07 12:24:44 +00:00
Glenn L McGrath
9a52bb6878 Group common string 2003-03-30 09:38:40 +00:00
Glenn L McGrath
30b47df86b Small fix for sed 'y' command 2003-03-30 08:40:09 +00:00
Glenn L McGrath
f01b46d7dd sed 'y' command, simplify some other code 2003-03-30 08:02:18 +00:00
Glenn L McGrath
0c51832b60 Experimental support for embeded newline. (im evil)
Fix segfault when using 'N' with an odd number of lines.
2003-03-30 03:41:53 +00:00
Glenn L McGrath
a0f0f0cf76 Still fine tunning the printing of the substitute command 2003-03-28 14:11:34 +00:00
Glenn L McGrath
595a6a4199 sed 't' branching command 2003-03-28 08:36:52 +00:00
Glenn L McGrath
ccd43a8301 Fix sed 's' command's 'p' flag, so it can print line twice 2003-03-28 07:44:03 +00:00
Glenn L McGrath
b08e3e8c2e fix q command 2003-03-28 04:57:52 +00:00
Glenn L McGrath
961c6c19da Add basic branching support, sed ':' and 'b' commands 2003-03-28 04:43:39 +00:00
Glenn L McGrath
56c633c139 make sed cleanup use linked list 2003-03-28 04:23:23 +00:00
Glenn L McGrath
c949bfa555 Use a linked list for sed commands in preparation for branching support 2003-03-28 03:53:31 +00:00
Manuel Novoa III
cad5364599 Major coreutils update. 2003-03-19 09:13:01 +00:00
Glenn L McGrath
e01f9662a5 Match newlines, this fixes matching of ^ or $ when there is a '\n' in the pattern being matched. This fixes cases when the N command is used. 2003-03-18 08:37:57 +00:00
Glenn L McGrath
2971ef1730 Fix a bug that corrupted the string followed commands that had no arguments (Closes #1304) 2003-03-18 01:19:23 +00:00
Glenn L McGrath
4157a8a71e fix n, add N, P 2003-03-10 04:12:35 +00:00
Glenn L McGrath
ff724fb076 add the 'n' command 2003-03-10 02:56:56 +00:00
Glenn L McGrath
bed4033e96 Add the q (quit) option 2003-03-10 02:21:14 +00:00
Glenn L McGrath
f3bd7c4631 Fix a delimiter matching bug i introduced. 2003-03-09 15:40:40 +00:00
Glenn L McGrath
f50ce3135f Support grouped commands, i.e. {cmd1;cmd2} 2003-03-09 15:12:24 +00:00
Glenn L McGrath
4c6523a90b alloc array for commands, use string ptr in parse_command_string() 2003-03-09 11:06:38 +00:00
Glenn L McGrath
e7a8bc949b use typedef for struct sed_cmd 2003-03-09 10:23:57 +00:00
Glenn L McGrath
1fb446795d redo get_addres(). save some space. possible fix a bug where the command might be set to 0 if no second address is given. dont parse sed_cmd struct to get_address, we only need the delim field. 2003-03-09 08:44:49 +00:00
Glenn L McGrath
2f8a401772 Woops, remove the code i didnt mean to commit 2003-03-09 02:44:49 +00:00
Glenn L McGrath
d5eadea970 Mention the opengroup sed reference, add a check which is disabled at present. 2003-03-09 02:39:29 +00:00
Glenn L McGrath
505bd0f15a Fix matching for the $ address (last line) 2003-03-08 05:21:02 +00:00
Glenn L McGrath
0a65e190f4 Support the '=' command 2002-12-23 10:16:12 +00:00
Eric Andersen
c9f20d9fb9 Yet another major rework of the BusyBox config system, using the considerably
modified Kbuild system I put into uClibc.  With this, there should be no more
need to modify Rules.mak since I've moved all the interesting options into the
config system.  I think I've got everything updated, but you never know, I may
have made some mistakes, so watch closely.
 -Erik
2002-12-05 08:41:41 +00:00
Glenn L McGrath
7127b58baa Fix crashme code, by Jim Treadway 2002-12-03 21:48:15 +00:00