From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Wolfram Sang <wsa+renesas@sang-engineering.com>,
Andy Shevchenko <andy.shevchenko@gmail.com>,
"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linus Walleij <linus.walleij@linaro.org>
Subject: Re: [PATCH 1/1] gpio: add sloppy logic analyzer using polling
Date: Mon, 6 Sep 2021 13:15:28 +0300 [thread overview]
Message-ID: <CAHp75VdJZhgqshOQS=L1rKiNZLTqNnrc4FXoJKaNpaQT0QB_Eg@mail.gmail.com> (raw)
In-Reply-To: <YTXZgNQJj0aI4zuC@kunai>
On Mon, Sep 6, 2021 at 12:04 PM Wolfram Sang
<wsa+renesas@sang-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
next prev parent reply other threads:[~2021-09-06 10:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-01 19:45 [PATCH 0/1] gpio: add simple logic analyzer using polling Wolfram Sang
2021-09-01 19:45 ` [PATCH 1/1] gpio: add sloppy " Wolfram Sang
2021-09-05 11:20 ` Andy Shevchenko
2021-09-06 9:04 ` Wolfram Sang
2021-09-06 10:15 ` Andy Shevchenko [this message]
2021-09-06 12:21 ` Wolfram Sang
[not found] ` <CAHp75VdNnvUfMEL3gMrJOFix3AATL8LAiU18LXJJVL77feBRow@mail.gmail.com>
2021-09-06 7:38 ` Wolfram Sang
2021-09-06 7:47 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAHp75VdJZhgqshOQS=L1rKiNZLTqNnrc4FXoJKaNpaQT0QB_Eg@mail.gmail.com' \
--to=andy.shevchenko@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=wsa+renesas@sang-engineering.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.