... and use the config.h

This commit is contained in:
Kelvin Sherlock 2016-08-09 15:29:28 -04:00
parent 0422976719
commit 811c8b976a
1 changed files with 11 additions and 3 deletions

View File

@ -25,6 +25,7 @@
#include <fcntl.h>
#include "version.h"
#include "config.h"
namespace ToolBox {
std::string MacToUnix(const std::string path);
@ -114,16 +115,23 @@ namespace {
#define fputc DO_NOT_USE_FPUTC
inline int fdputs(const char *data, int fd) {
auto rv = write(fd, data, strlen(data)); return rv < 0 ? EOF : rv;
auto rv = write(fd, data, strlen(data));
return rv < 0 ? EOF : rv;
}
inline int fdputs(const std::string &s, int fd) {
auto rv = write(fd, s.data(), s.size());
return rv < 0 ? EOF : rv;
}
inline int fdputc(int c, int fd) {
unsigned char tmp = c;
auto rv = write(fd, &tmp, 1); return rv < 0 ? EOF : c;
auto rv = write(fd, &tmp, 1);
return rv < 0 ? EOF : c;
}
#ifdef HAVE_DPRINTF
#define fdprintf(...) dprintf(__VA_ARGS__)
#define fdprintf dprintf
#else
inline int fdprintf(int fd, const char *format, ...) {
char *cp = nullptr;