* Markus Armbruster ([email protected]) wrote:
> [email protected] writes:
> 
> > From: "Dr. David Alan Gilbert" <[email protected]>
> >
> > 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.
> 
> Pity.

Yeh, I added the code to do it and then realised it was broken
in too many places.

> > Signed-off-by: Dr. David Alan Gilbert <[email protected]>
> > ---
> >  scripts/hxtool | 20 +++++++++++++++++++-
> >  1 file changed, 19 insertions(+), 1 deletion(-)
> >
> > diff --git a/scripts/hxtool b/scripts/hxtool
> > index ea2accef98..f310071daa 100755
> > --- a/scripts/hxtool
> > +++ b/scripts/hxtool
> > @@ -1,8 +1,14 @@
> >  #!/bin/sh
> >  
> > +printifnotrst()
> 
> print_if_not_rst()?  print_h()?

OK, I'll add the _'s and renames as suggested in the others as well

> > +{
> > +    test $outsiderst -eq 1 && printf "%s\n" "$str"
> > +}
> >  hxtoh()
> >  {
> >      outsiderst=1
> > +    # .name for HMP
> > +    seenname=0
> 
> I'd prefer seen_name.
> 
> >      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
> > +              seenname=0
> >                outsiderst=0
> >              ;;
> >              ERST*)
> > @@ -23,8 +31,18 @@ hxtoh()
> >                fi
> >                outsiderst=1
> >              ;;
> > +            # Note the space at the start - we need to exclude 
> > something.name
> > +             .name*)
> 
> This works?!?  It does in my testing.  I'm amazed.

To my amazement as well, but I couldn't find a clearer way of writing that also
worked.

> > +              if [ $seenname -eq 1 ]
> > +              then
> > +                echo "Error: Seen another .name, maybe missing docs?" >&2
> > +                exit 1
> > +              fi
> > +              seenname=1
> > +              printifnotrst
> > +            ;;
> >              *)
> > -            test $outsiderst -eq 1 && printf "%s\n" "$str"
> > +            printifnotrst
> >              ;;
> >          esac
> >      done
> 
> Could move the printing behind the case, and continue the loop in the
> case SRST* and ERST*.  No need for the function then.  Matter of taste,
> up to you.

Yeh I prefer the function than clever continues and stuff.

Dave

-- 
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/

Reply via email to