summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2015-01-22 19:10:17 +0000
committerkrw <krw@openbsd.org>2015-01-22 19:10:17 +0000
commitafa72ff4bbc8c1cd26bcfc4881df90546bce8913 (patch)
tree5582dade1abafda301b10ce239962a09030572d3
parentUse /etc/services names in all the default pf rules (most already (diff)
downloadwireguard-openbsd-afa72ff4bbc8c1cd26bcfc4881df90546bce8913.tar.xz
wireguard-openbsd-afa72ff4bbc8c1cd26bcfc4881df90546bce8913.zip
Processing $OpenBSD$ as well as sccs's @(#) is an OpenBSD extension, and
should stop displaying the line at the 2nd '$'. Clarify intended behaviour in man page. ok millert@ beck@ deraadt@
-rw-r--r--usr.bin/what/what.124
-rw-r--r--usr.bin/what/what.c7
2 files changed, 25 insertions, 6 deletions
diff --git a/usr.bin/what/what.1 b/usr.bin/what/what.1
index e3b1ad99054..076e7abba6c 100644
--- a/usr.bin/what/what.1
+++ b/usr.bin/what/what.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: what.1,v 1.18 2014/06/03 21:20:40 jmc Exp $
+.\" $OpenBSD: what.1,v 1.19 2015/01/22 19:10:17 krw Exp $
.\" $NetBSD: what.1,v 1.3 1994/11/17 06:59:38 jtc Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
@@ -30,7 +30,7 @@
.\"
.\" @(#)what.1 8.1 (Berkeley) 6/6/93
.\"
-.Dd $Mdocdate: June 3 2014 $
+.Dd $Mdocdate: January 22 2015 $
.Dt WHAT 1
.Os
.Sh NAME
@@ -51,8 +51,20 @@ immediately followed by the system name (sysname) as defined by
or the form
.Dq @(#)
as inserted by the source code control system (SCCS).
-It prints the remainder
-of the string following this marker, up to a NUL, newline, double
+.Pp
+When
+.Sq $
+followed by the system name is encountered
+.Nm
+prints the remainder of the string up to a
+.Sq $
+or any non-printable character.
+.Pp
+When
+.Dq @(#)
+is encountered
+.Nm
+prints the remainder of the string, up to a NUL, newline, double
quote, backslash, or
.Sq >
character.
@@ -73,6 +85,10 @@ utility is compliant with the
X/Open System Interfaces option of the
.St -p1003.1-2008
specification.
+.Pp
+Processing $sysname$ sequences is an
+.Ox
+extension.
.Sh HISTORY
The
.Nm
diff --git a/usr.bin/what/what.c b/usr.bin/what/what.c
index 7a89b1d4642..0bad985ab08 100644
--- a/usr.bin/what/what.c
+++ b/usr.bin/what/what.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: what.c,v 1.12 2009/10/27 23:59:50 deraadt Exp $ */
+/* $OpenBSD: what.c,v 1.13 2015/01/22 19:10:17 krw Exp $ */
/* $NetBSD: what.c,v 1.4 1994/12/20 16:01:03 jtc Exp $ */
/*
@@ -100,8 +100,11 @@ loop: if (c == '$') {
if ((c = getchar()) != match[i])
goto loop;
printf("\t$%s", match);
- while (isprint(c = getchar()))
+ while (isprint(c = getchar())) {
putchar(c);
+ if (c == '$')
+ break;
+ }
putchar('\n');
matches++;
if (sflag)