Adding simple memcat application.
[awesomized/libmemcached] / src / memcat.c
1 #include <stdio.h>
2 #include <memcached.h>
3
4 int main(int argc, char *argv[])
5 {
6 memcached_st *memc;
7 char *string;
8 unsigned int x;
9 size_t string_length;
10 uint16_t flags;
11 memcached_return rc;
12
13 if (argc == 1)
14 return 0;
15
16 memc= memcached_init(NULL);
17
18 for (x= 1; x <= argc; x++)
19 {
20 string= memcached_get(memc, argv[1], strlen(argv[1]),
21 &string_length, &flags, &rc);
22 if (string)
23 {
24 printf("%.*s\n", string_length, string);
25 free(string);
26 }
27 }
28
29 memcached_deinit(memc);
30
31 return 0;
32 };