Commit Graph

533 Commits

Author SHA1 Message Date
Rob Landley
babd3fbba6 Missing break was screwing up 'y//' command. Bug #248. 2005-09-02 00:10:06 +00:00
Rob Landley
078bacf1e9 Patch -i support from Berhnard Fischer. 2005-09-01 03:02:23 +00:00
Mike Frysinger
4d00896d05 use toplevel ARFLAGS and update default ARFLAGS to be quiet 2005-07-27 01:09:24 +00:00
Paul Fox
18433aadf6 applying fix for:
0000118: vi join command does not mark file as modified for certain lines.
2005-07-20 17:39:52 +00:00
Paul Fox
d13b90b9e8 allow both ^H and DEL to backspace in insert mode (bug #23) 2005-07-18 22:17:25 +00:00
Eric Andersen
0ef24c672a Fix vi so that error messages, insert mode messages, etc are
all actually displayed in the status line as expected
2005-07-18 10:32:59 +00:00
Rob Landley
ed830e8693 Patch from Dmitry Zakharov:
Charlie Brady wrote:
> Here's another awk parsing problem - unary post increment - pre is fine:
>
>bash-2.05a$ echo 2,3 | gawk -F , '{ $2++ }'
>bash-2.05a$ echo 2,3 | /tmp/busybox/busybox awk -F , '{ $2++ }'
>awk: cmd. line:1: Unexpected token
>
Here's a fix for this. There is another problem with constructions like 
"print (A+B) ++C", I don't
know whether somebody uses such constructions (fixing both these 
problems would require very
serious change in awk code).
2005-06-07 02:43:52 +00:00
Rob Landley
93850a56b2 Patch from Colin Watson (mangled slightly by Rob Landley):
This patch implements the 'T' command in sed. This is a GNU extension,
but one of the udev hotplug scripts uses it, so I need it in busybox
anyway.

Includes a test; 'svn add testsuite/sed/sed-branch-conditional-inverted'
after applying.
2005-05-18 06:34:37 +00:00
Rob Landley
5797c7f0ef Doug Swarin pointed out a security bug in the -i option of sed.
While the permissions on the temp file are correct to prevent it from being 
maliciously mangled by passing strangers, (created with 600, opened O_EXCL, 
etc), the permissions on the _directory_ might not be, and we re-open the 
file to convert the filehandle to a FILE * (and automatically get an error 
message and exit if the directory's read-only or out of space or some such).

This opens a potential race condition if somebody's using dnotify on the 
directory, deletes/renames the tempfile, and drops a symlink or something 
there.  Somebody running sed -i as root in a world writeable directory could 
do damage.

I dug up notes on an earlier discussion where we looked at the security 
implications of this (unfortunately on the #uclibc channel rather than email; 
I don't have a transcript, just notes-to-self) which pointed out that if the 
permissions on the directory allow other people's files to be deleted/renamed 
then the original file is vulnerable to sabotage anyway.  However, there are 
two cases that discussion apparently didn't take into account:

1) Using another user's permissions to damage files in other directories you 
can't access (standard symlink attack).

2) Reading data another user couldn't otherwise access by having the new file 
belong to that other user.

This patch uses fdopen to convert the filehandle into a FILE *, rather than
reopening the file.
2005-05-18 05:56:16 +00:00
Eric Andersen
14f5c8d764 Patch from Bernhard Fischer to make a bunch of symbols static
which were otherwise cluttering the global namespace.
2005-04-16 19:39:00 +00:00
Mike Frysinger
4e5936ef95 In Bug 208, bernhardf writes:
On machines with only ANSI compliant compilers, not explitily delcaring
an empty parameter list 'void' causes failure.
2005-04-16 04:30:38 +00:00
Rob Landley
dcc286607c Hiroshi found another bug. Currently sed's $ triggers at end of every file,
and with multiple files SuSv3 says it should only trigger at the end of the
LAST file.

The trivial fix I tried first broke if the last file is empty.  Fixing this
properly required restructuring things to create a file list (actually a
FILE * list), and then processing it all in one go.  (There's probably a
smaller way to do this, merging with append_list perhaps.  But let's get
the behavior correct first.)

Note that editing files in place (-i) needs the _old_ behavior, with $
triggering at the end of each file.

Here's a test of all the things this patch fixed.  gnu and busybox seds produce
the same results with this patch, and different without it.

echo -n -e "1one\n1two\n1three" > ../test1
echo -n > ../test2
echo -e "3one\n3two\n3three" > ../test3
sed -n "$ p" ../test1 ../test2 ../test3
sed -n "$ p" ../test1 ../test2
sed -i -n "$ p" ../test1 ../test2 ../test3
2004-11-25 07:21:47 +00:00
Rob Landley
ce4f0e982b Hiroshi Ito found some bugs. The 'c' command (cut and paste) was hardwired
to not put a newline at the end (which was backwards, it should have been
hardwired _to_ put a newline at the end, whether or not the input line
ended with a newline).  Test case for that:

echo | sed -e '$ctest'

And then this would segfault:

echo | sed -e 'g'

Because pattern_space got freed but the dead pointer was only overwritten
in an if statement that didn't trigger if the hold space was empty.  Oops.

While debugging it, I found out that the hold space is persistent between
multiple input files, so I promoted it to a global and added it to the
memory cleanup.  The relevant test case (to compare with That Other Sed) is:

echo -n woo > woo
sed -e h -e g woo
echo "fish" | sed -e '/woo/h' -e "izap" -e 's/woo/thingy/' -e '/fish/g' woo -

And somebody gratuitously stuck in a c99 int8_t type for something that's just
a flag, so I grouped the darn ints.
2004-10-30 06:54:19 +00:00
Eric Andersen
7daa076d3e egor duda writes:
Hi!

I've created a patch to busybox' build system to allow building it in
separate tree in a manner similar to kbuild from kernel version 2.6.

That is, one runs command like
'make O=/build/some/where/for/specific/target/and/options'
and everything is built in this exact directory, provided that it exists.

I understand that applyingc such invasive changes during 'release
candidates' stage of development is at best unwise. So, i'm currently
asking for comments about this patch, starting from whether such thing
is needed at all to whether it coded properly.

'make check' should work now, and one make creates Makefile in build
directory, so one can run 'make' in build directory after that.

One possible caveat is that if we build in some directory other than
source one, the source directory should be 'distclean'ed first.

egor
2004-10-08 07:46:08 +00:00
Glenn L McGrath
ca29ffc206 Patch from Dmitry Zakharov to fix a bug triggered by freeswan's scripts. 2004-09-24 09:24:27 +00:00
Eric Andersen
a9eb33ddc7 regularly update the status line display
-Erik
2004-08-19 19:15:06 +00:00
Eric Andersen
67776bef59 Simon Poole reports that awk segfaults when environment variables
with no value exist, i.e.

	$ export BOB=''
	% ./busybox awk
	Segmentation fault

This patch teaches awk to not blow chunks on empty env variables.
 -Erik
2004-07-30 23:52:08 +00:00
Glenn L McGrath
1fbc909570 Patch from Dmitry Zakharov to fix a bug discovered via the freeswap
script.
2004-07-23 02:11:25 +00:00
Eric Andersen
165e8cbf34 Assign 'forced' before the goto to avoid a warning 2004-07-20 06:44:46 +00:00
Eric Andersen
9855548a77 Rob Landley writes:
add sed -r support.

I bumped into a couple of things that want to use extended regular expressions
in sed, and it really isn't that hard to add.  Can't say I've extensively
tested it, but it's small and isn't going to break anything that doesn't use
it, so...

Rob
2004-05-26 10:03:33 +00:00
Glenn L McGrath
21d7d61de1 Use int instead of char for return type, in theory avoiding a cast 2004-05-16 02:35:49 +00:00
Glenn L McGrath
5d2edbf16d Fix for debian bug #248106, should use int for returned getopt value. 2004-05-10 08:59:17 +00:00
Glenn L McGrath
c6992feee3 Update my email address, document some of my tasks in the AUTHORS file 2004-04-25 05:11:19 +00:00
Eric Andersen
b94669543d This sed patch can only be described as "duh". Stat the source file, chmod
the _destination_ file.  (Ah hah!  That works _much_ better...)  I
implemented the behavior, I just forgot to test this corner of it.  My fault,
sorry...

No, gnu sed -i doesn't preverve ownership information.  I checked.
Permissions, yes, ownership info, no.

Rob
2004-04-21 00:57:14 +00:00
Eric Andersen
faa7d863fc So I'm building a linux from scratch system, using a working script to do this
that the _only_ change to is that gnu sed has been replaced with busybox sed.
And ncurses' install phase hangs.  I trace it down, and it's trying to run
gawk.  (Insert obligatory doubletake, but this is FSF code we're talking
about, so...)

It turns out gawk shells out to sed, ala "sed -f /tmp/blah file.h".  The
/tmp/blah file is basically empty (it contains one character, a newline).  So
basically, gawk is using sed as "cat".  With gnu sed, it works like cat,
anyway.

With busybox sed, it tests if its command list is empty after parsing the
command line, and if the list is empty it takes the first file argument as a
sed command string, and if that leaves the file list empty it tries to read
the data to operate on from stdin.  (Hence the hang, since nothing's coming
in on stdin...)

It _should_ be testing whether there were any instances of -f or -e, not
whether it actually got any commands.  Using sed as cat may be kind of
stupid, but it's valid and gawk relies on this behavior.

Here's a patch to fix it, turning a couple of ints into chars in hopes of
saving a bit of the space this adds.  Comments?

Rob
2004-04-21 00:56:22 +00:00
Eric Andersen
aff114c33d Larry Doolittle writes:
This is a bulk spelling fix patch against busybox-1.00-pre10.
If anyone gets a corrupted copy (and cares), let me know and
I will make alternate arrangements.

Erik - please apply.

Authors - please check that I didn't corrupt any meaning.

Package importers - see if any of these changes should be
passed to the upstream authors.

I glossed over lots of sloppy capitalizations, missing apostrophes,
mixed American/British spellings, and German-style compound words.

What is "pretect redefined for test" in cmdedit.c?

Good luck on the 1.00 release!

      - Larry
2004-04-14 17:51:38 +00:00
Rob Landley
25d82397f7 The last patch broke:
sed -i "/^boo/a fred" ipsec.conf

Which works in gnu sed.  (And is _supposed_ to strip all the whitespace before
"fred".)

It also broke:
sed -i -e "/^boo/a \\" -e "   fred" ipsec.conf

I.E. there can legally be spaces between the a and the backslash at the end of
the line.

And strangely enough, gnu sed accepts the following syntax as well:
sed -i "/^boo/a \\  fred" ipsec.conf

Which is a way of having the significant whitespace at the start of the line,
all on one line.  (But notice that the whitespace BEFORE the slash is still
stripped, as is the slash itself.  And notice that the naieve placement of
"\n" there doesn't work, it puts an n at the start of the appended line.  The
double slashing is for shell escapes because you could escape the quote, you
see.  It's turned into a single backslash.  But \n there is _not_ turned into
a newline by the shell.  So there.)

This makes all three syntaxes work in my tests.  I should probably start
writing better documentation at some point.  I posted my current sedtests.py
file to the list, which needs a lot more tests added as well...
2004-04-01 09:23:30 +00:00
Eric Andersen
46390ed829 Junio Hamano, junio at twinsun dot com writes:
The sed command in busybox 1.0.0-pre8 loses leading whitespace
in 'a' command ('i' and 'c' commands are also affected).  A
patch to fix this is attached at the end of this message.

The following is a transcript that reproduces the problem.  The
first run uses busybox 1.0.0-pre3 as "/bin/sed" command, which
gets the expected result.  Later in the test, /bin/sed symlink
is changed to point at busybox 1.0.0-pre8 and the test script is
run again, which shows the failure.

=== reproduction recipe ===
* Part 1.  Use busybox 1.0.0-pre3 as sed; this works.

root# cd /tmp
root# cat 1.sh
#!/bin/sh

cd /tmp
rm -f ipsec.conf ipsec.conf+
cat >ipsec.conf <<\EOF
version 2.0

config setup
        klipsdebug=none
        plutodebug=none
        plutostderrlog=/dev/null

conn %default
        keyingtries=1
        ...
EOF
sed -e '/^config setup/a\
	nat_traversal=yes' ipsec.conf >ipsec.conf+
mv -f ipsec.conf+ ipsec.conf
root# sh -x 1.sh
+ cd /tmp
+ rm -f ipsec.conf ipsec.conf+
+ cat
+ sed -e /^config setup/a\
        nat_traversal=yes ipsec.conf
+ mv -f ipsec.conf+ ipsec.conf
root# cat ipsec.conf
version 2.0

config setup
        nat_traversal=yes
        klipsdebug=none
        plutodebug=none
        plutostderrlog=/dev/null

conn %default
        keyingtries=1
        ...
root# sed --version
sed: invalid option -- -
BusyBox v1.00-pre3 (2004.02.26-18:47+0000) multi-call binary

Usage: sed [-nef] pattern [files...]

* Part 2.  Continuing from the above, use busybox 1.0.0-pre8
  as sed; this fails.

root# ln -s busybox-pre8 /bin/sed-8
root# mv /bin/sed-8 /bin/sed
root# sed --version
This is not GNU sed version 4.0
root# sed --
BusyBox v1.00-pre8 (2004.03.30-02:44+0000) multi-call binary

Usage: sed [-nef] pattern [files...]
root# sh -x 1.sh
+ cd /tmp
+ rm -f ipsec.conf ipsec.conf+
+ cat
+ sed -e /^config setup/a\
        nat_traversal=yes ipsec.conf
+ mv -f ipsec.conf+ ipsec.conf
root# cat ipsec.conf
version 2.0

config setup
nat_traversal=yes
        klipsdebug=none
        plutodebug=none
        plutostderrlog=/dev/null

conn %default
        keyingtries=1
        ...
root#
=== reproduction recipe ends here ===

This problem was introduced in 1.0.0-pre4.  The problem is that
the command argument parsing code strips leading whitespaces too
aggressively.  When running the above example, the piece of code
in question gets "\n\tnat_traversal=yes" as its argument in
cmdstr variable (shown part in the following patch).  What it
needs to do at this point is to strip the first newline and
nothing else, but it instead strips all the leading whitespaces
at the beginning of the string, thus losing the tab character.
The following patch fixes this.
2004-03-31 11:42:40 +00:00
Eric Andersen
90fb65f7a6 Patch from Thomas Winkler -- vi -R did not work 2004-03-31 11:12:51 +00:00
Eric Andersen
c7bda1ce65 Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
Glenn L McGrath
4bded58207 Patch from Dmitry Zakharov, this line was missedfrom the last patch 2004-02-22 11:55:09 +00:00
Rob Landley
53302f80da Add -i option to sed, to edit files in-place. 2004-02-18 09:54:15 +00:00
Eric Andersen
5cc90eade5 Richard Kojedzinszky writes:
Hi All,

I aplogoize for the mistake, but i have just recognized that somehow the
last patch I sent in was wrong, and a '0' was instead of a '-1'. Because
of this, vi does behave the wrong way. So again, it should be the last
patch for vi. This is for pre7.
2004-02-06 10:36:08 +00:00
Eric Andersen
aeea32ca69 Richard Kojedzinszky writes:
Hi,

I've noticed the bug also, and here is another patch for it. I hope it'll
not introduce more bugs. Not too nice, but works for me.

Here it is for busybox-1.00-pre6
2004-02-04 11:19:44 +00:00
Eric Andersen
c06f568dda Rob Landley writes:
While building glibc with busybox as part of the development environment, I
found a bug in glibc's regexec can throw sed into an endless loop.  This
fixes it.  Should I put an #ifdef around it or something?  (Note, this patch
also contains the "this is not gnu sed 4.0" hack I posted earlier, which is
also needed to build glibc...)
2004-02-04 10:57:46 +00:00
Glenn L McGrath
ee829065cb Patch by Richard Kojedzinszky, when using END at end of lines it was
skipping to next line, cw command was leaving one char in buffer
2004-01-21 10:59:45 +00:00
Rob Landley
40ec4aeb8e Thinko in s//options. (Whitespace skipping in the wrong place.) 2004-01-04 06:42:14 +00:00
Eric Andersen
d10f36fe2e Match changes made to cmdedit 2003-12-23 20:45:14 +00:00
Eric Andersen
52a3c2726e Patch from Matt Kraai:
sed is broken:

 busybox sed -n '/^a/,/^a/p' >output <<EOF
 a
 b
 a
 b
 EOF
 cmp -s output - <<EOF
 a
 b
 a
 EOF

The attached patch fixes it.
2003-12-23 08:53:51 +00:00
Glenn L McGrath
00ed36fd52 Patch from Dmitry Zakharov,
Fixes two bugs:
- END block didn't execute after an exit() call
- huge memory consumption and performance degradation on large input
(now performance is comparable to gawk)
2003-10-30 13:36:39 +00:00
Eric Andersen
88c916bdec Andreas Mohr writes:
the busybox menuconfig triggered my "inacceptable number of spelling mistakes"
upper level, so I decided to make a patch ;-)

I also improved some wording to describe some things in a better way.

Many thanks for an incredible piece of software!

Andreas Mohr, random OSS developer
2003-10-22 09:58:56 +00:00
Eric Andersen
638da75f4b Fix some warnings that have crept in recently 2003-10-09 08:18:36 +00:00
Glenn L McGrath
586d86cc8c Comaptability with gcc-2.95 2003-10-09 07:22:59 +00:00
Glenn L McGrath
42c25735e6 Patch from Rob Landley;
Moving on to building diffutils, busybox sed needs this patch to get
past the first problem.  (Passing it a multi-line command line argument
with -e works, but if you don't use -e it doesn't break up the multiple
lines...)
2003-10-04 05:27:56 +00:00
Glenn L McGrath
0ad4daa54e Patch from Rob Landley to fix backrefs 2003-10-01 10:26:23 +00:00
Glenn L McGrath
738fb33994 Patch by Rob Landley, fix "newline after edit command" 2003-10-01 06:45:11 +00:00
Glenn L McGrath
aa5a602689 Patch by Rob Landley, work in progress update, fixes lots of bugs,
introduces a few others (but they are being worked on)
2003-10-01 03:06:16 +00:00
Glenn L McGrath
761ec20f81 Fix some typo's, remove some extra free statements 2003-09-24 10:23:39 +00:00
Glenn L McGrath
2570b43e82 Configuration option to define wether to follows GNU sed's behaviour
or the posix standard.
Put the cleanup code back the way it was.
2003-09-16 05:25:43 +00:00
Glenn L McGrath
204ff1cea4 Fix a bug that creapt in recently with substitution subprinting, and add
a test for it.
2003-09-16 01:46:36 +00:00
Glenn L McGrath
977451ef44 Fix a simple mistake with pattern space, and add a test for it 2003-09-15 12:07:48 +00:00
Glenn L McGrath
e3e28d3bb6 Fix some memory allocation problems
----------------------------------------------------------------------
2003-09-15 09:22:04 +00:00
Eric Andersen
8efe967018 Be entirely consistant when using ioctl(0, TIOCGWINSZ, &winsize)
to ensure proper fallback behavior on, i.e. serial consoles.
 -Erik
2003-09-15 08:33:45 +00:00
Glenn L McGrath
2eed0e2d47 Add a test for the 'P' command and fix current implementation so it
doesnt permanently modify the pattern space.
2003-09-15 06:28:45 +00:00
Glenn L McGrath
6e5687abc3 A test and fix for the sed 'n' command 2003-09-15 06:12:53 +00:00
Glenn L McGrath
73116311e5 Fix for the sed-append-next-line test 2003-09-15 05:42:05 +00:00
Glenn L McGrath
640c1f547f Fix recursion problem 2003-09-15 04:55:29 +00:00
Glenn L McGrath
294d113adb Memory cleanups and fix for echo "foo" | sed 's/foo/bar/;H;q' 2003-09-14 16:28:08 +00:00
Glenn L McGrath
8417c8c38b Cleanup memory usage 2003-09-14 15:24:18 +00:00
Glenn L McGrath
edc388cf4e The previous fix for 's/a/1/;s/b/2/;t one;p;:one;p' broke the case of
echo fooba | ./busybox sed -n 's/foo//;s/bar/found/p'

I really need to start adding these tests to the testsuite.

keep the substituted and altered flags seperate
2003-09-14 08:52:53 +00:00
Glenn L McGrath
3fe475677a Preserve substitution flag value within the current line.
Fixed the following testcase
# cat strings |./busybox sed -n -f test3.sed
1
1
2
c
c
# cat strings
a
b
c
2003-09-14 07:59:28 +00:00
Glenn L McGrath
f4523562b6 Fix branching commands.
If a label isnt specified, jump to end of script, not the last command
in the script.

Print an error and exit if you try and jump to a non-existant label

Works for the following testcase
# cat strings
a
b
c
d
e
f
g
# cat strings | ./busybox sed -n '/d/b;p'
a
b
c
e
f
g
2003-09-14 06:01:14 +00:00
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
Glenn L McGrath
09adaca37d last_patch_69, 8 bit clean and other fixes from Vladimir N. Oleynik 2002-12-02 21:18:10 +00:00
Aaron Lehmann
a170e1c858 Change if(x)free(x); to free(x); 2002-11-28 11:27:31 +00:00
Glenn L McGrath
d4036f86e5 Use erorr_msg( isntead of fprintf(stderr, 2002-11-28 09:30:40 +00:00
Glenn L McGrath
545106f8db Move awk from textutils to editors. Cleanup run-parts, saves 200 bytes, moves the guts of run_parts to libbb to be used by ifupdown. 2002-11-11 06:21:00 +00:00
Eric Andersen
fda2b7ff47 A patch from Jouni Malinen to avoid some buffer overflows in vi,
closing bug #1270
2002-10-26 10:19:19 +00:00
Aaron Lehmann
6fdacc74f0 vi inlining 2002-08-21 13:02:24 +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
Robert Griebl
a71389bfe8 Applied a patch from Philip Blundell <pb@nexus.co.uk>:
Added support for ":x" as an alias for ":wq" to vi
2002-07-31 21:22:21 +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
Tim Riker
86c76a9c2a fix from kergoth 2002-04-26 07:41:22 +00:00
Eric Andersen
85208e2ab9 Completely rework the config system so that it no longer annoys me to work on
the busybox development tree.  This eliminates the use of recursive make, and
once again allows us to run 'make' in a subdirectory with the expected result.
And things are now much faster too.  Greatly improved IMHO...
 -Erik
2002-04-12 12:05:57 +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
1f0c43668a Remove == TRUE' tests and convert != TRUE' and `== FALSE' tests to use !. 2001-12-20 23:13:26 +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
Eric Andersen
bff7a60f63 Patch from "Andrew Tipton" <andrew@cadre5.com> to enable vi cursor
keys while editing.
2001-11-17 07:15:43 +00:00
Eric Andersen
80f5ac7016 Patch from Steve Merrifield <steve@labyrinth.net.au> to make vi
use xmalloc
2001-11-17 06:57:42 +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
882cbcdfa1 more config.in entries from Giulio Orsero <giulioo@pobox.com>
with some minor edits by me.
2001-11-10 10:43:09 +00:00
Eric Andersen
7131213460 config.in features patch from Giulio Orsero <giulioo@pobox.com>
with some minor edits from me
2001-11-10 09:53:23 +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
Eric Andersen
fdbac35b33 Patch from Robert J. Osborne <rj@resourceinternational.com> that fixes
a bug in vi where the beginning of the text space was not checked
before dot is decremented for delete and escape sequences on an empty
file.
2001-08-02 05:26:41 +00:00
Matt Kraai
51038a3f42 Don't save and restore readonly flag if BB_FEATURE_VI_READONLY isn't enabled. 2001-07-31 15:01:12 +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
Eric Andersen
20aab260e2 Some adjustments, mostly from David McCullough <davidm@lineo.com> to
make busybox be more uClinux friendly.  I also adjusted Config.h for
uClinux so it will automagically disable apps the arn't going to
work without fork() and such.
 -Erik
2001-07-19 22:28:02 +00:00
Eric Andersen
044228d5ec This is vodz' latest patch. Sorry it took so long...
1) ping cleanup (compile fix from this patch already applied).
    2) traceroute call not spare ntohl() now (and reduce size);
    3) Fix for functions not declared static in insmod, ash, vi and mount.
    4) a more simple API cmdedit :))
    5) adds "stopped jobs" warning to ash on Ctrl-D and fixes "ignoreeof" option
    6) reduce exporting library function index->strchr (traceroute), bzero->memset (syslogd)
2001-07-17 01:12:36 +00:00
Matt Kraai
5009f90ea2 Removed obsolete function, strdup_substr. 2001-07-05 19:00:47 +00:00
Eric Andersen
dd8500bce7 Cleanups and sinze reduction for the vi applet from Aaron Lehmann
<aaronl@vitelus.com>
2001-07-02 18:06:14 +00:00
Glenn L McGrath
78b0e379d7 Vladimir's last_patch_15 2001-06-26 02:06:08 +00:00
Eric Andersen
e0c0757d09 These were broken when using dmalloc due to include file ordering
problems.  busybox.h must be last.
 -Erik
2001-06-23 13:49:14 +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
Eric Andersen
ddb00545b7 A patch from Aaron Lehmann <aaronl@vitelus.com> to fix a
crash on a broken regexp.
2001-05-13 00:48:09 +00:00
Mark Whitley
1f3b9f297e Added support for 'r' command in sed. 2001-05-11 22:27:13 +00:00
Eric Andersen
c33ebc9741 A patch from Vladimir to use last_char_is(), and a patch from
Larry to fix a silly bug when BB_FEATURE_VI_OPTIMIZE_CURSOR
is not defined.
2001-05-07 22:57:47 +00:00
Eric Andersen
822c3837f9 Another vi update from Sterling Huxley:
- All of the ESC sequences are now in variables.  This should make
  re-targeting for other terminals easier.

- The initial screen draw does not force out every single column.
  Should be faster.

- The place_cursor() routine trys to be smarter about moving the
  cursor.  This is optional based on BB_FEATURE_VI_OPTIMIZE_CURSOR.

- The 't' and 'f' intra-line positioning commands were added.
  They can now be used as targets in 'c' and 'd' commands, i.e.,
   dfx - delete from dot to next 'x'
   dtx - delete from dot to the char before next 'x'

- show_status_line() uses a static int checksum to remember what
  is currently displayed on the screen and not re-draw the status
  line unless it has changed.

- Some of the code in refresh() was moved out to format_line().
  refresh() trys to send out the smallest segment containing
  the changed chars rather than the whole line.

- Added "flash" to the :set command to specify if error indication
  should be by flashing the screen or ringing the bell.

- Changed the rawmode() routine so that it turns off the
  NL -> CR NL translation. On output of a NL, the OS will not add
  a CR.

- If vi was started as "view", with global read-only mode,
  and another file is opened, the file is opened read-only
  rather than read+write.
2001-05-07 17:37:43 +00:00
Eric Andersen
c1bdffe99b Another nice cleanup from Larry. This adds a new last_char_is() function and
uses it to avoid possible buffer underruns whn strlen is zero, and avoid the
possible space-hogging inline of strlen() in several cases.
 -Erik
2001-04-26 15:56:47 +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
Eric Andersen
1c0d311ff4 Several fixes from Sterling Huxley for the vi applet. 2001-04-16 15:46:44 +00:00
Eric Andersen
4fd382ea29 Remove unused optarg variable 2001-04-04 19:33:32 +00:00
Eric Andersen
d402edfd63 Some cleanups for libc5 support 2001-04-04 19:29:48 +00:00
Eric Andersen
3f98040554 I said no new features till after the 0.51 release. Well, I lied. This is a
vi editor for busybox, contributed by Sterling Huxley <sterling@europa.com>.
It adds 22k to the busybox binary when enabled.  Quite impressive!
2001-04-04 17:31:15 +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