| 2027 | } |
| 2028 | |
| 2029 | static int boolConfigSet(typeData data, sds value, int update, const char **err) { |
| 2030 | int yn = yesnotoi(value); |
| 2031 | if (yn == -1) { |
| 2032 | if ((yn = truefalsetoi(value)) == -1) { |
| 2033 | *err = "argument must be 'yes' or 'no'"; |
| 2034 | return 0; |
| 2035 | } |
| 2036 | } |
| 2037 | if (data.yesno.is_valid_fn && !data.yesno.is_valid_fn(yn, err)) |
| 2038 | return 0; |
| 2039 | int prev = *(data.yesno.config); |
| 2040 | *(data.yesno.config) = yn; |
| 2041 | if (update && data.yesno.update_fn && !data.yesno.update_fn(yn, prev, err)) { |
| 2042 | *(data.yesno.config) = prev; |
| 2043 | return 0; |
| 2044 | } |
| 2045 | return 1; |
| 2046 | } |
| 2047 | |
| 2048 | static void boolConfigGet(client *c, typeData data) { |
| 2049 | addReplyBulkCString(c, *data.yesno.config ? "yes" : "no"); |
nothing calls this directly
no test coverage detected