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
Aaron Lehmann
a170e1c858
Change if(x)free(x); to free(x);
2002-11-28 11:27:31 +00:00
Robert Griebl
00f5ecb141
Somehow I applied an old patch for the last commit - this one works now:
...
- Added \CregexC support to sed (sed testsuite reported no errors, btw)
2002-08-06 23:13:31 +00:00
Robert Griebl
7940147e25
Added the \CregexpC syntax as an alternative for /regexp/ (like GNU sed)
2002-08-06 21:07:17 +00:00
Eric Andersen
2276d83639
Fixup warnings and undefined operations that show up in gcc-3.1
...
-Erik
2002-07-11 11:11:56 +00:00
Robert Griebl
47abc49c4a
Patch from Simon Krahnke:
...
I wrote a patch for busybox for our company's (www.lisa.de)
private use. [...] To sed it adds the '!'-inversion of addresses.
2002-06-11 23:43:27 +00:00
Matt Kraai
5c69cd84ff
* editors/sed.c (process_file): Stop processing deleted lines.
...
* testsuite/sed/sed-does-not-substitute-in-delete-line: New.
2002-04-01 16:17:37 +00:00
Matt Kraai
9eaf059d28
* editors/sed.c (parse_cmd_str): Remove redundant code to skip initial
...
whitespace.
2002-01-03 21:19:19 +00:00
Matt Kraai
5ed78adca5
* editors/sed.c (parse_edit_cmd): Rewrite.
...
* testsuite/sed/sed-splits-edit-commands-on-command-line: New.
2002-01-03 21:12:34 +00:00
Matt Kraai
d21735de2d
* editors/sed.c (parse_edit_command): Require a newline after the backslash
...
after an edit command.
* testsuite/sed/sed-requires-newline-after-edit-command: New.
2002-01-02 17:56:38 +00:00
Matt Kraai
70624846fd
Ignore blanks before the first address and before the command.
2001-12-21 16:04:12 +00:00
Matt Kraai
0c390a76fe
Eliminate warning.
2001-11-20 16:00:19 +00:00
Eric Andersen
9c6b5fcb0a
Minor warning cleanups
2001-11-17 07:23:46 +00:00
Matt Kraai
c8227639db
Change strdup calls to xstrdup (patch from Steve Merrifield).
2001-11-12 16:57:27 +00:00
Matt Kraai
a5f09c668e
Use fopen wrapper.
2001-11-12 16:44:55 +00:00
Eric Andersen
c52a6b0f10
|2001-10-08 Rodney Brown <rbrown64@csc.com.au>
...
|
| * editors/sed.c: Fix multiline [aic] commands. Make # an endline
| comment for compatibility. Codespace reduction.
| * tests/testcases: Cope with move to subdirectories.
| * testsuite/sed/sed-aic-commands: Add.
|
| text data bss dec hex filename
| 3772 16 0 3788 ecc editors/sed.o
| 4516 16 0 4532 11b4 editors/sed.o.bu
2001-11-10 10:49:42 +00:00
Eric Andersen
bdfd0d78bc
Major rework of the directory structure and the entire build system.
...
-Erik
2001-10-24 05:00:29 +00:00
Matt Kraai
8470b9a85c
Fix empty line substitutions (noted by Joshua Hudson).
2001-10-23 21:12:07 +00:00
Matt Kraai
a0065d5955
Fix s/[/]// handling (noted by Dumas Patrice).
2001-08-24 14:45:50 +00:00
Eric Andersen
b76cb68979
A patch from Shu-Hao Chang <shuhao_chang@trend.com.tw> to
...
fixed sed handling of multiple -e commands
2001-08-22 05:58:16 +00:00
Matt Kraai
a3e4f455ac
Fix a problem with unsatisfied backrefs (noted by Martin Bene).
2001-08-20 21:21:06 +00:00
Matt Kraai
547e102082
Preserve whether or not the line was previously altered when running a
...
subst command (discovery and patch by Jim Gleason).
2001-07-30 14:05:58 +00:00
Matt Kraai
5009f90ea2
Removed obsolete function, strdup_substr.
2001-07-05 19:00:47 +00:00
Matt Kraai
ceeff73819
Rewrote mkdir (and touched lots of things in the process).
2001-06-21 19:41:37 +00:00
Matt Kraai
02c40a72b8
Always apply commands with no specified range.
2001-06-21 13:57:51 +00:00
Mark Whitley
0915c4b985
- Fixed bug where you couldn't mix line number and regexes in two-address cmds
...
- Fixed bug where you couldn't use two addresses for a 'c' cmd
- Moved the do_sed_cmd function into process_file to simplify some things
- Reduced a buncha lines of code in the process
2001-06-11 23:50:06 +00:00
Matt Kraai
6e9e136fcb
Use safe_strncpy.
2001-05-27 14:11:52 +00:00
Eric Andersen
77d9268892
Patch from larry to fix some grammar errors.
2001-05-23 20:32:09 +00:00
Matt Kraai
233817437d
Always print a newline after a matching substitution.
2001-05-17 01:02:58 +00:00
Mark Whitley
d928accbbd
...Need to print just a few more newlines.
2001-05-14 20:44:26 +00:00
Mark Whitley
dd527d3c62
...And now that we're chomping lines, we need to re-add the newline later...
2001-05-14 19:53:08 +00:00
Mark Whitley
9de2659264
We will chomp() lines so REG_NEWLINE does not break stuff. Thanks, Matt.
2001-05-14 19:44:44 +00:00
Mark Whitley
452cc1f293
Added REG_NEWLINE as cflags to xregcomp for normal addresses so EOL $ will work
2001-05-14 19:23:02 +00:00
Mark Whitley
1f3b9f297e
Added support for 'r' command in sed.
2001-05-11 22:27:13 +00:00
Mark Whitley
56c14a6473
Fixed a buglet where an extra newline was being added after an insert command
...
in some cases.
2001-04-20 23:41:44 +00:00
Mark Whitley
497ef46587
Made a correction to a bad test expression. Props to Larry Doolittle for
...
spotting this one.
2001-04-20 23:27:17 +00:00
Mark Whitley
af633757d3
Applied patch from Anthony Towns that he posted to Debian bug tracking.
2001-03-26 16:47:57 +00:00
Mark Whitley
038c8eb5a9
Applied patch from Erik Habbinga to fix a problem with an uninitialized
...
substitution delimiter.
2001-03-14 21:11:49 +00:00
Eric Andersen
b50da53e0c
Get rid of long stale usage message code.
...
-Erik
2001-02-17 16:52:35 +00:00
Eric Andersen
67991cf824
This patch, put together by Manuel Novoa III, is a merge of work
...
done by Evin Robertson (bug#1105) and work from Manuel to make
usage messages occupy less space and simplify how usage messages
are displayed.
2001-02-14 21:23:06 +00:00
Matt Kraai
05e782ddd3
Fix wget error message and add (and use) chomp library function.
2001-02-01 16:49:30 +00:00
Matt Kraai
dd19c69904
Removed trailing \n from error_msg{,_and_die} messages.
2001-01-31 19:00:21 +00:00
Eric Andersen
8ec10a9483
Fix up copyright msgs. Bump version to 0.49 in preparation for
...
a release. Update the website with release details.
-Erik
2001-01-27 09:33:39 +00:00
Eric Andersen
ed3ef50c23
Fix header file usage -- there were many unnecessary header files included in
...
busybox.h which slowed compiles. I left only what was needed and then fixed up
all the apps to include their own header files. I also fixed naming for pwd.h
and grp.h functions. Tested to compile and run with libc5, glibc, and uClibc.
-Erik
2001-01-27 08:24:39 +00:00
Mark Whitley
6c6ea6cba2
Changed email address to codepoet.org, updated list of applets / docs I
...
maintain in AUTHORS.
2001-01-04 22:21:13 +00:00
Eric Andersen
28b3c53f0d
I just whipped up support for arbitrary regex delimiters, so
...
now things such as
$ echo foo | sed 'sxfooxb\arx'
bar
will work as expected (and so doogie can stop complaining).
-Erik
2001-01-02 11:01:31 +00:00
Matt Kraai
a9819b2908
Use busybox error handling functions wherever possible.
2000-12-22 01:48:07 +00:00
Matt Kraai
1fa1adea2a
Change calls to error_msg.* and strerror to use perror_msg.*.
2000-12-18 03:57:16 +00:00
Mark Whitley
f57c944e09
Changed names of functions in utility.c and all affected files, to make
...
compliant with the style guide. Everybody rebuild your tags file!
2000-12-07 19:56:48 +00:00
Eric Andersen
f61caf0411
Remove unneeded junk
2000-11-14 20:31:45 +00:00
Mark Whitley
eb69ead091
Removed REG_NEWLINE from regcomp to fix the same bug found in grep where it
...
would not match blank lines (bug #1064 ). Followed Matt Kraii's suit on his
1.42 revision of grep. Tested it, works.
2000-11-03 20:23:49 +00:00
Mark Whitley
e7ff2842dd
Now, what was that logic block doing up there?
2000-11-03 20:02:35 +00:00
Mark Whitley
2dc192fd99
Re-worked the support for s///p, fixed a backref limit buglet, and cleaned up
...
a few other ugly places (do_subst_command got a much-needed overhaul). Also
took out BB_FEATURE_SED_PATTERN_SPACE from Config.h[.Hurd] as the 'p' is now a
standard feature (adds almost no bloat).
2000-11-03 19:47:00 +00:00
Matt Kraai
bbaef66b3f
Consolidate handling of some fopen failures.
2000-09-27 02:43:35 +00:00
Eric Andersen
3570a34de4
Renamed "internal.h" to the more sensible "busybox.h".
...
-Erik
2000-09-25 21:45:58 +00:00
Matt Kraai
322ae93a5e
Fix calls to {m,c,re}alloc so that they use x{m,c,re}alloc instead of
...
segfaulting or handling errors the same way themselves.
2000-09-13 02:46:14 +00:00
Mark Whitley
0e4cec0be8
Applied patch from Mark Ferrell <mferrell@mvista.com> to use the 'p' option in
...
substitution expressions.
2000-08-21 21:29:20 +00:00
Mark Whitley
40406e6bad
Applied patch from Mark Ferrell <mferrell@mvista.com> to fix sed '1,$p' where
...
sed was only printing the first line and then exiting.
2000-08-10 00:09:47 +00:00
Mark Whitley
83e85f6a08
Modified print_subst_w_backrefs() so it will print backslash escaped
...
characters properly, just like GNU sed.
2000-07-25 20:48:44 +00:00
Eric Andersen
b040d4f3da
Use BB_FEATURE_CLEAN_UP where appropriate
...
-Erik
2000-07-25 18:01:20 +00:00
Mark Whitley
1f45b268cb
As per a discussion on the mailing list between Matt and Pavel. I have removed
...
the -V (version) flag from busybox sed. It is unnecessary because sed is not a
standalone and should therefore be independently reporting a version number.
Moreover, it is extra code that we just don't need.
2000-07-20 23:08:40 +00:00
Matt Kraai
27a804246a
Centralize handling of --help.
2000-07-19 19:24:01 +00:00
Pavel Roskin
9c5fcc3408
New message added to messages.c: full_version
...
Used where possible
2000-07-17 23:45:12 +00:00
Mark Whitley
97562bd9d7
- Added support for backreferences in substitution expressions up to nine
...
(\1, \2...\9). This touched a lot of places in this file and I added a new
function 'print_subst_w_backrefs' in order to keep 'do_subst_command' a
little more tidy.
* I tested this good 'n hard, but will always appreciate more testing from
other, willing folks.
- Noticed that the index_of_next_unescaped_slash was subtly wrong so I
changed both the functionality and behavior (it used to skip over the first
char in the string you passed it, assuming it was a leading '/'--this
assumption is no longer made) this necessitated changing the lines that
call this function just slightly.
2000-07-17 20:06:42 +00:00
Matt Kraai
bf181b9338
Extract usage information into a separate file.
2000-07-16 20:57:15 +00:00
Mark Whitley
464c5de00d
Fixed a couple of buglets:
...
- add_cmd_str: segv's were being generated if there was a '# comment' line
(and probably other kinds of lines, too) that was not followed by a
semi-colon or whitespace
- parse_edit_cmd: was returning a wrong number (too low) for the index; it
was not accounting for backslashes eaten, for the fact that we start at the
3rd index in the string, or for the fact that we add an extra newline.
- parse_cmd_str: was returning a wrong number (again, too low) for the index
in the case of single-letter commands (p,d). There was some
over-compensation for this in the 'return' stmt at the end which also
needed some help.
- load_cmd_file: was not eating trailing newlines off the line read from the
command file. This had the deleterious effect of printing an extra newlines
after text displayed from edit (i,a,c) commands.
2000-07-14 23:24:00 +00:00
Mark Whitley
70705d7c96
- Added support for semicolon delimited command lines. (woo-hoo!)
...
- Obsoleted the trim_str function (#if 0'ed out -- maybedelete later) in
favor of strrspn.
- Obsoleted the strrspn function (#if 0'ed out as well) as soon as I
discovered that it wasn't needed either.
- Fixed a subtle bug in parse_subst_cmd where it would choke with an error if
there was any trailing space after the s/match/replace/ expression.
2000-07-14 19:06:30 +00:00
Matt Kraai
d537a95fdb
Use errorMsg rather than fprintf.
2000-07-14 01:51:25 +00:00
Mark Whitley
34623db618
It dawned on me that I would need to grow a char buffer one extra char bigger
...
to accomodate a trailing '\n'ewline that I append to it later one. This is
only necessary for the case of one inserted, appended, or changed line, but
it's still necessary.
2000-07-14 00:49:59 +00:00
Mark Whitley
02008346c0
Added error checking for edit commands; only a beginning address can be
...
specified.
2000-07-14 00:13:52 +00:00
Mark Whitley
94074a980c
Added support for (a)ppend, (i)nsert, and (c)hange commands to sed.
2000-07-14 00:00:15 +00:00
Mark Whitley
496e33feeb
Fixed bug where sed '/foo/p' was printing "invalid command".
2000-07-13 22:52:02 +00:00
Mark Whitley
4f7fe77d07
(Something I should have done in the previous checkin...) Also broke out
...
substitution command execution from do_sed_command() and put it in it's own
do_subst_command() function.
2000-07-13 20:01:58 +00:00
Mark Whitley
06f3529ada
Minor code reorg: Changed the interface to index_of_next_unescaped_slash to an
...
interface that seems a little more sensible to me. Also broke out s///
expression parsing into it's own subroutine.
2000-07-13 19:58:04 +00:00
Mark Whitley
c41e8c840f
Changed bb_regcomp to xregcomp and #if 0'ed out destroy_cmd_strs in sed.c
...
(maybe I'll remove it later).
2000-07-12 23:35:21 +00:00
Matt Kraai
be84cd4ef6
Always report the applet name when doing error reporting.
2000-07-12 17:02:35 +00:00
Mark Whitley
858c1adf2b
Applied patch from Matt Kraai to call destroy_cmd_strs in atexit(), rather
...
than peppering it throughout the code.
2000-07-11 21:38:47 +00:00
Mark Whitley
df5f6ba115
Applied patch from Matt Kraai which does the following:
...
- adds case-insensitive matching in sed s/// epxressions
- consolodates common regcomp code in grep & sed into bb_regcomp and put in
utility.c
- cleans up a bunch of cruft
2000-07-11 16:53:56 +00:00
Mark Whitley
6315ce603b
Brand, new sed that uses libc regex routines.
...
There is some common code used by both sed & grep that should be put into
utility.c as per Mat Kraai's suggestions/patch on the mailing list.
Specifically, a common regex_compile() and a regex_subst() function need to be
made.
2000-07-10 22:55:51 +00:00
Eric Andersen
b610615be9
Updates to a number of apps to remove warnings/compile errors under libc5.
...
Tested under both libc5 and libc6 and all seems well with these fixes.
-Erik
2000-06-19 17:25:40 +00:00
Eric Andersen
74c66ad06e
Fix some spelling errors in the source as well.
...
-Erik
2000-06-16 19:57:44 +00:00
Erik Andersen
7ab9c7ee52
Lots of updates. Finished implementing BB_FEATURE_TRIVIAL_HELP
...
which lets you compile out most of the "--help" output, saving
up to 17k.
Renamed mnc to nc.
-Erik
2000-05-12 19:41:47 +00:00
Erik Andersen
61677feff7
Upates to include copyright 2000 to everything
...
-Erik
2000-04-13 01:18:56 +00:00
Erik Andersen
e916d24805
Fixed a bug where "sed 's/foo/bar/g'" (i.e. a script w/o a -e)
...
would go into an infinite loop.
-Erik
2000-03-06 19:20:35 +00:00
Erik Andersen
4d0543138e
More minor touchups.
...
-Erik
2000-02-10 07:31:15 +00:00
Erik Andersen
e49d5ecbbe
Some formatting updates (ran the code through indent)
...
-Erik
2000-02-08 19:58:47 +00:00
Erik Andersen
7dc160721e
Bunches of fixes. Typos, bugs, etc.
...
Added 'gunzip -t'. inittab support _almost_ works (but it isn't
ready for prime time useage yet).
-Erik
2000-01-04 01:10:25 +00:00
Erik Andersen
1266a13e1f
* sed now supports addresses (numeric or regexp, with negation) and
...
has an append command, thanks to Marco Pantaleoni <panta@prosa.it>
* Fixed dmesg. It wasn't parsing its options (-n or -s) properly.
* Some cosmetic fixes to ls output formatting to make it behave more
like GNU ls.
-Erik
1999-12-29 22:19:46 +00:00
Eric Andersen
d73dc5b073
Updates to usage, and made tar work.
...
-Erik
1999-11-10 23:13:02 +00:00
Eric Andersen
50d6360771
Stuff
1999-11-09 01:47:36 +00:00
Eric Andersen
7f1acfdb89
More stuf. sed works.
1999-10-29 23:09:13 +00:00
Eric Andersen
24d8e7d787
Stuf
1999-10-29 06:50:17 +00:00
Eric Andersen
c1525e84dd
Stuff
1999-10-29 00:07:31 +00:00
Eric Andersen
6b6b3f6ef2
Stuf
1999-10-28 16:06:25 +00:00