about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/usr.bin/calendar/io.c6
-rw-r--r--src/usr.bin/calendar/pathnames.h2
-rw-r--r--src/usr.bin/lam/lam.159
-rw-r--r--src/usr.bin/lam/lam.c50
-rw-r--r--src/usr.bin/signify/signify.110
5 files changed, 83 insertions, 44 deletions
diff --git a/src/usr.bin/calendar/io.c b/src/usr.bin/calendar/io.c
index d062568..41bc786 100644
--- a/src/usr.bin/calendar/io.c
+++ b/src/usr.bin/calendar/io.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: io.c,v 1.49 2019/06/28 13:35:00 deraadt Exp $	*/
+/*	$OpenBSD: io.c,v 1.51 2021/12/07 14:00:33 robert Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993, 1994
@@ -355,14 +355,14 @@ opencal(void)
 		 */
 		if (doall) {
 			int fderr;
-			fderr = open(_PATH_DEVNULL, O_WRONLY, 0);
+			fderr = open(_PATH_DEVNULL, O_WRONLY);
 			if (fderr == -1)
 				_exit(0);
 			(void)dup2(fderr, STDERR_FILENO);
 			(void)close(fderr);
 		}
 		execl(_PATH_CPP, "cpp", "-traditional", "-undef", "-U__GNUC__",
-		    "-P", "-I.", _PATH_INCLUDE, (char *)NULL);
+		    "-P", "-I.", "-w", _PATH_INCLUDE, (char *)NULL);
 		warn(_PATH_CPP);
 		_exit(1);
 	}
diff --git a/src/usr.bin/calendar/pathnames.h b/src/usr.bin/calendar/pathnames.h
index 60fe31c..fe7684b 100644
--- a/src/usr.bin/calendar/pathnames.h
+++ b/src/usr.bin/calendar/pathnames.h
@@ -1,4 +1,4 @@
-/*	$OpenBSD: pathnames.h,v 1.5 2014/07/30 16:46:17 jsg Exp $	*/
+/*	$OpenBSD: pathnames.h,v 1.6 2021/12/07 14:00:33 robert Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
diff --git a/src/usr.bin/lam/lam.1 b/src/usr.bin/lam/lam.1
index bbdeb1e..e86446b 100644
--- a/src/usr.bin/lam/lam.1
+++ b/src/usr.bin/lam/lam.1
@@ -1,4 +1,4 @@
-.\"	$OpenBSD: lam.1,v 1.10 2018/07/29 11:27:14 schwarze Exp $
+.\"	$OpenBSD: lam.1,v 1.11 2021/12/02 15:15:29 jmc Exp $
 .\"	$NetBSD: lam.1,v 1.4 2002/02/08 01:36:25 ross Exp $
 .\"
 .\" Copyright (c) 1993
@@ -30,7 +30,7 @@
 .\"
 .\"	@(#)lam.1	8.1 (Berkeley) 6/6/93
 .\"
-.Dd $Mdocdate: July 29 2018 $
+.Dd $Mdocdate: December 2 2021 $
 .Dt LAM 1
 .Os
 .Sh NAME
@@ -38,10 +38,10 @@
 .Nd laminate files
 .Sh SYNOPSIS
 .Nm
-.Op Fl f Ar min.max
-.Op Fl p Ar min.max
-.Op Fl s Ar sepstring
-.Op Fl t Ar c
+.Op Fl F\*(Baf Ar min.max
+.Op Fl P\*(Bap Ar min.max
+.Op Fl S\*(Bas Ar sepstring
+.Op Fl T\*(Bat Ar c
 .Ar
 .Sh DESCRIPTION
 .Nm
@@ -57,14 +57,9 @@ The name
 .Dq \&-
 means the standard input, and may be repeated.
 .Pp
-Normally, each option affects only the
-.Ar file
-after it.
-If the option letter is capitalized it affects all subsequent files
-until it appears again uncapitalized.
-The options are described below.
+The options are as follows:
 .Bl -tag -width "-s sepstring"
-.It Fl f Ar min.max
+.It Fl F\*(Baf Ar min.max
 Print line fragments according to the format string
 .Ar min.max ,
 where
@@ -79,21 +74,53 @@ instead of blanks, and if it begins with a
 .Sq \&- ,
 the fragment will be left-adjusted
 within the field.
-.It Fl p Ar min.max
+.Pp
+If
+.Fl f
+is used, it affects only the file after it;
+if
+.Fl F
+is used, it affects all subsequent files
+until it appears again uncapitalized.
+.It Fl P\*(Bap Ar min.max
 Like
 .Fl f ,
 but pad this file's field when end-of-file is reached
 and other files are still active.
-.It Fl s Ar sepstring
+.Pp
+If
+.Fl p
+is used, it affects only the file after it;
+if
+.Fl P
+is used, it affects all subsequent files
+until it appears again uncapitalized.
+.It Fl S\*(Bas Ar sepstring
 Print
 .Ar sepstring
 before printing line fragments from the next file.
 This option may appear after the last file.
-.It Fl t Ar c
+.Pp
+If
+.Fl s
+is used, it affects only the file after it;
+if
+.Fl S
+is used, it affects all subsequent files
+until it appears again uncapitalized.
+.It Fl T\*(Bat Ar c
 The input line terminator is
 .Ar c
 instead of a newline.
 The newline normally appended to each output line is omitted.
+.Pp
+If
+.Fl t
+is used, it affects only the file after it;
+if
+.Fl T
+is used, it affects all subsequent files
+until it appears again uncapitalized.
 .El
 .Pp
 To print files simultaneously for easy viewing use
diff --git a/src/usr.bin/lam/lam.c b/src/usr.bin/lam/lam.c
index df1faf1..9c009f2 100644
--- a/src/usr.bin/lam/lam.c
+++ b/src/usr.bin/lam/lam.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: lam.c,v 1.22 2018/07/29 11:27:14 schwarze Exp $	*/
+/*	$OpenBSD: lam.c,v 1.24 2021/12/03 15:15:22 deraadt Exp $	*/
 /*	$NetBSD: lam.c,v 1.2 1994/11/14 20:27:42 jtc Exp $	*/
 
 /*-
@@ -35,13 +35,14 @@
  *	Author:  John Kunze, UCB
  */
 
-#include <sys/param.h>	/* NOFILE_MAX */
+#include <sys/types.h>
 
 #include <ctype.h>
 #include <err.h>
 #include <locale.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <limits.h>
 #include <string.h>
 #include <unistd.h>
 
@@ -56,10 +57,10 @@ struct	openfile {		/* open file structure */
 	char	eol;		/* end of line character */
 	char	align;		/* '0' for zero fill, '-' for left align */
 	char	*sepstring;	/* string to print before each line */
-}	input[NOFILE_MAX + 1];	/* last one is for the last -s arg. */
-#define INPUTSIZE sizeof(input) / sizeof(*input)
+}	*input;
+int	inputsize;		/* number of openfile entries */
 
-int	numfiles;		/* number of open files */
+int	output;			/* line output produced */
 int	nofinalnl;		/* normally append \n to each output line */
 char	line[BIGBUFSIZ];
 char	*linep;
@@ -81,9 +82,8 @@ main(int argc, char *argv[])
 	if (pledge("stdio rpath", NULL) == -1)
 		err(1, "pledge");
 
-	/* Process arguments, set numfiles to file argument count. */
 	getargs(argc, argv);
-	if (numfiles == 0)
+	if (inputsize == 0)
 		usage();
 
 	if (pledge("stdio", NULL) == -1)
@@ -93,13 +93,13 @@ main(int argc, char *argv[])
 	for (;;) {
 		linep = line;
 		/*
-		 * For each file that has a line to print, numfile is
+		 * For each file that has a line to print, output is
 		 * incremented.  Thus if numfiles is 0, we are done.
 		 */
-		numfiles = 0;
-		for (i = 0; i < INPUTSIZE - 1 && input[i].fp != NULL; i++)
+		output = 0;
+		for (i = 0; i < inputsize && input[i].fp != NULL; i++)
 			linep = gatherline(&input[i]);
-		if (numfiles == 0)
+		if (output == 0)
 			exit(0);
 		fputs(line, stdout);
 		/* Print terminating -s argument. */
@@ -112,11 +112,17 @@ main(int argc, char *argv[])
 void
 getargs(int argc, char *argv[])
 {
-	struct openfile *ip = input;
+	struct openfile *ip;
 	const char *errstr;
 	char *p, *q;
+	void *tmp;
 	int ch, P, S, F, T;
 
+	input = calloc(inputsize+1, sizeof *input);
+	if (input == NULL)
+		errx(1, "too many files");
+	ip = &input[inputsize];
+
 	P = S = F = T = 0;		/* capitalized options */
 	while (optind < argc) {
 		switch (ch = getopt(argc, argv, "+F:f:P:p:S:s:T:t:")) {
@@ -165,9 +171,6 @@ getargs(int argc, char *argv[])
 			if (optind >= argc)
 				break;		/* to support "--" */
 			/* This is a file, not a flag. */
-			++numfiles;
-			if (numfiles >= INPUTSIZE)
-				errx(1, "too many files");
 			if (strcmp(argv[optind], "-") == 0)
 				ip->fp = stdin;
 			else if ((ip->fp = fopen(argv[optind], "r")) == NULL)
@@ -185,7 +188,16 @@ getargs(int argc, char *argv[])
 				} else
 					ip->maxwidth = INT_MAX;
 			}
-			ip++;
+
+			++inputsize;
+
+			/* Prepare for next file argument */
+			tmp = recallocarray(input, inputsize,
+			    inputsize+1, sizeof *input);
+			if (tmp == NULL)
+				errx(1, "too many files");
+			input = tmp;
+			ip = &input[inputsize];
 			optind++;
 			break;
 		default:
@@ -215,7 +227,7 @@ pad(struct openfile *ip)
 }
 
 /*
- * Grab line from file, appending to linep.  Increments numfiles if file
+ * Grab line from file, appending to linep.  Increments printed if file
  * is still open.
  */
 char *
@@ -241,7 +253,7 @@ gatherline(struct openfile *ip)
 		return (pad(ip));
 	}
 	/* Something will be printed. */
-	numfiles++;
+	output++;
 	n = strlcpy(lp, ip->sepstring, line + sizeof(line) - lp);
 	lp += (n < line + sizeof(line) - lp) ? n : strlen(lp);
 	width = mbswidth_truncate(s, ip->maxwidth);
@@ -263,7 +275,7 @@ usage(void)
 	extern char *__progname;
 
 	fprintf(stderr,
-	    "usage: %s [-f min.max] [-p min.max] [-s sepstring] [-t c] file ...\n",
+	    "usage: %s [-F|f min.max] [-P|p min.max] [-S|s sepstring] [-T|t c] file ...\n",
 	    __progname);
 	exit(1);
 }
diff --git a/src/usr.bin/signify/signify.1 b/src/usr.bin/signify/signify.1
index 3dcd55d..e973745 100644
--- a/src/usr.bin/signify/signify.1
+++ b/src/usr.bin/signify/signify.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: signify.1,v 1.53 2021/09/19 20:58:28 benno Exp $
+.\" $OpenBSD: signify.1,v 1.55 2022/02/20 17:11:05 deraadt Exp $
 .\"
 .\"Copyright (c) 2013 Marc Espie <espie@openbsd.org>
 .\"Copyright (c) 2013 Ted Unangst <tedu@openbsd.org>
@@ -14,7 +14,7 @@
 .\"WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 .\"ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\"OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-.Dd $Mdocdate: September 19 2021 $
+.Dd $Mdocdate: February 20 2022 $
 .Dt SIGNIFY 1
 .Os
 .Sh NAME
@@ -171,12 +171,12 @@ Verify a release directory containing
 .Pa SHA256.sig
 and a full set of release files:
 .Bd -literal -offset indent -compact
-$ signify -C -p /etc/signify/openbsd-71-base.pub -x SHA256.sig
+$ signify -C -p /etc/signify/openbsd-72-base.pub -x SHA256.sig
 .Ed
 .Pp
 Verify a bsd.rd before an upgrade:
 .Bd -literal -offset indent -compact
-$ signify -C -p /etc/signify/openbsd-71-base.pub -x SHA256.sig bsd.rd
+$ signify -C -p /etc/signify/openbsd-72-base.pub -x SHA256.sig bsd.rd
 .Ed
 .Pp
 Sign a gzip archive:
@@ -189,10 +189,10 @@ Verify a gzip pipeline:
 $ ftp url | signify -Vz -t arc | tar ztf -
 .Ed
 .Sh SEE ALSO
-.Xr fw_update 1 ,
 .Xr gzip 1 ,
 .Xr pkg_add 1 ,
 .Xr sha256 1 ,
+.Xr fw_update 8 ,
 .Xr sysupgrade 8
 .Sh HISTORY
 The