Re: [PATCH v3 2/3] t0021: implementation the rot13-filter.pl script in C

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

 



On Mon, Aug 1, 2022 at 8:37 AM Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> wrote:
>
> On Sun, Jul 31 2022, Matheus Tavares wrote:
> >
> > +
> > +     caps = argv + i;
> > +     cap_count = argc - i;
>
> Since you need to change every single caller consider just starting out
> with parse_options() here instead of rolling your own parsing. You could
> use it for --always-delay in any case, but you could also just add a
> --log-path and --capability (an OPT_STRING_LIST), so:
>
>         test-tool rot13-filter [--always-delay] --log-path=<path> [--capability <capbility]...

Ah, makes sense. Thanks

> > +
> > +     for (i = 0; i < cap_count; i++) {
> > +             if (!strcmp(caps[i], "clean"))
> > +                     has_clean_cap = 1;
> > +             else if (!strcmp(caps[i], "smudge"))
> > +                     has_smudge_cap = 1;
>
> In any case, maybe BUG() in an "else" here with "unknown capability"?

Yup, will do.

> > +     fclose(logfile);
>
> Perhaps check the return value & die_errno() if we fail to fclose()
> (happens e.g. if the disk fills up).

Sure. Thanks.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux