From: "Dr. David Alan Gilbert" <dave@treblig.org>
Error if a '.name' is seen after another '.name' without an intervening
SRST, this normally indicates missing or misplaced docs.
We can't check DEF (as used in command line options) because those
often have multiple DEF per doc.
Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
---
scripts/hxtool | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/scripts/hxtool b/scripts/hxtool
index 51dc841479..ee98fb9c09 100755
--- a/scripts/hxtool
+++ b/scripts/hxtool
@@ -1,8 +1,14 @@
#!/bin/sh
+print_if_not_rst()
+{
+ test $in_rst -eq 0 && printf "%s\n" "$str"
+}
hxtoh()
{
in_rst=0
+ # .name for HMP
+ seen_name=0
while read -r str; do
case $str in
HXCOMM*)
@@ -13,6 +19,8 @@ hxtoh()
echo "Error: SRST inside another RST" >&2
exit 1
fi
+ # consume the name
+ seen_name=0
in_rst=1
;;
ERST*)
@@ -23,6 +31,16 @@ hxtoh()
fi
in_rst=0
;;
+ # Note the space at the start - we need to exclude something.name
+ ( .name*)
+ if [ $seen_name -eq 1 ]
+ then
+ echo "Error: Seen another .name, maybe missing docs?" >&2
+ exit 1
+ fi
+ seen_name=1
+ print_if_not_rst
+ ;;
*)
test $in_rst -eq 0 && printf "%s\n" "$str"
;;
--
2.52.0
dave@treblig.org writes:
> From: "Dr. David Alan Gilbert" <dave@treblig.org>
>
> Error if a '.name' is seen after another '.name' without an intervening
> SRST, this normally indicates missing or misplaced docs.
>
> We can't check DEF (as used in command line options) because those
> often have multiple DEF per doc.
>
> Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
> ---
> scripts/hxtool | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/scripts/hxtool b/scripts/hxtool
> index 51dc841479..ee98fb9c09 100755
> --- a/scripts/hxtool
> +++ b/scripts/hxtool
> @@ -1,8 +1,14 @@
> #!/bin/sh
>
> +print_if_not_rst()
> +{
> + test $in_rst -eq 0 && printf "%s\n" "$str"
> +}
> hxtoh()
> {
> in_rst=0
> + # .name for HMP
> + seen_name=0
> while read -r str; do
> case $str in
> HXCOMM*)
> @@ -13,6 +19,8 @@ hxtoh()
> echo "Error: SRST inside another RST" >&2
> exit 1
> fi
> + # consume the name
> + seen_name=0
> in_rst=1
> ;;
> ERST*)
> @@ -23,6 +31,16 @@ hxtoh()
> fi
> in_rst=0
> ;;
> + # Note the space at the start - we need to exclude something.name
> + ( .name*)
TIL about the optional left parenthesis here.
> + if [ $seen_name -eq 1 ]
> + then
> + echo "Error: Seen another .name, maybe missing docs?" >&2
> + exit 1
> + fi
> + seen_name=1
> + print_if_not_rst
> + ;;
> *)
> test $in_rst -eq 0 && printf "%s\n" "$str"
> ;;
Reviewed-by: Markus Armbruster <armbru@redhat.com>
On 16/01/2026 01.50, dave@treblig.org wrote:
> From: "Dr. David Alan Gilbert" <dave@treblig.org>
>
> Error if a '.name' is seen after another '.name' without an intervening
> SRST, this normally indicates missing or misplaced docs.
>
> We can't check DEF (as used in command line options) because those
> often have multiple DEF per doc.
>
> Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
> ---
> scripts/hxtool | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/scripts/hxtool b/scripts/hxtool
> index 51dc841479..ee98fb9c09 100755
> --- a/scripts/hxtool
> +++ b/scripts/hxtool
> @@ -1,8 +1,14 @@
> #!/bin/sh
>
> +print_if_not_rst()
> +{
> + test $in_rst -eq 0 && printf "%s\n" "$str"
> +}
Add an empty line after this function?
> hxtoh()
> {
> in_rst=0
> + # .name for HMP
> + seen_name=0
> while read -r str; do
> case $str in
> HXCOMM*)
> @@ -13,6 +19,8 @@ hxtoh()
> echo "Error: SRST inside another RST" >&2
> exit 1
> fi
> + # consume the name
> + seen_name=0
> in_rst=1
> ;;
> ERST*)
> @@ -23,6 +31,16 @@ hxtoh()
> fi
> in_rst=0
> ;;
> + # Note the space at the start - we need to exclude something.name
> + ( .name*)
> + if [ $seen_name -eq 1 ]
> + then
> + echo "Error: Seen another .name, maybe missing docs?" >&2
> + exit 1
> + fi
> + seen_name=1
> + print_if_not_rst
> + ;;
> *)
> test $in_rst -eq 0 && printf "%s\n" "$str"
I think this line could be replaced with print_if_not_rst now?
Thomas
© 2016 - 2026 Red Hat, Inc.