free(string);\r
}\r
}\r
+ else\r
+ {\r
+ fprintf(stderr, "memcat: %s: memcache error %s\n", \r
+ argv[argc], memcached_strerror(memc, rc));\r
+ }\r
optind++;\r
}\r
\r
#include <sys/types.h>\r
#include <sys/mman.h>\r
#include <fcntl.h>\r
+#include <errno.h>\r
\r
#include <memcached.h>\r
#include "client_options.h"\r
char *ptr;\r
\r
fd= open(argv[optind], O_RDONLY);\r
-\r
- if (fd == -1)\r
- {\r
- fprintf(stderr, "Failed opening %s\n", argv[optind]);\r
+ if (fd < 0) {\r
+ fprintf(stderr, "memcp: %s: %s\n", argv[optind], strerror(errno));\r
+ optind++;\r
continue;\r
}\r
\r
(void)fstat(fd, &sbuf);\r
mptr= mmap(NULL, sbuf.st_size, PROT_READ, MAP_PRIVATE, fd, 0);\r
+ if (mptr == MAP_FAILED) {\r
+ fprintf(stderr, "memcp: %s: %s\n", argv[optind], strerror(errno));\r
+ close(fd);\r
+ optind++;\r
+ continue;\r
+ }\r
\r
ptr= rindex(argv[optind], '/');\r
if (ptr)\r
else\r
abort();\r
\r
+ if (rc != MEMCACHED_SUCCESS) {\r
+ fprintf(stderr, "memcp: %s: memcache error %s\n", \r
+ ptr, memcached_strerror(memc, rc));\r
+ }\r
+\r
munmap(mptr, sbuf.st_size);\r
close(fd);\r
optind++;\r
printf("key: %s\nexpires: %ld\n", argv[optind], expires);\r
}\r
rc = memcached_delete(memc, argv[optind], strlen(argv[optind]), expires);\r
+\r
+ if (rc != MEMCACHED_SUCCESS) {\r
+ fprintf(stderr, "memrm: %s: memcache error %s\n", \r
+ argv[optind], memcached_strerror(memc, rc));\r
+ }\r
+\r
optind++;\r
}\r
\r