Wrap IPv6 in brackets in the prompt.

This commit is contained in:
Jan-Erik Rediger 2013-07-11 17:47:55 +02:00
parent 73ae8558c1
commit 1b696dc07c

View File

@ -116,7 +116,8 @@ static void cliRefreshPrompt(void) {
len = snprintf(config.prompt,sizeof(config.prompt),"redis %s",
config.hostsocket);
else
len = snprintf(config.prompt,sizeof(config.prompt),"redis %s:%d",
len = snprintf(config.prompt,sizeof(config.prompt),
strchr(config.hostip,':') ? "[%s]:%d" : "%s:%d",
config.hostip, config.hostport);
/* Add [dbnum] if needed */
if (config.dbnum != 0)