Split the user provided command into multiple SDS arguments. * This function normally uses sdssplitargs() from sds.c which is able * to understand "quoted strings", escapes and so forth. However when * we are in Lua debugging mode and the "eval" command is used, we want * the remaining Lua script (after "e " or "eval ") to be passed verbatim * as a single big argument. */
| 2094 | * the remaining Lua script (after "e " or "eval ") to be passed verbatim |
| 2095 | * as a single big argument. */ |
| 2096 | static sds *cliSplitArgs(char *line, int *argc) { |
| 2097 | if (config.eval_ldb && (strstr(line,"eval ") == line || |
| 2098 | strstr(line,"e ") == line)) |
| 2099 | { |
| 2100 | sds *argv = sds_malloc(sizeof(sds)*2); |
| 2101 | *argc = 2; |
| 2102 | int len = strlen(line); |
| 2103 | int elen = line[1] == ' ' ? 2 : 5; /* "e " or "eval "? */ |
| 2104 | argv[0] = sdsnewlen(line,elen-1); |
| 2105 | argv[1] = sdsnewlen(line+elen,len-elen); |
| 2106 | return argv; |
| 2107 | } else { |
| 2108 | return sdssplitargs(line,argc); |
| 2109 | } |
| 2110 | } |
| 2111 | |
| 2112 | /* Set the CLI preferences. This function is invoked when an interactive |
| 2113 | * ":command" is called, or when reading ~/.redisclirc file, in order to |
no test coverage detected