2019-05-09 19:23:50 +08:00
|
|
|
#!/bin/sh
|
2021-10-01 18:44:33 +08:00
|
|
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
2019-05-09 19:23:50 +08:00
|
|
|
set -e
|
|
|
|
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
echo "Use: $0 page-name (with no section suffix)"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-01-27 16:10:25 +08:00
|
|
|
# make sure the rules have been regenerated (in case update-man-rules was just run)
|
2020-03-24 03:39:23 +08:00
|
|
|
ninja -C "@BUILD_ROOT@" version.h
|
|
|
|
|
2019-05-09 19:23:50 +08:00
|
|
|
target="man/$1.html"
|
|
|
|
ninja -C "@BUILD_ROOT@" "$target"
|
2020-08-08 00:42:22 +08:00
|
|
|
|
|
|
|
fullname="@BUILD_ROOT@/$target"
|
2023-03-29 08:17:50 +08:00
|
|
|
if [ -f "$fullname" ]; then
|
|
|
|
redirect="$(readlink "$fullname" || :)"
|
|
|
|
else
|
|
|
|
redirect=""
|
|
|
|
fi
|
2020-08-08 00:42:22 +08:00
|
|
|
if [ -n "$redirect" ]; then
|
|
|
|
ninja -C "@BUILD_ROOT@" "man/$redirect"
|
|
|
|
|
|
|
|
fullname="@BUILD_ROOT@/man/$redirect"
|
|
|
|
fi
|
|
|
|
|
2019-05-09 19:23:50 +08:00
|
|
|
set -x
|
2020-08-08 00:42:22 +08:00
|
|
|
exec xdg-open "$fullname"
|