qemu-e2k/scripts/hxtool
Michael Ellerman a3adb7ad3b vl.c: In qemu -h output, only print options for the arch we are running as
Only print options in the help output that are accepted by our arch.
This is less confusing for users and also for other programs that
consume the help output.

The options affected are:

 -g and -prom-env only displayed on PPC or SPARC

 -win2k-hack, -rtc-td-hack, -no-fd-bootchk, -no-acpi, -no-hpet,
 -acpitable, -smbios only displayed on i386

 -semihosting only displayed on ARM, M68K or XTENSA

 -old-param only displayed on ARM

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-19 10:27:33 -06:00

106 lines
2.3 KiB
Bash

#!/bin/sh
hxtoh()
{
flag=1
while read -r str; do
case $str in
HXCOMM*)
;;
STEXI*|ETEXI*|SQMP*|EQMP*) flag=$(($flag^1))
;;
*)
test $flag -eq 1 && printf "%s\n" "$str"
;;
esac
done
}
hxtotexi()
{
flag=0
line=1
while read -r str; do
case "$str" in
HXCOMM*)
;;
STEXI*)
if test $flag -eq 1 ; then
echo "line $line: syntax error: expected ETEXI, found $str" >&2
exit 1
fi
flag=1
;;
ETEXI*)
if test $flag -ne 1 ; then
echo "line $line: syntax error: expected STEXI, found $str" >&2
exit 1
fi
flag=0
;;
SQMP*|EQMP*)
if test $flag -eq 1 ; then
echo "line $line: syntax error: expected ETEXI, found $str" >&2
exit 1
fi
;;
DEFHEADING*)
echo "$(expr "$str" : "DEFHEADING(\(.*\))")"
;;
ARCHHEADING*)
echo "$(expr "$str" : "ARCHHEADING(\(.*\),.*)")"
;;
*)
test $flag -eq 1 && echo "$str"
;;
esac
line=$((line+1))
done
}
hxtoqmp()
{
IFS=
flag=0
line=1
while read -r str; do
case "$str" in
HXCOMM*)
;;
SQMP*)
if test $flag -eq 1 ; then
echo "line $line: syntax error: expected EQMP, found $str" >&2
exit 1
fi
flag=1
;;
EQMP*)
if test $flag -ne 1 ; then
echo "line $line: syntax error: expected SQMP, found $str" >&2
exit 1
fi
flag=0
;;
STEXI*|ETEXI*)
if test $flag -eq 1 ; then
echo "line $line: syntax error: expected EQMP, found $str" >&2
exit 1
fi
;;
*)
test $flag -eq 1 && echo "$str"
;;
esac
line=$((line+1))
done
}
case "$1" in
"-h") hxtoh ;;
"-t") hxtotexi ;;
"-q") hxtoqmp ;;
*) exit 1 ;;
esac
exit 0