* Return argInfo field, handling POPT_ARGFLAG_TOGGLE overrides. * @param con context * @param opt option * @return argInfo */
| 1050 | * @return argInfo |
| 1051 | */ |
| 1052 | static unsigned int poptArgInfo(poptContext con, const struct poptOption * opt) |
| 1053 | { |
| 1054 | unsigned int argInfo = opt->argInfo; |
| 1055 | |
| 1056 | if (con->os->argv != NULL && con->os->next > 0 && opt->longName != NULL) |
| 1057 | if (LF_ISSET(TOGGLE)) { |
| 1058 | const char * longName = con->os->argv[con->os->next-1]; |
| 1059 | while (*longName == '-') longName++; |
| 1060 | /* XXX almost good enough but consider --[no]nofoo corner cases. */ |
| 1061 | if (longName[0] != opt->longName[0] || longName[1] != opt->longName[1]) |
| 1062 | { |
| 1063 | if (!LF_ISSET(XOR)) { /* XXX dont toggle with XOR */ |
| 1064 | /* Toggle POPT_BIT_SET <=> POPT_BIT_CLR. */ |
| 1065 | if (LF_ISSET(LOGICALOPS)) |
| 1066 | argInfo ^= (POPT_ARGFLAG_OR|POPT_ARGFLAG_AND); |
| 1067 | argInfo ^= POPT_ARGFLAG_NOT; |
| 1068 | } |
| 1069 | } |
| 1070 | } |
| 1071 | return argInfo; |
| 1072 | } |
| 1073 | |
| 1074 | /** |
| 1075 | * Parse an integer expression. |
no outgoing calls
no test coverage detected