Load the ~/.redisclirc file if any. */
| 1942 | |
| 1943 | /* Load the ~/.redisclirc file if any. */ |
| 1944 | void cliLoadPreferences(void) { |
| 1945 | sds rcfile = getDotfilePath(REDIS_CLI_RCFILE_ENV,REDIS_CLI_RCFILE_DEFAULT); |
| 1946 | if (rcfile == NULL) return; |
| 1947 | FILE *fp = fopen(rcfile,"r"); |
| 1948 | char buf[1024]; |
| 1949 | |
| 1950 | if (fp) { |
| 1951 | while(fgets(buf,sizeof(buf),fp) != NULL) { |
| 1952 | sds *argv; |
| 1953 | int argc; |
| 1954 | |
| 1955 | argv = sdssplitargs(buf,&argc); |
| 1956 | if (argc > 0) cliSetPreferences(argv,argc,0); |
| 1957 | sdsfreesplitres(argv,argc); |
| 1958 | } |
| 1959 | fclose(fp); |
| 1960 | } |
| 1961 | sdsfree(rcfile); |
| 1962 | } |
| 1963 | |
| 1964 | static void repl(void) { |
| 1965 | sds historyfile = NULL; |
no test coverage detected