OpenBSD CVS

CVS log for src/usr.bin/sed/main.c


[BACK] Up to [local] / src / usr.bin / sed

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.44 / (download) - annotate - [select for diffs], Wed Feb 8 08:18:11 2023 UTC (15 months, 1 week ago) by tb
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, HEAD
Changes since 1.43: +2 -2 lines
Diff to previous 1.43 (colored)

sed: add missing void to avoid -Wstrict-prototype with clang 15

Revision 1.43 / (download) - annotate - [select for diffs], Sun Dec 4 23:50:49 2022 UTC (17 months, 2 weeks ago) by cheloha
Branch: MAIN
Changes since 1.42: +1 -2 lines
Diff to previous 1.42 (colored)

userspace: remove vestigial '?' cases from top-level getopt(3) loops

getopt(3) returns '?' when it encounters a flag not present in the in
the optstring or if a flag is missing its option argument.  We can
handle this case with the "default" failure case with no loss of
legibility.  Hence, remove all the redundant "case '?':" lines.

Prompted by dlg@.  With help from dlg@ and millert@.

Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2

ok naddy@ millert@ dlg@

Revision 1.42 / (download) - annotate - [select for diffs], Sun Jan 31 14:23:05 2021 UTC (3 years, 3 months ago) by naddy
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.41: +11 -16 lines
Diff to previous 1.41 (colored)

replace fgetln(3) with getline(3) in sed

Partly from Johann Oskarsson for Illumos/FreeBSD.
ok millert@

Revision 1.41 / (download) - annotate - [select for diffs], Tue Oct 13 06:07:54 2020 UTC (3 years, 7 months ago) by martijn
Branch: MAIN
Changes since 1.40: +5 -3 lines
Diff to previous 1.40 (colored)

Un-const what we pass to dirname(3).

Original diff by and OK naddy@

Revision 1.40 / (download) - annotate - [select for diffs], Sat Dec 8 23:11:24 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6, OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.39: +21 -9 lines
Diff to previous 1.39 (colored)

revert previous, it breaks regress and the llvm, gtk+2, and gtk+3 ports
because it changes the behaviour for empty input files;
revert requested by naddy@ and sthen@

Revision 1.39 / (download) - annotate - [select for diffs], Thu Dec 6 20:16:04 2018 UTC (5 years, 5 months ago) by martijn
Branch: MAIN
Changes since 1.38: +9 -21 lines
Diff to previous 1.38 (colored)

Add support for "-" as an input file for stdin as per POSIX.
Simplify the code by allowing usage of stdin with the -i flag by pushing
the result to stdout, so filters and in place editing can be combined.

OK millert@

Revision 1.38 / (download) - annotate - [select for diffs], Wed Nov 14 10:59:33 2018 UTC (5 years, 6 months ago) by martijn
Branch: MAIN
Changes since 1.37: +27 -21 lines
Diff to previous 1.37 (colored)

Make sed's -i flag more compatible with what gsed does.
- Reset the hold-space in between files
- quit the editor as soon as a 'q' command is found
- Make sure the temp-file is written back to the original file if we quit
  the editor

temp-file not written back issue found by Time Chase.
Lots of feedback from millert@ and schwarze@
OK millert@

Revision 1.37 / (download) - annotate - [select for diffs], Wed Jul 11 06:57:18 2018 UTC (5 years, 10 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.36: +5 -1 lines
Diff to previous 1.36 (colored)

Make the output of the list command more sensible for the output device.
We now output $COLUMNS - 8 characters of the string and a newline.
This is similar to the behaviour in ed(1).

Discussed with and OK schwarze@

Revision 1.36 / (download) - annotate - [select for diffs], Wed Dec 13 16:06:34 2017 UTC (6 years, 5 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.35: +4 -4 lines
Diff to previous 1.35 (colored)

Fix sign compare warnings; OK martijn@

Revision 1.35 / (download) - annotate - [select for diffs], Tue Aug 1 18:05:53 2017 UTC (6 years, 9 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.34: +20 -3 lines
Diff to previous 1.34 (colored)

Apply stricter pledge rules if possible. These are based on the usage of
the 'w' and 'r' functions and the 'w' flag to the 's' function.

If non of the above is used and input is being read from stdin, we drop
all the way down to stdio!

Original inspiration by benno@.

OK millert@

Revision 1.34 / (download) - annotate - [select for diffs], Fri Jan 20 10:26:16 2017 UTC (7 years, 3 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.33: +5 -4 lines
Diff to previous 1.33 (colored)

Split error() into error() and warning() so error() can be marked __dead to
appease gcc.

ok procter@ deraadt@

Revision 1.33 / (download) - annotate - [select for diffs], Thu Jul 14 08:31:18 2016 UTC (7 years, 10 months ago) by semarie
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.32: +2 -2 lines
Diff to previous 1.32 (colored)

make several program to use "chown" promise.

it allows chown(2) call to change the user or group on a file.

- usr.bin/compress : aka gzip
- usr.bin/mg : open a file for writing
- usr.bin/sed : inplace editing
- usr.bin/sort : if outfile equals one of the input files

ok deraadt@ tb@

(and a reminder from Remi Locherer)

warning: in order to use it, you must have a recent kernel with the new
promise.

Revision 1.32 / (download) - annotate - [select for diffs], Thu Mar 17 05:27:10 2016 UTC (8 years, 2 months ago) by bentley
Branch: MAIN
Changes since 1.31: +5 -5 lines
Diff to previous 1.31 (colored)

Switch (non-curses, non-ksh) programs that use COLUMNS to a single idiom.

Previously behaviors were all over the map. This changes them to
use COLUMNS first, and either terminal width or a hardcoded value
(typically 80) as appropriate.

ok deraadt@; man bits ok jmc@

Revision 1.31 / (download) - annotate - [select for diffs], Fri Jan 1 20:55:13 2016 UTC (8 years, 4 months ago) by tb
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.30: +2 -2 lines
Diff to previous 1.30 (colored)

Improve error message for sed -i by appending strerror(errno).
From Michael Reed, thanks!

ok deraadt@

Revision 1.30 / (download) - annotate - [select for diffs], Mon Oct 26 22:22:56 2015 UTC (8 years, 6 months ago) by jca
Branch: MAIN
Changes since 1.29: +4 -4 lines
Diff to previous 1.29 (colored)

Use error(FATAL) instead of what was previously err(1,...)

ok tobias@

Revision 1.29 / (download) - annotate - [select for diffs], Mon Oct 26 14:08:47 2015 UTC (8 years, 6 months ago) by mmcc
Branch: MAIN
Changes since 1.28: +15 -15 lines
Diff to previous 1.28 (colored)

Rename err() to error() to prevent confusion with the stdlib function.

Discussed with jca@.

Revision 1.28 / (download) - annotate - [select for diffs], Sun Oct 25 20:18:37 2015 UTC (8 years, 6 months ago) by tobias
Branch: MAIN
Changes since 1.27: +2 -2 lines
Diff to previous 1.27 (colored)

Write error message instead of duplicated file name on error.

ok deraadt

Revision 1.27 / (download) - annotate - [select for diffs], Sat Oct 10 20:18:30 2015 UTC (8 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.26: +3 -3 lines
Diff to previous 1.26 (colored)

normalize the ordering of tame requests (particularily, "rpath wpath cpath",
which i have put in that order). this is not important, but helps look
for outliers which might be strange.  it hints that "ioctl" should be
reassessed in a few places, to see if "tty" is better; that "unix" may
be used in some places where "route" could now work.

Revision 1.26 / (download) - annotate - [select for diffs], Fri Oct 9 01:37:08 2015 UTC (8 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.25: +5 -5 lines
Diff to previous 1.25 (colored)

Change all tame callers to namechange to pledge(2).

Revision 1.25 / (download) - annotate - [select for diffs], Sat Oct 3 00:58:59 2015 UTC (8 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.24: +9 -1 lines
Diff to previous 1.24 (colored)

sed only works on files, so the obvious goal is to remove it's network
access in case it is exploited.  tame with "stdio wpath rpath cpath"
seesms to covers all usage cases, except -i performs a fchmod() on the
in-place file, so conditionally also needs "fattr".
ok sthen

Revision 1.24 / (download) - annotate - [select for diffs], Sun Jul 19 17:21:21 2015 UTC (8 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.23: +15 -1 lines
Diff to previous 1.23 (colored)

figure out the linewidth at initialization, rather than late
ok tedu miod

Revision 1.23 / (download) - annotate - [select for diffs], Sun Jul 19 06:14:23 2015 UTC (8 years, 10 months ago) by sthen
Branch: MAIN
Changes since 1.22: +3 -2 lines
Diff to previous 1.22 (colored)

Print strerror, not just the filename, if opening the inplace file fails.
ok jasper@

Revision 1.22 / (download) - annotate - [select for diffs], Sat Jul 18 09:33:00 2015 UTC (8 years, 10 months ago) by jmc
Branch: MAIN
Changes since 1.21: +3 -3 lines
Diff to previous 1.21 (colored)

various fixes; ok jasper

Revision 1.21 / (download) - annotate - [select for diffs], Fri Jul 17 21:54:26 2015 UTC (8 years, 10 months ago) by jasper
Branch: MAIN
Changes since 1.20: +2 -1 lines
Diff to previous 1.20 (colored)

add missing prototype

Revision 1.20 / (download) - annotate - [select for diffs], Fri Jul 17 21:21:02 2015 UTC (8 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.19: +21 -23 lines
Diff to previous 1.19 (colored)

7 space indents??

Revision 1.19 / (download) - annotate - [select for diffs], Fri Jul 17 20:38:57 2015 UTC (8 years, 10 months ago) by jasper
Branch: MAIN
Changes since 1.18: +174 -53 lines
Diff to previous 1.18 (colored)

add -i flag to sed to do in-place editing; mostly based on freebsd

feedback/ok deraadt@ millert@

Revision 1.18 / (download) - annotate - [select for diffs], Wed Nov 26 18:34:51 2014 UTC (9 years, 5 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.17: +2 -2 lines
Diff to previous 1.17 (colored)

Prefer setvbuf() to setlinebuf() for portability; ok deraadt@

Revision 1.17 / (download) - annotate - [select for diffs], Tue Oct 27 23:59:43 2009 UTC (14 years, 6 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6, OPENBSD_5_5_BASE, OPENBSD_5_5, OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8, OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.16: +1 -9 lines
Diff to previous 1.16 (colored)

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable).  these days, people use source.  these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms

Revision 1.16 / (download) - annotate - [select for diffs], Fri Aug 7 03:30:56 2009 UTC (14 years, 9 months ago) by djm
Branch: MAIN
Changes since 1.15: +10 -6 lines
Diff to previous 1.15 (colored)

add -E flag to compile regular expressions using the extended POSIX
syntax. The -E flag is compatible with the other BSDs and OSX. -r is
also provided as an alias for compatibility with GNU sed.

feedback from jmc@ and millert@
ok millert@ pyr@ henning@ marco@

Revision 1.15 / (download) - annotate - [select for diffs], Thu Oct 16 16:34:32 2008 UTC (15 years, 7 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.14: +18 -14 lines
Diff to previous 1.14 (colored)

Move memory allocation closer to where it is needed.  Also make
a distinction between len and size.  OK deraadt@

Revision 1.14 / (download) - annotate - [select for diffs], Thu Oct 9 10:58:32 2008 UTC (15 years, 7 months ago) by millert
Branch: MAIN
Changes since 1.13: +2 -4 lines
Diff to previous 1.13 (colored)

Don't strip newline when reading lines; matches the original behavior.
From otto@

Revision 1.13 / (download) - annotate - [select for diffs], Wed Oct 8 17:26:47 2008 UTC (15 years, 7 months ago) by millert
Branch: MAIN
Changes since 1.12: +27 -13 lines
Diff to previous 1.12 (colored)

Allow sed to handle arbitrarily long lines.  Also plug a memory
leak noticed in the process.  Closes PR 5303.  OK otto@ deraadt@

Revision 1.12 / (download) - annotate - [select for diffs], Tue Oct 16 20:19:27 2007 UTC (16 years, 7 months ago) by sobrado
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4, OPENBSD_4_3_BASE, OPENBSD_4_3
Changes since 1.11: +4 -3 lines
Diff to previous 1.11 (colored)

sync the synopsis and usage of commands

ok jmc@

Revision 1.11 / (download) - annotate - [select for diffs], Tue Mar 20 06:07:57 2007 UTC (17 years, 2 months ago) by ray
Branch: MAIN
CVS Tags: OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.10: +7 -4 lines
Diff to previous 1.10 (colored)

Add line-buffering flag (-u).

OK deraadt@ and jmc@.

Revision 1.10 / (download) - annotate - [select for diffs], Mon Oct 9 00:23:57 2006 UTC (17 years, 7 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.9: +3 -6 lines
Diff to previous 1.9 (colored)

pretty.  the comma operator should not be used to cram two statements into
an if without braces, or worse, into a return.

Revision 1.9 / (download) - annotate - [select for diffs], Tue Jun 10 22:20:50 2003 UTC (20 years, 11 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0, OPENBSD_3_9_BASE, OPENBSD_3_9, OPENBSD_3_8_BASE, OPENBSD_3_8, OPENBSD_3_7_BASE, OPENBSD_3_7, OPENBSD_3_6_BASE, OPENBSD_3_6, OPENBSD_3_5_BASE, OPENBSD_3_5, OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.8: +7 -16 lines
Diff to previous 1.8 (colored)

mostly ansi cleanup; pval ok

Revision 1.8 / (download) - annotate - [select for diffs], Tue Jun 3 02:56:16 2003 UTC (20 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.7: +3 -7 lines
Diff to previous 1.7 (colored)

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999.  Proofed by myself and Theo.

Revision 1.7 / (download) - annotate - [select for diffs], Thu Mar 13 15:47:11 2003 UTC (21 years, 2 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_3_BASE, OPENBSD_3_3
Changes since 1.6: +4 -4 lines
Diff to previous 1.6 (colored)

a few more strlcpy

Revision 1.6 / (download) - annotate - [select for diffs], Sat Feb 16 21:27:52 2002 UTC (22 years, 3 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_2_BASE, OPENBSD_3_2, OPENBSD_3_1_BASE, OPENBSD_3_1
Changes since 1.5: +4 -4 lines
Diff to previous 1.5 (colored)

Part one of userland __P removal.  Done with a simple regexp with some minor hand editing to make comments line up correctly.  Another pass is forthcoming that handles the cases that could not be done automatically.

Revision 1.5 / (download) - annotate - [select for diffs], Tue Jun 23 22:40:42 1998 UTC (25 years, 11 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE, OPENBSD_3_0, OPENBSD_2_9_BASE, OPENBSD_2_9, OPENBSD_2_8_BASE, OPENBSD_2_8, OPENBSD_2_7_BASE, OPENBSD_2_7, OPENBSD_2_6_BASE, OPENBSD_2_6, OPENBSD_2_5_BASE, OPENBSD_2_5, OPENBSD_2_4_BASE, OPENBSD_2_4
Changes since 1.4: +3 -3 lines
Diff to previous 1.4 (colored)

Fix snprintf return value usage.

Revision 1.4 / (download) - annotate - [select for diffs], Wed Jan 15 23:43:12 1997 UTC (27 years, 4 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_3_BASE, OPENBSD_2_3, OPENBSD_2_2_BASE, OPENBSD_2_2, OPENBSD_2_1_BASE, OPENBSD_2_1
Changes since 1.3: +3 -3 lines
Diff to previous 1.3 (colored)

getopt(3) returns -1 when out of args, not EOF, whee!

Revision 1.3 / (download) - annotate - [select for diffs], Wed Jun 26 05:39:07 1996 UTC (27 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_0_BASE, OPENBSD_2_0
Changes since 1.2: +3 -1 lines
Diff to previous 1.2 (colored)

rcsid

Revision 1.2 / (download) - annotate - [select for diffs], Tue May 21 21:50:46 1996 UTC (28 years ago) by deraadt
Branch: MAIN
Changes since 1.1: +3 -2 lines
Diff to previous 1.1 (colored)

getc/ungetc use an int

Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Wed Oct 18 08:46:05 1995 UTC (28 years, 7 months ago) by deraadt
CVS Tags: netbsd_1_1
Changes since 1.1: +0 -0 lines
Diff to previous 1.1 (colored)

initial import of NetBSD tree

Revision 1.1 / (download) - annotate - [select for diffs], Wed Oct 18 08:46:05 1995 UTC (28 years, 7 months ago) by deraadt
Branch: MAIN

Initial revision

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.