/* Redis CLI (command line interface)
*
- * Copyright (c) 2006-2009, Salvatore Sanfilippo <antirez at gmail dot com>
+ * Copyright (c) 2009-2010, Salvatore Sanfilippo <antirez at gmail dot com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
{"get",2,REDIS_CMD_INLINE},
{"set",3,REDIS_CMD_BULK},
{"setnx",3,REDIS_CMD_BULK},
+ {"append",3,REDIS_CMD_BULK},
{"del",-2,REDIS_CMD_INLINE},
{"exists",2,REDIS_CMD_INLINE},
{"incr",2,REDIS_CMD_INLINE},
{"zremrangebyscore",4,REDIS_CMD_INLINE},
{"zrange",-4,REDIS_CMD_INLINE},
{"zrangebyscore",-4,REDIS_CMD_INLINE},
+ {"zcount",4,REDIS_CMD_INLINE},
{"zrevrange",-4,REDIS_CMD_INLINE},
{"zcard",2,REDIS_CMD_INLINE},
{"zscore",3,REDIS_CMD_BULK},
{"debug",-2,REDIS_CMD_INLINE},
{"mset",-3,REDIS_CMD_MULTIBULK},
{"msetnx",-3,REDIS_CMD_MULTIBULK},
+ {"monitor",1,REDIS_CMD_INLINE},
{NULL,0,0}
};
if (reply == NULL) return 1;
if (!quiet)
printf("%s\n", reply);
+ sdsfree(reply);
return 0;
}
static int cliSendCommand(int argc, char **argv) {
struct redisCommand *rc = lookupCommand(argv[0]);
int fd, j, retval = 0;
+ int read_forever = 0;
sds cmd;
if (!rc) {
fprintf(stderr,"Wrong number of arguments for '%s'\n",rc->name);
return 1;
}
+ if (!strcasecmp(rc->name,"monitor")) read_forever = 1;
if ((fd = cliConnect()) == -1) return 1;
/* Select db number */
}
anetWrite(fd,cmd,sdslen(cmd));
sdsfree(cmd);
+
+ while (read_forever) {
+ cliReadSingleLineReply(fd,0);
+ }
+
retval = cliReadReply(fd);
if (retval) {
close(fd);