aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/sed
Commit message (Collapse)AuthorAgeFilesLines
* Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup,Jens Schweikhardt2003-01-011-1/+1
| | | | | | | especially in troff files. Notes: svn path=/head/; revision=108533
* mdoc(7) police: markup polishing.Ruslan Ermilov2002-11-261-6/+3
| | | | | | | Approved by: re Notes: svn path=/head/; revision=107276
* Initialize a variable in order to fix when faced with picky compilers.Eric Melville2002-09-201-0/+2
| | | | | | | Sponsored by: Apple Notes: svn path=/head/; revision=103715
* Correct boundary condition error in `D' and `P' commands when the lastTim J. Robbins2002-08-111-6/+3
| | | | | | | | | | | line of the pattern space is empty. Don't emit spurious newline when EOF is reached with the `N' command. Pointed out by: Oleg Osyka MFC after: 1 week Notes: svn path=/head/; revision=101668
* Fix some bugs in in-place editing:Tony Finch2002-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 Notes: svn path=/head/; revision=100970
* Ignore leading semicolons on commands; required by SUSv3.Tim J. Robbins2002-07-301-2/+8
| | | | | | | Obtained from: NetBSD (kleink, Aymeric Vincent) Notes: svn path=/head/; revision=100944
* s/inline/__inline/Mark Murray2002-07-191-4/+4
| | | | Notes: svn path=/head/; revision=100359
* Make cspace()'s second argument const. Make `escapes' in lputs() const.Tim J. Robbins2002-07-082-3/+4
| | | | Notes: svn path=/head/; revision=99573
* Silence WARNS=4 by passing a non-const buffer to regerror(). Since itTim J. Robbins2002-07-081-1/+1
| | | | | | | doesn't actually use the buffer when errbuf_size == 0, pass NULL. Notes: svn path=/head/; revision=99572
* Update another mention of <CR><CR> I missed the first time around (rev 1.2)Tim J. Robbins2002-07-041-1/+1
| | | | Notes: svn path=/head/; revision=99400
* Note that two carriage returns aren't required after entering theTim J. Robbins2002-07-031-2/+3
| | | | | | | | | initial setup anymore (since process.c rev. 1.25). Add $FreeBSD$. MFC after: 2 weeks Notes: svn path=/head/; revision=99355
* Avoid checking whether each line is the last line of the file when we don'tTim J. Robbins2002-07-033-25/+29
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=99352
* Don't let the pattern space become null if the `x' command is used when theTim J. Robbins2002-07-031-0/+2
| | | | | | | | | hold space is null; some functions assume it's never null. MFC after: 3 days Notes: svn path=/head/; revision=99351
* Sort sections, and refer to sed as a utility, not a function.Tim J. Robbins2002-06-251-6/+6
| | | | Notes: svn path=/head/; revision=98807
* Fix off by one in `y' (transliterate) command which caused the last characterTim J. Robbins2002-06-241-1/+1
| | | | | | | | | of the pattern space not to be examined. Noticed by: Motoyuki Konno <motoyuki@bsdclub.org> Notes: svn path=/head/; revision=98743
* Now that the pattern space contains no trailing newline, modify the `l'Tim J. Robbins2002-06-221-1/+5
| | | | | | | command's output so it's the same as what SUSv3 specifies. Notes: svn path=/head/; revision=98603
* Don't store newlines at the end of each line in the hold/pattern spaces,Tim J. Robbins2002-06-222-11/+12
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=98601
* Kill superfluous blank line.Maxim Sobolev2002-06-171-1/+0
| | | | Notes: svn path=/head/; revision=98332
* Correct the handling of (for example) the N command by only zeroing theTim J. Robbins2002-06-161-1/+2
| | | | | | | input space in mf_fgets() if we reach the end of all input files. Notes: svn path=/head/; revision=98294
* Exit with non-zero status if an input file can not be opened. This wasTim J. Robbins2002-06-141-0/+1
| | | | | | | broken by rev. 1.22. Notes: svn path=/head/; revision=98201
* Fix one serious bug and one potential problem with in-place editing code:Maxim Sobolev2002-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. Notes: svn path=/head/; revision=98200
* Refer to environ(7) for description of COLUMNS instead of describing itTim J. Robbins2002-06-101-10/+9
| | | | | | | in-line. Document effects of locale environment variables in the same way. Notes: svn path=/head/; revision=98088
* The 10 occurrence limit for the `s' command documented here has not existedTim J. Robbins2002-06-101-3/+4
| | | | | | | for a very long time (or never did exist). Notes: svn path=/head/; revision=98087
* Newlines are not escaped anymore.Tim J. Robbins2002-06-101-2/+0
| | | | Notes: svn path=/head/; revision=98086
* Don't write escape newlines with `l' command (SUSv3)Tim J. Robbins2002-06-101-3/+3
| | | | Notes: svn path=/head/; revision=98085
* Correctly handle global substitutions where the pattern is only "$", theTim J. Robbins2002-06-101-0/+3
| | | | | | | | EOL anchor, when the last input line does not end in a newline character. Picked up by the GNU sed test suite. Notes: svn path=/head/; revision=98082
* Wrap lines correctly for the `l' command.Tim J. Robbins2002-06-041-1/+1
| | | | Notes: svn path=/head/; revision=97808
* Document the fact that the `l' command uses the COLUMNS environmentTim J. Robbins2002-06-041-0/+13
| | | | | | | variable (SUSv3) Notes: svn path=/head/; revision=97802
* Ignore COLUMNS environment variable if it is empty (SUSv3)Tim J. Robbins2002-06-041-1/+1
| | | | Notes: svn path=/head/; revision=97801
* Fix a bug in sed(1)'s "s" command wherein if an escape ("\" character)Brian Feldman2002-06-011-4/+24
| | | | | | | | | | was initiated at the last character of the line buffer, the Wrong Thing was done and sed barfed by interpreting the following NUL byte as a digit. Instead, pull up the next buffer and record that the "\" was last seen. Notes: svn path=/head/; revision=97703
* mdoc(7) police: typo in .Dd.Ruslan Ermilov2002-05-301-1/+1
| | | | Notes: svn path=/head/; revision=97544
* If a file argument cannot be processed, process the remaining onesTim J. Robbins2002-05-241-6/+14
| | | | | | | and exit non-zero (SUSv3) Notes: svn path=/head/; revision=97238
* More consistancy. file system > filesystemTom Rhodes2002-05-161-1/+1
| | | | Notes: svn path=/head/; revision=96704
* o Clean up tmp file usage a little by using mkstemp(3) instead ofBrian Feldman2002-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. Notes: svn path=/head/; revision=96621
* Oops, update usage() to have -i.Juli Mallett2002-05-071-2/+2
| | | | Notes: svn path=/head/; revision=96189
* Add handling for any nil-length string passed to -i for the backup extension.Juli Mallett2002-05-072-2/+21
| | | | | | | Add a note that this is kinda-sorta dangerous to the manual page. Notes: svn path=/head/; revision=96188
* Un-shadow the `fname' variable.Juli Mallett2002-05-071-9/+9
| | | | Notes: svn path=/head/; revision=96185
* Add a -i option to sed(1) to do inplace editing, to give us an alternative toJuli Mallett2002-05-072-3/+77
| | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=96175
* Remove duplicated text.Giorgos Keramidas2002-04-211-2/+1
| | | | | | | | | PR: docs/37287 Submitted by: Tony Finch <dot@dotat.at> MFC after: 3 days Notes: svn path=/head/; revision=95208
* Fix an ages-old bug in sed(1), which resulted in the absolutely validMaxim Sobolev2002-04-121-1/+1
| | | | | | | | | | | substitution expressions in the form `s,[fooexp],[barexp],;...' treated as invalid when the third `,' is (_POSIX2_LINE_MAX * N)-th character in the line. MFC after: 2 weeks Notes: svn path=/head/; revision=94540
* Fix sed(1) in the case where a last line is specified and hold space is notJuli Mallett2002-04-071-3/+5
| | | | | | | | | | | | | | | | | | | | specified, and then the first part of the pattern space is deleted, when there are two or more input lines, as this results in subtraction of one from an unsigned integral value of '0'. That bogus value is used in one case for a loop (that will run far too many times in this case) and a function to search for a value within a specified range of memory, however now the range of memory is obscenely large and a segmentation fault will occur. This is fixed by checking for and appropriately handling a nil pattern space as if the specified search in memory failed, as indeed it obviously will with nil pattern space. Submitted by: Tim J. Robbins <tim@robbins.dropbear.id.au> PR: bin/34813 Reviewed by: mike MFC after: 1 day Notes: svn path=/head/; revision=94012
* Fix sed(1) behaviour for 'G' when given null holdspace by making sure itJuli Mallett2002-04-051-0/+2
| | | | | | | | | | | | | contains a \n. PR: misc/26153 Submitted by: ashp Reviewed by: mike Obtained from: NetBSD MFC after: 2 days Notes: svn path=/head/; revision=93860
* remove __PWarner Losh2002-03-224-30/+30
| | | | Notes: svn path=/head/; revision=92922
* Remove NO_WERRORs and WARNS=n's. To be revisited after GCC3.Mark Murray2002-02-081-1/+0
| | | | Notes: svn path=/head/; revision=90416
* WARNS=2 partial fix; use NO_WERROR to protect against some hard-to-fix warnings.Mark Murray2001-12-126-43/+42
| | | | | | | Use __FBSDID(), kill register keyword. Notes: svn path=/head/; revision=87766
* Don't allocate a zero byte segment.Mike Heffner2001-11-081-1/+4
| | | | | | | | PR: bin/11900 MFC after: 2 weeks Notes: svn path=/head/; revision=86193
* mdoc(7) police: utilize the new .Ex macro.Ruslan Ermilov2001-08-151-3/+1
| | | | Notes: svn path=/head/; revision=81687
* mdoc(7) police:Ruslan Ermilov2001-08-071-12/+4
| | | | | | | | | | Avoid using parenthesis enclosure macros (.Pq and .Po/.Pc) with plain text. Not only this slows down the mdoc(7) processing significantly, but it also has an undesired (in this case) effect of disabling hyphenation within the entire enclosed block. Notes: svn path=/head/; revision=81251
* Expand xmalloc in-place, along with xrealloc; which wasn't even ANSI in itsDavid E. O'Brien2001-07-245-59/+56
| | | | | | | implementation. Notes: svn path=/head/; revision=80286
* Don't leak memory when compiling text following the `a', `c' or `i' command.Ruslan Ermilov2001-05-181-1/+1
| | | | | | | | | | | | Testcase: echo FOO | sed "/FOO/c\\ `jot -b 'aaaa\' 500`" Submitted by: Max Khon <fjoe@newst.net> Notes: svn path=/head/; revision=76804