MCPcopy Create free account
hub / github.com/F-Stack/f-stack / validateClusterManagerCommand

Function validateClusterManagerCommand

app/redis-6.2.6/src/redis-cli.c:2590–2610  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2588
2589
2590static clusterManagerCommandProc *validateClusterManagerCommand(void) {
2591 int i, commands_count = sizeof(clusterManagerCommands) /
2592 sizeof(clusterManagerCommandDef);
2593 clusterManagerCommandProc *proc = NULL;
2594 char *cmdname = config.cluster_manager_command.name;
2595 int argc = config.cluster_manager_command.argc;
2596 for (i = 0; i < commands_count; i++) {
2597 clusterManagerCommandDef cmddef = clusterManagerCommands[i];
2598 if (!strcmp(cmddef.name, cmdname)) {
2599 if ((cmddef.arity > 0 && argc != cmddef.arity) ||
2600 (cmddef.arity < 0 && argc < (cmddef.arity * -1))) {
2601 fprintf(stderr, "[ERR] Wrong number of arguments for "
2602 "specified --cluster sub command\n");
2603 return NULL;
2604 }
2605 proc = cmddef.proc;
2606 }
2607 }
2608 if (!proc) fprintf(stderr, "Unknown --cluster subcommand\n");
2609 return proc;
2610}
2611
2612static int parseClusterNodeAddress(char *addr, char **ip_ptr, int *port_ptr,
2613 int *bus_port_ptr)

Callers 1

mainFunction · 0.85

Calls 1

strcmpFunction · 0.85

Tested by

no test coverage detected