projects
/
awesomized
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
p9y
[awesomized/libmemcached]
/
src
/
bin
/
memcp.cc
diff --git
a/src/bin/memcp.cc
b/src/bin/memcp.cc
index 114a2f8562328250e8822c12ab398a5a39d95cba..7396057e930f8269a5812db9ce72aec7a4e8f439 100644
(file)
--- a/
src/bin/memcp.cc
+++ b/
src/bin/memcp.cc
@@
-21,14
+21,23
@@
#include "common/options.hpp"
#include "common/checks.hpp"
#include "common/options.hpp"
#include "common/checks.hpp"
+#include "p9y/libgen.hpp"
+#include "p9y/realpath.hpp"
#include <cerrno>
#include <climits>
#include <cstdlib>
#include <cerrno>
#include <climits>
#include <cstdlib>
-#include <libgen.h>
#include <fstream>
#include <sstream>
#include <fstream>
#include <sstream>
+#ifndef PATH_MAX
+# ifdef MAX_PATH
+# define PATH_MAX MAX_PATH
+# else
+# define PATH_MAX 256
+# endif
+#endif
+
struct memcp_file {
enum class type {
basename,
struct memcp_file {
enum class type {
basename,
@@
-46,7
+55,7
@@
struct memcp_file {
};
static inline std::string stream2string(const std::istream &istream) {
};
static inline std::string stream2string(const std::istream &istream) {
- return dynamic_cast<std::ostringstream &>(std::ostringstream{} << istream.rdbuf()).str();
+ return dynamic_cast<std::ostringstream &
&
>(std::ostringstream{} << istream.rdbuf()).str();
}
static memcached_return_t memcp(const client_options &opt, memcached_st &memc, const char *key,
}
static memcached_return_t memcp(const client_options &opt, memcached_st &memc, const char *key,
@@
-130,7
+139,7
@@
static bool path2key(const client_options &opt, memcp_file &file, char **path) {
} else if (file.key == memcp_file::type::relative) {
*path = file.path;
} else {
} else if (file.key == memcp_file::type::relative) {
*path = file.path;
} else {
- *path = basename(
(file.path)
);
+ *path = basename(
file.path
);
}
return true;
}
}
return true;
}