| 861 | } |
| 862 | |
| 863 | int poptSaveBits(poptBits * bitsp, |
| 864 | UNUSED(unsigned int argInfo), const char * s) |
| 865 | { |
| 866 | char *tbuf = NULL; |
| 867 | char *t, *te; |
| 868 | int rc = 0; |
| 869 | |
| 870 | if (bitsp == NULL || s == NULL || *s == '\0' || _poptBitsNew(bitsp)) |
| 871 | return POPT_ERROR_NULLARG; |
| 872 | |
| 873 | /* Parse comma separated attributes. */ |
| 874 | te = tbuf = xstrdup(s); |
| 875 | while ((t = te) != NULL && *t) { |
| 876 | while (*te != '\0' && *te != ',') |
| 877 | te++; |
| 878 | if (*te != '\0') |
| 879 | *te++ = '\0'; |
| 880 | /* XXX Ignore empty strings. */ |
| 881 | if (*t == '\0') |
| 882 | continue; |
| 883 | /* XXX Permit negated attributes. caveat emptor: false negatives. */ |
| 884 | if (*t == '!') { |
| 885 | t++; |
| 886 | if ((rc = poptBitsChk(*bitsp, t)) > 0) |
| 887 | rc = poptBitsDel(*bitsp, t); |
| 888 | } else |
| 889 | rc = poptBitsAdd(*bitsp, t); |
| 890 | if (rc) |
| 891 | break; |
| 892 | } |
| 893 | tbuf = _free(tbuf); |
| 894 | return rc; |
| 895 | } |
| 896 | |
| 897 | int poptSaveString(const char *** argvp, |
| 898 | UNUSED(unsigned int argInfo), const char * val) |
no test coverage detected