+ errno= 0;
+ char *nptr;
+ unsigned long value= strtoul(argv[optind], &nptr, 10);
+
+ if ((nptr == argv[optind] and value == 0) or
+ (value == ULONG_MAX and errno == ERANGE) or
+ (value == 0 and errno == EINVAL))
+ {
+ std::cerr << "strtoul() was unable to parse given value" << std::endl;
+ return EXIT_FAILURE;
+ }
+
+ if (value < MEMCACHED_MAXIMUM_RETURN)
+ {
+ std::cout << memcached_strerror(NULL, (memcached_return_t)value) << std::endl;
+ }
+ else
+ {
+ std::cerr << memcached_strerror(NULL, MEMCACHED_MAXIMUM_RETURN) << std::endl;
+ return EXIT_FAILURE;
+ }
+
+ optind++;