summaryrefslogtreecommitdiffstats
path: root/usr.bin/sed/main.c
Commit message (Collapse)AuthorAgeFilesLines
* WARNS fixes:dwmalone2008-02-091-1/+1
| | | | | | | | | | 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
* Fix visibility of "inplace".dds2007-11-081-1/+1
| | | | Found by: CScout
* Don't forget to clear out the hold space for each subsequent fileyar2007-06-121-1/+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
* Change the semantics of -i (in-place editing) so that it treatsyar2007-04-211-4/+16
| | | | | | | | | | | | | | | | | 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
* The function inplace_edit() doesn't exist anymore, remove the prototype.stefanf2005-09-241-1/+0
| | | | Submitted by: Leonardo Chiquitto Filho
* Add option -l, to make output line buffered.glebius2005-05-101-3/+7
| | | | | | PR: bin/78692 Submitted by: Eugene Grosbein MFC after: 2 weeks
* Include missing headers.stefanf2005-02-091-0/+1
|
* Per letter dated July 22, 1999 remove 3rd clause of Berkeley deriveddds2004-08-091-4/+0
| | | | | | software (original contributor). Reviewed by: imp
* Make the 'y' (translate) command aware of multibyte characters.tjr2004-07-141-0/+1
|
* Plug a file descriptor leak.brian2004-06-031-7/+13
| | | | | | | 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).
* Fix the case where the file is not in the current directory.des2003-11-041-1/+2
| | | | | Discovered by: Vladimir Kravchenko <jimson@mostcom.ru> Pointy hat to: des
* Reimplement in-place editing in a slightly less disgusting manner. Also,des2003-11-041-71/+61
| | | | | | | make an effort to preserve the ownership and mode of the file we are editing. Sponsored by: Registrar AS
* ANSIfydes2003-11-041-18/+7
|
* Correct style bugs in the in-place editing code.des2003-11-041-2/+2
|
* Fix some bugs in in-place editing:fanf2002-07-301-28/+26
| | | | | | | | (1) errors from freopen were not reported correctly (2) large files were not handled correctly (3) read-only files broke things MFC after: 1 week
* Avoid checking whether each line is the last line of the file when we don'ttjr2002-07-031-23/+27
| | | | | | | | | need to know. Instead, check when we are trying to match a "$" address. This does not change the way sed processes regular files, but makes it behave more sensibly when used interactively. PR: 40101 MFC after: 2 weeks
* Don't store newlines at the end of each line in the hold/pattern spaces,tjr2002-06-221-0/+2
| | | | | | | | instead add the newline when the pattern space is printed. Make the `G' and `H' commands add a newline to the space before the data, remove bogus addition of newline from `x' command. PR: 29790, 38195
* Correct the handling of (for example) the N command by only zeroing thetjr2002-06-161-1/+2
| | | | input space in mf_fgets() if we reach the end of all input files.
* Exit with non-zero status if an input file can not be opened. This wastjr2002-06-141-0/+1
| | | | broken by rev. 1.22.
* Fix one serious bug and one potential problem with in-place editing code:sobomax2002-06-141-70/+60
| | | | | | | | | | | | | - original version of code worked incorrectly when more than one input files were specified - it was moving the last line from the 1st file to be the first line of the 2nd, last line of the 2nd to be the first line of the 3rd and so on; - use mmap()->write() to create temporary file instead of malloc()->read()->write(), which was not only slower, but also did not bother to free allocated memory once backup file was created, potentially leading to memory exhausting when regex is applied to a big file or a large number of small ones.
* If a file argument cannot be processed, process the remaining onestjr2002-05-241-6/+14
| | | | and exit non-zero (SUSv3)
* o Clean up tmp file usage a little by using mkstemp(3) instead ofgreen2002-05-141-5/+6
| | | | | | | mktemp(3). It would be amazingly unlikely, but the former method could result in a symlink attack. A better solution would use ${TMPDIR}, though. o Make sed not overwrite old backup files with no warning.
* Oops, update usage() to have -i.jmallett2002-05-071-2/+2
|
* Add handling for any nil-length string passed to -i for the backup extension.jmallett2002-05-071-2/+14
| | | | Add a note that this is kinda-sorta dangerous to the manual page.
* Un-shadow the `fname' variable.jmallett2002-05-071-9/+9
|
* Add a -i option to sed(1) to do inplace editing, to give us an alternative tojmallett2002-05-071-2/+66
| | | | | | | | | | | | | | | | | | Perl for such things. The key difference to Perl is that a backup extension *MUST* be specified, because on one hand it isn't recommended to have options which optionally take a parameter, and on the other hand, it'd be slightly unpleasent to implement proper handling for that. The difference between this and the version posted to developers@ is that it does handle multiple files in argv after the getopt(3) handling "correctly", in that the inplace editing-specific code has been moved out to a function, and that function is used beyond the first file in our linked list. This option has been documented as FreeBSD-specific in the manpage. Reviewed by: developers@ (got feedback from: des, fanf, sobomax, roberto, obrien) MFC after: 1 week
* remove __Pimp2002-03-221-3/+3
|
* WARNS=2 partial fix; use NO_WERROR to protect against some hard-to-fix warnings.markm2001-12-121-7/+6
| | | | Use __FBSDID(), kill register keyword.
* Expand xmalloc in-place, along with xrealloc; which wasn't even ANSI in itsobrien2001-07-241-3/+6
| | | | implementation.
* Small style fix '=' -> ' = 'nsayer2000-05-111-1/+1
|
* Fix compatibility issue in sed. Do so by explicitely adding ansayer2000-05-111-1/+5
| | | | | | newline to the end of any -e argument. PR: bin/18474
* Add a new flag: -E enables "extended" regular expressions.green2000-03-191-2/+6
|
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Fix a new bug introduced by the previous bug fixarchie1998-12-081-3/+15
|
* Remove local redefinition for err(). Add usage().charnier1997-08-111-11/+23
|
* compare return value from getopt against -1 rather than EOF, per the finalimp1997-03-291-1/+1
| | | | posix standard on the topic.
* fix C programmer's bug number 12.2wosch1996-11-171-3/+8
| | | | submitted by: bruce
* Fix the C programmer's bug #1: EOF is of type `int', not `char'.joerg1996-11-171-6/+2
| | | | | | Strong 2.2 candidate. Submitted by: wosch
* Localize itache1996-08-111-1/+3
| | | | 8bit cleanup
* Fix spelling error (scipt -> script).rgrimes1995-02-231-1/+1
| | | | | Submitted by: <jhawk@MIT.EDU> Obtained from: NetBSD-bugs mailling list
* BSD 4.4 Lite Usr.bin Sourcesrgrimes1994-05-271-0/+352
OpenPOWER on IntegriCloud