URL: https://github.com/SSSD/sssd/pull/515
Title: #515: sssctl: Showing help even when sssd not configured

pbrezina commented:
"""
You have to let popt to parse the options first, i.e.:
```c
    poptContext pc;
    int debug = SSSDBG_DEFAULT;
    int orig_argc = *argc;
    int help = 0;
    int opt;

    struct poptOption options[] = {
        {"debug", '\0', POPT_ARG_INT | POPT_ARGFLAG_STRIP, &debug,
            0, _("The debug level to run with"), NULL },
        {"help", '?', POPT_ARG_VAL | POPT_ARGFLAG_DOC_HIDDEN, &help,
            1, NULL, NULL },
        POPT_TABLEEND
    };

    pc = poptGetContext(argv[0], orig_argc, argv, options, 0);
    while ((opt = poptGetNextOpt(pc)) != -1) {
        /* do nothing */
    }

    DEBUG(SSSDBG_CRIT_FAILURE,"\n[Amit] help_value=%d\n", help);
...
```
"""

See the full comment at 
https://github.com/SSSD/sssd/pull/515#issuecomment-369870631
_______________________________________________
sssd-devel mailing list -- sssd-devel@lists.fedorahosted.org
To unsubscribe send an email to sssd-devel-le...@lists.fedorahosted.org

Reply via email to