[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VdJZhgqshOQS=L1rKiNZLTqNnrc4FXoJKaNpaQT0QB_Eg@mail.gmail.com>
Date: Mon, 6 Sep 2021 13:15:28 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Wolfram Sang <wsa+renesas@...g-engineering.com>,
Andy Shevchenko <andy.shevchenko@...il.com>,
"open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
Linux-Renesas <linux-renesas-soc@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linus Walleij <linus.walleij@...aro.org>
Subject: Re: [PATCH 1/1] gpio: add sloppy logic analyzer using polling
On Mon, Sep 6, 2021 at 12:04 PM Wolfram Sang
<wsa+renesas@...g-engineering.com> wrote:
...
> > > +#!/bin/sh -eu
> >
> > Next step is to add 'f' to the mix here :-)
>
> -f broke zip file generation in a way I didn't know how to resolve
> differently. Sadly, I can't recall the details right now.
Yes, it means you are not able to use * (a.k.a. glob() function) in
the shell which increases a lot security and other (misuse) concerns.
Instead you have to use `find` or similar tools to collect the list of
the files of your interest.
...
> > > +while true; do
> > > + case "$1" in
> > > + -c|--cpu) initcpu="$2"; shift 2;;
> > > + -d|--duration-us) duration="$2"; shift 2;;
> > > + -h|--help) print_help; exit 0;;
> > > + -i|--instance) lasysfsdir="$sysfsdir/$2"; shift 2;;
> > > + -k|--kernel-debug-dir) debugdir="$2"; shift 2;;
> > > + -n|--num_samples) numsamples="$2"; shift 2;;
> > > + -o|--output-dir) outputdir="$2"; shift 2;;
> > > + -s|--sample_freq) samplefreq="$2"; shift 2;;
> > > + -t|--trigger) triggerdat="$2"; shift 2;;
> > > + --) shift; break;;
> > > + *) fail "error parsing commandline: $*";;
> > > + esac
> >
> > I would prefer to have a clear shift here instead of doing shift 2
> > everywhere above (less error prone).
>
> If we ever support binary arguments (toggles), then a generic 'shift 2'
> won't work?
To me it's less error prone to have something like this:
while [ $# -gt 1 ]; do # notice the condition, btw
case "$1" in
opt_with_parameter) ...; shift;;
toggler_opt) ...;;
esac
shift
done
> > > +done
Either way it's minor.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists