aboutsummaryrefslogtreecommitdiff
path: root/progs/mkcapshdoc.sh
diff options
context:
space:
mode:
Diffstat (limited to 'progs/mkcapshdoc.sh')
-rwxr-xr-xprogs/mkcapshdoc.sh16
1 files changed, 8 insertions, 8 deletions
diff --git a/progs/mkcapshdoc.sh b/progs/mkcapshdoc.sh
index 705d526..d2ee4bd 100755
--- a/progs/mkcapshdoc.sh
+++ b/progs/mkcapshdoc.sh
@@ -1,13 +1,12 @@
#!/bin/bash
# This script generates some C code for inclusion in the capsh binary.
-# The Makefile generally only generates the .h code and compares it
+# The Makefile generally only generates the .c code and compares it
# with the checked in code in the progs directory.
cat<<EOF
-#ifdef CAPSHDOC
-#error "don't include this twice"
-#endif
-#define CAPSHDOC
+#include <stdio.h>
+
+#include "./capshdoc.h"
/*
* A line by line explanation of each named capability value
@@ -16,7 +15,7 @@ EOF
let x=0
while [ -f "../doc/values/${x}.txt" ]; do
- name=$(fgrep ",${x}}" ../libcap/cap_names.list.h|sed -e 's/{"//' -e 's/",/ = /' -e 's/},//')
+ name=$(grep -F ",${x}}" ../libcap/cap_names.list.h|sed -e 's/{"//' -e 's/",/ = /' -e 's/},//')
echo "static const char *explanation${x}[] = { /* ${name} */"
sed -e 's/"/\\"/g' -e 's/^/ "/' -e 's/$/",/' "../doc/values/${x}.txt"
let x=1+${x}
@@ -25,7 +24,7 @@ while [ -f "../doc/values/${x}.txt" ]; do
done
cat<<EOF
-static const char **explanations[] = {
+const char **explanations[] = {
EOF
let y=0
while [ "${y}" -lt "${x}" ]; do
@@ -34,5 +33,6 @@ while [ "${y}" -lt "${x}" ]; do
done
cat<<EOF
};
-#define CAPSH_DOC_LIMIT ${x}
+
+const int capsh_doc_limit = ${x};
EOF