summaryrefslogtreecommitdiff
path: root/usr.bin/what/what.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2015-01-22 19:10:18 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2015-01-22 19:10:18 +0000
commit14296d89bc90379c8d1e5b6941749403ab681a07 (patch)
treeef1ad8ca382181419baa45ed2bf04218d70a29d5 /usr.bin/what/what.c
parentcef22d6264e27eb2341eeb418dcb4a82504c8599 (diff)
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@
Diffstat (limited to 'usr.bin/what/what.c')
-rw-r--r--usr.bin/what/what.c7
1 files changed, 5 insertions, 2 deletions
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)