Yuji Yamano
2014-06-12 19:03:12 UTC
Hi!
I just found our sed supports -l option.
How about adding -u option for GNU and OpenBSD compatibility?
-- Yuji Yamano
Index: main.c
===================================================================
RCS file: /cvsroot/src/usr.bin/sed/main.c,v
retrieving revision 1.24
diff -u -r1.24 main.c
--- main.c 6 Jun 2014 12:46:54 -0000 1.24
+++ main.c 12 Jun 2014 18:52:34 -0000
@@ -137,7 +137,7 @@
fflag = 0;
inplace = NULL;
- while ((c = getopt(argc, argv, "EI::ae:f:i::lnr")) != -1)
+ while ((c = getopt(argc, argv, "EI::ae:f:i::lnru")) != -1)
switch (c) {
case 'r': /* Gnu sed compat */
case 'E':
@@ -165,6 +165,7 @@
inplace = optarg ? optarg : __UNCONST("");
ispan = 0; /* don't span across input files */
break;
+ case 'u': /* Gnu and OpenBSD sed compat */
case 'l':
#ifdef _IOLBF
c = setvbuf(stdout, NULL, _IOLBF, 0);
@@ -209,8 +210,8 @@
usage(void)
{
(void)fprintf(stderr, "%s\n%s\n",
- "usage: sed script [-Ealn] [-i extension] [file ...]",
- " sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]");
+ "usage: sed script [-Ealnru] [-i extension] [file ...]",
+ " sed [-Ealnru] [-i extension] [-e script] ... [-f script_file] ... [file ...]");
exit(1);
}
Index: sed.1
===================================================================
RCS file: /cvsroot/src/usr.bin/sed/sed.1,v
retrieving revision 1.34
diff -u -r1.34 sed.1
--- sed.1 6 Jun 2014 14:36:38 -0000 1.34
+++ sed.1 12 Jun 2014 18:52:34 -0000
@@ -40,11 +40,11 @@
.Nd stream editor
.Sh SYNOPSIS
.Nm
-.Op Fl Ealnr
+.Op Fl Ealnru
.Ar command
.Op Ar
.Nm
-.Op Fl Ealnr
+.Op Fl Ealnru
.Op Fl e Ar command
.Op Fl f Ar command_file
.Op Fl I Op Ar extension
@@ -149,6 +149,10 @@
Same as
.Fl E
for compatibility with GNU sed.
+.It Fl u
+Same as
+.Fl l
+for compatibility with GNU sed.
.El
.Pp
The form of a
@@ -599,9 +603,9 @@
specification.
.Pp
The
-.Fl E , I , a
+.Fl E , I , a , i , l , r
and
-.Fl i
+.Fl u
options, the prefixing
.Dq \&+
in the second member of an address range,
I just found our sed supports -l option.
How about adding -u option for GNU and OpenBSD compatibility?
-- Yuji Yamano
Index: main.c
===================================================================
RCS file: /cvsroot/src/usr.bin/sed/main.c,v
retrieving revision 1.24
diff -u -r1.24 main.c
--- main.c 6 Jun 2014 12:46:54 -0000 1.24
+++ main.c 12 Jun 2014 18:52:34 -0000
@@ -137,7 +137,7 @@
fflag = 0;
inplace = NULL;
- while ((c = getopt(argc, argv, "EI::ae:f:i::lnr")) != -1)
+ while ((c = getopt(argc, argv, "EI::ae:f:i::lnru")) != -1)
switch (c) {
case 'r': /* Gnu sed compat */
case 'E':
@@ -165,6 +165,7 @@
inplace = optarg ? optarg : __UNCONST("");
ispan = 0; /* don't span across input files */
break;
+ case 'u': /* Gnu and OpenBSD sed compat */
case 'l':
#ifdef _IOLBF
c = setvbuf(stdout, NULL, _IOLBF, 0);
@@ -209,8 +210,8 @@
usage(void)
{
(void)fprintf(stderr, "%s\n%s\n",
- "usage: sed script [-Ealn] [-i extension] [file ...]",
- " sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]");
+ "usage: sed script [-Ealnru] [-i extension] [file ...]",
+ " sed [-Ealnru] [-i extension] [-e script] ... [-f script_file] ... [file ...]");
exit(1);
}
Index: sed.1
===================================================================
RCS file: /cvsroot/src/usr.bin/sed/sed.1,v
retrieving revision 1.34
diff -u -r1.34 sed.1
--- sed.1 6 Jun 2014 14:36:38 -0000 1.34
+++ sed.1 12 Jun 2014 18:52:34 -0000
@@ -40,11 +40,11 @@
.Nd stream editor
.Sh SYNOPSIS
.Nm
-.Op Fl Ealnr
+.Op Fl Ealnru
.Ar command
.Op Ar
.Nm
-.Op Fl Ealnr
+.Op Fl Ealnru
.Op Fl e Ar command
.Op Fl f Ar command_file
.Op Fl I Op Ar extension
@@ -149,6 +149,10 @@
Same as
.Fl E
for compatibility with GNU sed.
+.It Fl u
+Same as
+.Fl l
+for compatibility with GNU sed.
.El
.Pp
The form of a
@@ -599,9 +603,9 @@
specification.
.Pp
The
-.Fl E , I , a
+.Fl E , I , a , i , l , r
and
-.Fl i
+.Fl u
options, the prefixing
.Dq \&+
in the second member of an address range,