/usr/bin/gfsxref is in gerris 20131206+dfsg-17.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | #!/bin/sh
usage()
{
cat <<EOF
Usage: gfsxref [OPTIONS] KEYWORD < input.gfs > output.html
Creates cross-references for occurences of KEYWORD in input.gfs
Options:
[--url=URL] reference URL for input.gfs
[--help] displays this message and exits
EOF
exit $1
}
if test $# -lt 1; then
usage 1 1>&2
fi
while test $# -gt 1; do
case "$1" in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
case $1 in
--url=*)
url=$optarg
;;
--help)
usage 0 1>&2
;;
--*)
usage 0 1>&2
;;
esac
shift
done
title=`awk --posix -v keyword=$1 '
BEGIN {
if (substr (keyword, 1, 3) == "Gfs")
keyword = substr (keyword, 4);
paren = -1;
n = 0;
last = "";
}
{
if ($1 == "#" && $2 == "Title:") {
title = $3;
for (i = 4; i <= NF; i++)
title = title " " $i;
}
else if ($1 != "#" && $0 ~ "(^|[[:blank:]])+(Gfs){0,1}" keyword "[[:blank:]]") {
if (last != "")
block[n++] = last;
last = $0;
paren = 0;
for (i = 2; i <= NF; i++) {
if ($i == "#")
break;
if (index ($i, "{"))
paren++;
if (index ($i, "}"))
paren--;
}
}
else if (paren > 0) {
last = last "\n" $0;
for (i = 1; i <= NF; i++) {
if ($i == "#")
break;
if (index ($i, "{"))
paren++;
if (index ($i, "}"))
paren--;
}
}
}
END {
print title
if (last != "")
block[n++] = last;
for (i = 0; i < n; i++)
print block[i] > "xref_" i;
}'`
if test -f xref_0; then
cat <<EOF
<li><a href="$url">$title</a></li>
EOF
for file in xref_*; do
echo "<p>"
gfs-highlight --comment --bold < $file
echo "</p>"
done
rm -f xref_*
fi
|