| 194 | } |
| 195 | |
| 196 | static void process_trace(char* what) |
| 197 | { |
| 198 | bool on = false; |
| 199 | char *rest = strchr(what, ' '); |
| 200 | if (rest) { |
| 201 | *rest++ = '\0'; |
| 202 | trim(rest); |
| 203 | } else { |
| 204 | WARNING("The trace command requires two arguments (log and [on|off])"); |
| 205 | return; |
| 206 | } |
| 207 | |
| 208 | if (!strcmp(rest, "on")) { |
| 209 | on = true; |
| 210 | } else if (!strcmp(rest, "off")) { |
| 211 | on = false; |
| 212 | } else if (!strcmp(rest, "true")) { |
| 213 | on = true; |
| 214 | } else if (!strcmp(rest, "false")) { |
| 215 | on = false; |
| 216 | } else { |
| 217 | WARNING("The trace command's second argument must be on or off."); |
| 218 | return; |
| 219 | } |
| 220 | |
| 221 | if (!strcmp(what, "error")) { |
| 222 | if (on == !!print_all_responses) { |
| 223 | return; |
| 224 | } |
| 225 | if (on) { |
| 226 | print_all_responses = 1; |
| 227 | } else { |
| 228 | print_all_responses = 0; |
| 229 | log_off(&error_lfi); |
| 230 | } |
| 231 | } else if (!strcmp(what, "logs")) { |
| 232 | if (on == !!log_lfi.fptr) { |
| 233 | return; |
| 234 | } |
| 235 | if (on) { |
| 236 | useLogf = 1; |
| 237 | rotate_logfile(); |
| 238 | } else { |
| 239 | useLogf = 0; |
| 240 | log_off(&log_lfi); |
| 241 | } |
| 242 | } else if (!strcmp(what, "messages")) { |
| 243 | if (on == !!message_lfi.fptr) { |
| 244 | return; |
| 245 | } |
| 246 | if (on) { |
| 247 | useMessagef = 1; |
| 248 | rotate_logfile(); |
| 249 | } else { |
| 250 | useMessagef = 0; |
| 251 | log_off(&message_lfi); |
| 252 | } |
| 253 | } else if (!strcmp(what, "shortmessages")) { |
no test coverage detected