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. */
| 1906 | * the remaining Lua script (after "e " or "eval ") to be passed verbatim |
| 1907 | * as a single big argument. */ |
| 1908 | static sds *cliSplitArgs(char *line, int *argc) { |
| 1909 | if (config.eval_ldb && (strstr(line,"eval ") == line || |
| 1910 | strstr(line,"e ") == line)) |
| 1911 | { |
| 1912 | sds *argv = sds_malloc(sizeof(sds)*2); |
| 1913 | *argc = 2; |
| 1914 | int len = strlen(line); |
| 1915 | int elen = line[1] == ' ' ? 2 : 5; /* "e " or "eval "? */ |
| 1916 | argv[0] = sdsnewlen(line,elen-1); |
| 1917 | argv[1] = sdsnewlen(line+elen,len-elen); |
| 1918 | return argv; |
| 1919 | } else { |
| 1920 | return sdssplitargs(line,argc); |
| 1921 | } |
| 1922 | } |
| 1923 | |
| 1924 | /* Set the CLI preferences. This function is invoked when an interactive |
| 1925 | * ":command" is called, or when reading ~/.redisclirc file, in order to |
no test coverage detected