/*
+--------------------------------------------------------------------+
- | libmemcached - C/C++ Client Library for memcached |
+ | libmemcached-awesome - C/C++ Client Library for memcached |
+--------------------------------------------------------------------+
| Redistribution and use in source and binary forms, with or without |
| modification, are permitted under the terms of the BSD license. |
| the terms online at: https://opensource.org/licenses/BSD-3-Clause |
+--------------------------------------------------------------------+
| Copyright (c) 2006-2014 Brian Aker https://datadifferential.com/ |
- | Copyright (c) 2020 Michael Wallner <mike@php.net> |
+ | Copyright (c) 2020-2021 Michael Wallner https://awesome.co/ |
+--------------------------------------------------------------------+
*/
#include "common/options.hpp"
#include "common/checks.hpp"
+#include "p9y/libgen.hpp"
+#include "p9y/realpath.hpp"
#include <cerrno>
#include <climits>
#include <cstdlib>
-#include <libgen.h>
#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,
} else if (file.key == memcp_file::type::relative) {
*path = file.path;
} else {
- *path = basename((file.path));
+ *path = basename(file.path);
}
return true;
}
client_options opt{PROGRAM_NAME, PROGRAM_VERSION, PROGRAM_DESCRIPTION,
"file [file ...]"
"\n\t\t\t# NOTE: order of flags and positional"
- "\n\t\t\t# arguments matters on GNU systems)"};
+ "\n\t\t\t# arguments matters on GNU systems"};
opt.add(nullptr, '-', no_argument, "GNU argv extension")
.parse = [&files](client_options &opt_, client_options::extended_option &ext) {