summaryrefslogtreecommitdiff
path: root/usr.bin/kdump/mksubr
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2017-11-29 15:53:45 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2017-11-29 15:53:45 +0000
commit99413930eaf942ac7b1d29ff27266c410d4bbee3 (patch)
tree8ccf5050502f1a304ac71b34488e0813a46c8059 /usr.bin/kdump/mksubr
parent537d453366dab6dfebb76accd3c2801fd411bdfa (diff)
fcntl(F_GETOWN) doesn't have an argument, so don't display it. While
here, make it easier to extend the set of such fcntl() commands ok deraadt@
Diffstat (limited to 'usr.bin/kdump/mksubr')
-rw-r--r--usr.bin/kdump/mksubr19
1 files changed, 13 insertions, 6 deletions
diff --git a/usr.bin/kdump/mksubr b/usr.bin/kdump/mksubr
index ece75fc967c..8771356341a 100644
--- a/usr.bin/kdump/mksubr
+++ b/usr.bin/kdump/mksubr
@@ -1,5 +1,5 @@
#!/bin/sh
-# $OpenBSD: mksubr,v 1.32 2017/04/28 13:53:05 mpi Exp $
+# $OpenBSD: mksubr,v 1.33 2017/11/29 15:53:44 guenther Exp $
#
# Copyright (c) 2006 David Kirchner <dpk@dpk.net>
#
@@ -375,18 +375,25 @@ cat <<_EOF_
void
fcntlcmdname (int arg)
{
+ int noarg = 0;
+
switch (arg1) {
_EOF_
egrep "^#[[:space:]]*define[[:space:]]+F_[A-Z_]+[[:space:]]+[0-9]+[[:space:]]*" \
$include_dir/sys/fcntl.h | \
- awk 'BEGIN { o=0 } { for (i = 1; i <= NF; i++) \
+ awk 'BEGIN { o=0; \
+ noarg["F_GETFD"] = 1; \
+ noarg["F_GETFL"] = 1; \
+ noarg["F_ISATTY"] = 1; \
+ noarg["F_GETOWN"] = 1; \
+ }{ for (i = 1; i <= NF; i++) \
if ($i ~ /define/) \
break; \
++i; \
- if (o <= $(i+1)) \
- printf "\tcase %s:\n\t\t(void)printf(\"%s\");\n\t\tbreak;\n", $i, $i; \
- else \
+ if (o > $(i+1)) \
exit; \
+ printf "\tcase %s:\n\t\t(void)printf(\"%s\");%s\n\t\tbreak;\n", $i, $i, \
+ noarg[$i] ? "\n\t\tnoarg = 1;" : ""; \
o = $(i+1) }'
cat <<_EOF_
default: /* Should not reach */
@@ -404,7 +411,7 @@ cat <<_EOF_
} else if (arg1 == F_SETFL) {
(void)putchar(',');
doflagsname(arg, 0);
- } else if (!fancy || (arg1 != F_GETFD && arg1 != F_GETFL && arg1 != F_ISATTY))
+ } else if (!fancy || !noarg)
(void)printf(",%#x", arg);
}