MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / cliLoadPreferences

Function cliLoadPreferences

src/redis-cli.c:1944–1962  ·  view source on GitHub ↗

Load the ~/.redisclirc file if any. */

Source from the content-addressed store, hash-verified

1942
1943/* Load the ~/.redisclirc file if any. */
1944void 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
1964static void repl(void) {
1965 sds historyfile = NULL;

Callers 1

replFunction · 0.85

Calls 5

getDotfilePathFunction · 0.85
sdssplitargsFunction · 0.85
cliSetPreferencesFunction · 0.85
sdsfreesplitresFunction · 0.85
sdsfreeFunction · 0.85

Tested by

no test coverage detected