+ } else if (!strcasecmp(argv[0],"rename-command") && argc == 3) {
+ struct redisCommand *cmd = lookupCommand(argv[1]);
+ int retval;
+
+ if (!cmd) {
+ err = "No such command in rename-command";
+ goto loaderr;
+ }
+
+ /* If the target command name is the emtpy string we just
+ * remove it from the command table. */
+ retval = dictDelete(server.commands, argv[1]);
+ redisAssert(retval == DICT_OK);
+
+ /* Otherwise we re-add the command under a different name. */
+ if (sdslen(argv[2]) != 0) {
+ sds copy = sdsdup(argv[2]);
+
+ retval = dictAdd(server.commands, copy, cmd);
+ if (retval != DICT_OK) {
+ sdsfree(copy);
+ err = "Target command name already exists"; goto loaderr;
+ }
+ }