[xen-tools] Re: hook scripts issue, and patch

Eric Lemoine eric.lemoine at gmail.com
Thu Oct 19 18:21:23 CEST 2006


On 10/19/06, Eric Lemoine <eric.lemoine at gmail.com> wrote:
> On 10/19/06, Steve Kemp <steve at steve.org.uk> wrote:
> > On Thu, Oct 19, 2006 at 06:06:27PM +0200, Eric Lemoine wrote:
> >
> > > I like the assert() function. I'm currently looking into a solution
> > > that keeps assert() around...
> >
> >   Much appreciated.  I'll not do anything tonight and see if you
> >  find a good solution.  If not I think on reflection I'd be prepared
> >  to lose them.
>
> By the way there's a bug in the assert function. You use the variable
> $line and then $lineno. I'll address that as well if I can come up
> with a good solution.

What do you think about that:

assert ()
{
    lineno="?"

    if [ -n "${LINENO}" ]; then
        # our shell defines variable LINENO, great!
        lineno=$1
        shift
    fi

    if [ ! $* ] ; then
        echo "assert failed: $0:$lineno [$*]"
        exit
    fi
}


Personnally, I like it ;-)

-- 
Eric





More information about the xen-tools-discuss mailing list