nmh-workers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nmh-workers] Multi-homed postproc, v2


From: Bob Carragher
Subject: Re: [Nmh-workers] Multi-homed postproc, v2
Date: Mon, 09 Mar 2015 21:22:40 -0700

On Thu, 05 Mar 2015 10:35:54 +0000 Ralph Corderoy <address@hidden> sez:

> > find_draftmessage() {
> >         skip_next=0
> > 
> >         for arg; do
> >                 case "$arg" in
> >                 -al* | -filt* | -wi* | -client | -idanno | -server | \
> >                 -partno | -saslmaxssf | -saslmech | -user | -por* | \
> >                 -file* | -mhl* | -mt* | -cr* | -lib* | -oauth)
> >                         skip_next=1
> >                         ;;
> >                 -*)     skip_next=0;
> >                         ;;
> >                 *)
> >                         if [ "$skip_next" -eq 0 ]; then
> >                                 draftmessage="$arg"
> >                                 return 0
> >                         fi
> >                         skip_next=0
> >                         ;;
> >                 esac
> >         done
> > 
> >     echo "Cannot find draft message name in argument list"
> >         exit 1
> > }
> 
> I think that can be simpler, given a function has a "$@" that's
> distinct from the scripts, e.g.
> 
>     find_draftmessage() {
>         while test $# -ne 0; do
>             case "$1" in
>             -al* | -filt* | -wi* | -client | -idanno | -server | \
>             -partno | -saslmaxssf | -saslmech | -user | -por* | \
>             -file* | -mhl* | -mt* | -cr* | -lib* | -oauth)
>                 shift
>                 ;;
>             -*) ;;
>             *)
>                 draftmessage="$1"
>                 return 0
>                 ;;
>             esac
>             shift
>         done
> 
>         echo "usage: localpostproc [...] file [...]" >&2
>         exit 1
>     }

This works for me.  Thanks, Ralph!

Bob



reply via email to

[Prev in Thread] Current Thread [Next in Thread]