summaryrefslogtreecommitdiff
path: root/editors/sed.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* strdup -> xstrdupDenis Vlasenko2007-01-191-3/+4
| | | | sed: de-obfuscate piece of code
* sed,get_line_from_file: improve commentsDenis Vlasenko2007-01-171-17/+27
|
* merge post-1.3.0 fixesDenis Vlasenko2006-12-261-1/+2
|
* remove casts from xmalloc()Denis Vlasenko2006-12-191-1/+1
|
* inline strcmp(s, "-") [actually macro-ize it for now - gcc is too stupid]Denis Vlasenko2006-12-161-3/+1
|
* bb_makedev: fix for glibc 2.3.2Denis Vlasenko2006-12-101-3/+3
| | | | sed: fix C++ style declaration
* sed: style fixesDenis Vlasenko2006-12-101-328/+338
|
* sed: fix handling of files not ending in '\n'Denis Vlasenko2006-12-021-10/+30
|
* sed: improve handling of NULsDenis Vlasenko2006-12-021-46/+64
|
* last nail into error_msg() (de)capitalizationDenis Vlasenko2006-10-271-1/+1
|
* rename functions to more understandable namesDenis Vlasenko2006-10-261-1/+1
|
* sed: mostly style fixes, very small changes in actual codeDenis Vlasenko2006-10-251-333/+354
|
* use skip_whitespace where appropriateDenis Vlasenko2006-10-251-82/+85
|
* bb_get_[chomped]line_from_file wasn't descriptive enough.Denis Vlasenko2006-10-121-2/+2
| | | | Renaming...
* getopt_ulflags -> getopt32.Denis Vlasenko2006-10-031-5/+5
| | | | | | | | It is impossible to formulate sane ABI based on size of ulong because it can be 32-bit or 64-bit. Basically it means that you cannot portably use more that 32 option chars in one call anyway... Make it explicit.
* rename bb_default_error_retval -> xfunc_error_retvalDenis Vlasenko2006-10-031-1/+1
|
* lots of silly indent fixesDenis Vlasenko2006-10-031-1/+1
|
* sed: -e options were handled in reverse order. fix that.Denis Vlasenko2006-10-011-19/+27
|
* sed: unbreak multiple -e, -f option handling (my fault)Denis Vlasenko2006-10-011-15/+24
|
* sed: getopt_ulflags'isationDenis Vlasenko2006-09-221-34/+22
|
* Change license statements (and clean up headers) on some of the files thatRob Landley2006-09-221-1/+1
| | | | Erik or I are primary copyright holders on.
* whitespace cleanupDenis Vlasenko2006-09-171-2/+2
|
* Bugfix for: echo '123456789' | sed 's/./|&/5'Rob Landley2006-09-081-1/+1
|
* removed a lot of trailing \n in bb_msg() calls. It is addedDenis Vlasenko2006-09-061-1/+1
| | | | | automatically by function itself.
* Remove bb_ prefixes from xfuncs.c (and a few other places), consolidateRob Landley2006-08-031-16/+16
| | | | | | | | | | things like xasprintf() into xfuncs.c, remove xprint_file_by_name() (it only had one user), clean up lots of #includes... General cleanup pass. What I've been doing for the last couple days. And it conflicts! I've removed httpd.c from this checkin due to somebody else touching that file. It builds for me. I have to catch a bus. (Now you know why I'm looking forward to Mercurial.)
* Rich Filker spotted that sed -e 's/xxx/[/' didn't work right. Did a smallerRob Landley2006-07-261-35/+23
| | | | | | fix than his, and shrank the code a bit on top of that so the net size is smaller, and added a test to the test suite for this case. Plus I cleaned up the #includes and removed unnecessary "const"s while I was there.
* Fix http://bugs.busybox.net/view.php?id=826 in which "(echo; echo) | sed x"Rob Landley2006-06-281-1/+1
| | | | | crashes because the empty state of the hold space is NULL but the empty state of the pattern space is "".
* - reuse strings and messages. Saves about 600BBernhard Reutner-Fischer2006-06-071-1/+1
|
* Confirming it's not needed.Rob Landley2006-06-051-1/+1
|
* - use bb functions instead of handrolling stuff.Bernhard Reutner-Fischer2006-06-031-3/+3
| | | | | | | - add XXX question about supposedly superfluous else clause text data bss dec hex filename 5918 0 0 5918 171e editors/sed.o.orig 5901 0 0 5901 170d editors/sed.o
* Change llist_add_* to take the address of the list rather than returning the newRob Landley2006-05-261-1/+1
| | | | head, and change all the callers.
* Yann Morin spotted some leftover flotsam from halfway through the recentRob Landley2006-05-241-1/+1
| | | | llist.c interface change that accidentally got checked in. My bad.
* Minor cleanups: Convert a few calloc() calls to xzalloc, remove unnecessaryRob Landley2006-05-211-2/+2
| | | | memset, collate variable declarations...
* Convert sed's static variables to a single global structure.Rob Landley2006-05-091-123/+130
|
* Move sed over to the generic llist_t for append. Saves about 90 bytes.Rob Landley2006-05-081-27/+9
|
* Portability patch from rfelker. The bb_asprintf.c thing needs an eventualRob Landley2006-03-091-1/+1
| | | | | follow up in platform.h to set the #ifdef, but the workaround works for everybody, so...
* Robert P. Day removed 8 gazillion occurrences of "extern" on functionRob Landley2006-03-061-1/+1
| | | | definitions. (That should only be on prototypes.)
* - silence warning about "'free_and_close_stuff' used but never defined"Bernhard Reutner-Fischer2006-03-021-3/+3
|
* - fix compilation of sed.Bernhard Reutner-Fischer2006-03-011-7/+7
| | | | | | | | error: static declaration of 'free_and_close_stuff' follows non-static declaration Tiny whitespace cleanup while at it, also make sure that we don't use CONFIG_ anymore. Rob, hope this is ok w/ you..
* Cleanup patch from Denis Vlasenko. Mostly variants of removing the if(x)Rob Landley2006-03-011-4/+2
| | | | from before "if(x) free(x)".
* A few changes falling out from the effort to make sed handle embedded NUL bytes.Rob Landley2006-02-241-18/+26
| | | | Checking in to reduce the diff between my tree and svn...
* just whitespaceTim Riker2006-01-251-1/+1
|
* Support # comments after s/// option list.Rob Landley2005-11-201-32/+14
|
* \0 is a synonym for &. Our own "make allbaseconfig" breaks without this.Rob Landley2005-10-301-2/+2
|
* split libbb: moved xregcomp separatelly for speed up recompile"Vladimir N. Oleynik"2005-09-141-1/+1
|
* Missing break was screwing up 'y//' command. Bug #248.Rob Landley2005-09-021-0/+1
|
* Patch from Colin Watson (mangled slightly by Rob Landley):Rob Landley2005-05-181-6/+10
| | | | | | | | | | 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.
* Doug Swarin pointed out a security bug in the -i option of sed.Rob Landley2005-05-181-9/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Patch from Bernhard Fischer to make a bunch of symbols staticEric Andersen2005-04-161-12/+12
| | | | which were otherwise cluttering the global namespace.
* Hiroshi found another bug. Currently sed's $ triggers at end of every file,Rob Landley2004-11-251-28/+46
| | | | | | | | | | | | | | | | | | | | | | | | 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