Re: [hackers] [xssstate] Refactor xssstate.c

From: FRIGN <dev_AT_frign.de>
Date: Sun, 11 Sep 2016 22:59:33 +0200

On Sun, 11 Sep 2016 16:46:29 -0400
Russ <rroissie_AT_gmail.com> wrote:

Hey Russ,

> I agree it does some, but using strcmp allows matching the flags
> exactly, and prevents things like "xssstate -v" being equivilant to
> "xssstate -vxyz". And since you would only ever use one flag at a
> time, arg.h seemed like it was excessive, but perhaps I was thinking
> about simplify the wrong way. I also like being able to use only one
> switch statement, but that's mostly a personal preference. Thanks
> for the input!

if you really have _exclusive_ flags "v x y z", you do the
exclusivity-check afterwards, something along

        if (vflag + xflag + yflag + zflag > 1)
                usage();

but usually, you only have two exclusive flags, so you do

        if (aflag && bflag)
                usage();

after the switch. The arg.h-switch really is not made for doing
exclusivity checks at this point. For "early-terminators" like -v it is
fine though for multiple roads leading to Rome.

Cheers

FRIGN

-- 
FRIGN <dev_AT_frign.de>
Received on Sun Sep 11 2016 - 22:59:33 CEST

This archive was generated by hypermail 2.3.0 : Sun Sep 11 2016 - 23:00:16 CEST