mirror of
https://github.com/utmapp/qemu.git
synced 2026-12-01 06:13:26 -10:00
Commit43f187abroke --help: it put colons into blank lines. It removed the colon from DEFHEADING(TITLE:) and added it back in the macro expansion of DEFHEADING(TITLE), so hxtool can emit "@subsection TITLE" more easily. Trouble is it's added back even for the blank lines made with DEFHEADING(). Put the colons back where they were before commit43f187a, and strip them in hxtool instead. Cc: Paolo Bonzini <[email protected]> CC: [email protected] Signed-off-by: Markus Armbruster <[email protected]> Message-Id: <[email protected]> Reviewed-by: Marc-André Lureau <[email protected]>
70 lines
1.4 KiB
Bash
70 lines
1.4 KiB
Bash
#!/bin/sh
|
|
|
|
hxtoh()
|
|
{
|
|
flag=1
|
|
while read -r str; do
|
|
case $str in
|
|
HXCOMM*)
|
|
;;
|
|
STEXI*|ETEXI*) flag=$(($flag^1))
|
|
;;
|
|
*)
|
|
test $flag -eq 1 && printf "%s\n" "$str"
|
|
;;
|
|
esac
|
|
done
|
|
}
|
|
|
|
print_texi_heading()
|
|
{
|
|
if test "$*" != ""; then
|
|
title="$*"
|
|
printf "@subsection %s\n" "${title%:}"
|
|
fi
|
|
}
|
|
|
|
hxtotexi()
|
|
{
|
|
flag=0
|
|
line=1
|
|
while read -r str; do
|
|
case "$str" in
|
|
HXCOMM*)
|
|
;;
|
|
STEXI*)
|
|
if test $flag -eq 1 ; then
|
|
printf "line %d: syntax error: expected ETEXI, found '%s'\n" "$line" "$str" >&2
|
|
exit 1
|
|
fi
|
|
flag=1
|
|
;;
|
|
ETEXI*)
|
|
if test $flag -ne 1 ; then
|
|
printf "line %d: syntax error: expected STEXI, found '%s'\n" "$line" "$str" >&2
|
|
exit 1
|
|
fi
|
|
flag=0
|
|
;;
|
|
DEFHEADING*)
|
|
print_texi_heading "$(expr "$str" : "DEFHEADING(\(.*\))")"
|
|
;;
|
|
ARCHHEADING*)
|
|
print_texi_heading "$(expr "$str" : "ARCHHEADING(\(.*\),.*)")"
|
|
;;
|
|
*)
|
|
test $flag -eq 1 && printf '%s\n' "$str"
|
|
;;
|
|
esac
|
|
line=$((line+1))
|
|
done
|
|
}
|
|
|
|
case "$1" in
|
|
"-h") hxtoh ;;
|
|
"-t") hxtotexi ;;
|
|
*) exit 1 ;;
|
|
esac
|
|
|
|
exit 0
|