[PATCH 0/2] small mtd-utils fixes

Artem Bityutskiy dedekind1 at gmail.com
Wed Nov 23 02:45:17 EST 2011


On Tue, 2011-11-22 at 17:21 -0500, Mike Frysinger wrote:
> On Tue, Nov 22, 2011 at 16:38, Artem Bityutskiy wrote:
> > On Sun, 2011-11-20 at 23:22 -0500, Mike Frysinger wrote:
> >> On Sun, Nov 20, 2011 at 08:08, Artem Bityutskiy wrote:
> >> > usage() {
> >> >        cat <<EOF
> >> > Usage: ${0##*/} <new_ver> <outdir>
> >> >
> >> > <new_ver>  - mtd utils version to create in X.Y.Z format
> >> > <outdir>   - the output directory where to store the tarball with the
> >> >             gpg signature
> >> > EOF
> >> >        exit 0
> >> > }
> >>
> >> i'd have outdir be optional and default to $PWD
> >
> > Yeah, but this would require me to add options handling using getopt,
> > because optional parameters have to have an option. I just do not feel
> > it is necessary right now. This can be done at any point if someone
> > needs.
> 
> i don't think so
> 
> case $# in
>   0) usage ;;
>   1|2) ;;
>   *) fatal "Insufficient or too many argumetns" ;;
> esac
> 
> new_ver="$1"; shift
> outdir="${1:-.}"; shift

I did not mean it is technincally impossible, I meant that it is just
normal Unix rule which I want to stick with, at least in simple cases:

1. Non-mandatory arguments come with options like -x <blah>
2. Mandatory arguments come come without options.

utility < -x blah and other optional stuff> <arg1> <other mandatory
args>

-- 
Best Regards,
Artem Bityutskiy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20111123/a6b8d6d7/attachment.sig>


More information about the linux-mtd mailing list