Page MenuHomeFreeBSD

D39393.diff
No OneTemporary

D39393.diff

diff --git a/sbin/setkey/setkey.8 b/sbin/setkey/setkey.8
--- a/sbin/setkey/setkey.8
+++ b/sbin/setkey/setkey.8
@@ -29,7 +29,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd October 19, 2022
+.Dd April 3, 2023
.Dt SETKEY 8
.Os
.\"
@@ -45,6 +45,9 @@
.Op Fl v
.Fl f Ar filename
.Nm
+.Op Fl v
+.Fl e Ar script
+.Nm
.Op Fl Pgltv
.Fl D
.Nm
@@ -65,11 +68,14 @@
.Nm
utility takes a series of operations from the standard input
(if invoked with
-.Fl c )
-or the file named
+.Fl c ) ,
+from the file named
.Ar filename
(if invoked with
-.Fl f Ar filename ) .
+.Fl f Ar filename ) ,
+or from the command line argument following the option
+(if invoked with
+.Fl e Ar script ) .
.Bl -tag -width indent
.It Fl D
Dump the SAD entries.
diff --git a/sbin/setkey/setkey.c b/sbin/setkey/setkey.c
--- a/sbin/setkey/setkey.c
+++ b/sbin/setkey/setkey.c
@@ -99,6 +99,7 @@
printf("usage: setkey [-v] -c\n");
printf(" setkey [-v] -f filename\n");
+ printf(" setkey [-v] -e \"<script>\"\n");
printf(" setkey [-Pagltv] -D\n");
printf(" setkey [-Pv] -F\n");
printf(" setkey [-h] -x\n");
@@ -129,13 +130,27 @@
thiszone = gmt2local(0);
- while ((c = getopt(ac, av, "acdf:ghltvxDFP")) != -1) {
+ while ((c = getopt(ac, av, "acde:f:ghltvxDFP")) != -1) {
switch (c) {
case 'c':
f_mode = MODE_SCRIPT;
fp = stdin;
break;
+ case 'e':
+ if (fp != stdin) {
+ err(-1, "only one -f/-e option is accepted");
+ }
+ f_mode = MODE_SCRIPT;
+ fp = fmemopen(optarg, strlen(optarg), "r");
+ if (fp == NULL) {
+ err(-1, "fmemopen");
+ /*NOTREACHED*/
+ }
+ break;
case 'f':
+ if (fp != stdin) {
+ err(-1, "only one -f/-e option is accepted");
+ }
f_mode = MODE_SCRIPT;
if ((fp = fopen(optarg, "r")) == NULL) {
err(-1, "fopen");

File Metadata

Mime Type
text/plain
Expires
Tue, Jan 27, 1:00 AM (10 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28047517
Default Alt Text
D39393.diff (1 KB)

Event Timeline