Bart Blanquart wrote:
> 
> an updated webrev is now available at
> http://cr.opensolaris.org/~bartbl/6251549
> 
> and its testing output is available at
> http://cr.opensolaris.org/~bartbl/6251549-testing

I don't see anything that won't work correctly, but here are a few 
suggestions to make it easier to follow the program logic.

1. If you initialize authname to NULL, you don't need a second variable 
(haveauth) to track whether -a has been used. You can still check for 
mulitple uses of -a during getopt() processing:

        if (authname == NULL)
                authname = optarg;
        else
                usage();
        break;

2. You can reuse the existing (somewhat complex) code that deals with 
argc == 1, 2, or >2 by using the standard idiom

        argc -= optind;
        argv += optind;

after you call getopt(). Then in the argc switch statement you have code 
like

        if (authname)
                chkauthattr(...)
        else
                existing code to show auths

3. The code from approx. line 103-126 should be pulled out into a 
function that can also be called from show_auths() and get_default_auths().

4. This is not related to your changes, but I don't see why the calls to 
get_default_auths() and free_auths() shouldn't be inside show_auths().

        Scott


-- 
Scott Rotondo
Principal Engineer, Solaris Security Technologies
President, Trusted Computing Group
Phone/FAX: +1 408 850 3655 (Internal x68278)

Reply via email to