# Re: \[PATCH 1/1\] gpio: add sloppy logic analyzer using polling

- From: Andy Shevchenko \<hidden\>
- Date: 2021-09-06 10:16:10 
- List: linux-gpio
- Page: https://ratatoskr.run/linux-gpio/2021/09/1498206
- Thread: https://ratatoskr.run/linux-gpio/2021/09/1495096/t.md

```text
On Mon, Sep 6, 2021 at 12:04 PM Wolfram Sang
[ref] 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
```
