| 1177 | } |
| 1178 | |
| 1179 | static int cliSendCommand(int argc, char **argv, long repeat) { |
| 1180 | char *command = argv[0]; |
| 1181 | size_t *argvlen; |
| 1182 | int j, output_raw; |
| 1183 | |
| 1184 | if (!config.eval_ldb && /* In debugging mode, let's pass "help" to Redis. */ |
| 1185 | (!strcasecmp(command,"help") || !strcasecmp(command,"?"))) { |
| 1186 | cliOutputHelp(--argc, ++argv); |
| 1187 | return REDIS_OK; |
| 1188 | } |
| 1189 | |
| 1190 | if (context == NULL) return REDIS_ERR; |
| 1191 | |
| 1192 | output_raw = 0; |
| 1193 | if (!strcasecmp(command,"info") || |
| 1194 | !strcasecmp(command,"lolwut") || |
| 1195 | (argc >= 2 && !strcasecmp(command,"debug") && |
| 1196 | !strcasecmp(argv[1],"htstats")) || |
| 1197 | (argc >= 2 && !strcasecmp(command,"debug") && |
| 1198 | !strcasecmp(argv[1],"htstats-key")) || |
| 1199 | (argc >= 2 && !strcasecmp(command,"memory") && |
| 1200 | (!strcasecmp(argv[1],"malloc-stats") || |
| 1201 | !strcasecmp(argv[1],"doctor"))) || |
| 1202 | (argc == 2 && !strcasecmp(command,"cluster") && |
| 1203 | (!strcasecmp(argv[1],"nodes") || |
| 1204 | !strcasecmp(argv[1],"info"))) || |
| 1205 | (argc >= 2 && !strcasecmp(command,"client") && |
| 1206 | (!strcasecmp(argv[1],"list") || |
| 1207 | !strcasecmp(argv[1],"info"))) || |
| 1208 | (argc == 3 && !strcasecmp(command,"latency") && |
| 1209 | !strcasecmp(argv[1],"graph")) || |
| 1210 | (argc == 2 && !strcasecmp(command,"latency") && |
| 1211 | !strcasecmp(argv[1],"doctor")) || |
| 1212 | /* Format PROXY INFO command for Redis Cluster Proxy: |
| 1213 | * https://github.com/artix75/redis-cluster-proxy */ |
| 1214 | (argc >= 2 && !strcasecmp(command,"proxy") && |
| 1215 | !strcasecmp(argv[1],"info"))) |
| 1216 | { |
| 1217 | output_raw = 1; |
| 1218 | } |
| 1219 | |
| 1220 | if (!strcasecmp(command,"shutdown")) config.shutdown = 1; |
| 1221 | if (!strcasecmp(command,"monitor")) config.monitor_mode = 1; |
| 1222 | if (!strcasecmp(command,"subscribe") || |
| 1223 | !strcasecmp(command,"psubscribe")) config.pubsub_mode = 1; |
| 1224 | if (!strcasecmp(command,"sync") || |
| 1225 | !strcasecmp(command,"psync")) config.slave_mode = 1; |
| 1226 | |
| 1227 | /* When the user manually calls SCRIPT DEBUG, setup the activation of |
| 1228 | * debugging mode on the next eval if needed. */ |
| 1229 | if (argc == 3 && !strcasecmp(argv[0],"script") && |
| 1230 | !strcasecmp(argv[1],"debug")) |
| 1231 | { |
| 1232 | if (!strcasecmp(argv[2],"yes") || !strcasecmp(argv[2],"sync")) { |
| 1233 | config.enable_ldb_on_eval = 1; |
| 1234 | } else { |
| 1235 | config.enable_ldb_on_eval = 0; |
| 1236 | } |
no test coverage detected