You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
1.4 KiB
79 lines
1.4 KiB
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
|
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#if defined(HAVE_CONFIG_H)
|
|
#include "config/bitcoin-config.h"
|
|
#endif
|
|
|
|
#include "util.h"
|
|
#include "random.h"
|
|
#include "serialize.h"
|
|
#include "utilstrencodings.h"
|
|
|
|
#include <stdarg.h>
|
|
|
|
#ifndef WIN32
|
|
// for posix_fallocate
|
|
#ifdef __linux__
|
|
|
|
#ifdef _POSIX_C_SOURCE
|
|
#undef _POSIX_C_SOURCE
|
|
#endif
|
|
|
|
#define _POSIX_C_SOURCE 200112L
|
|
|
|
#endif // __linux__
|
|
|
|
#include <algorithm>
|
|
#include <fcntl.h>
|
|
#include <sys/resource.h>
|
|
#include <sys/stat.h>
|
|
|
|
#else
|
|
|
|
#ifdef _MSC_VER
|
|
#pragma warning(disable:4786)
|
|
#pragma warning(disable:4804)
|
|
#pragma warning(disable:4805)
|
|
#pragma warning(disable:4717)
|
|
#endif
|
|
|
|
#ifdef _WIN32_WINNT
|
|
#undef _WIN32_WINNT
|
|
#endif
|
|
#define _WIN32_WINNT 0x0501
|
|
|
|
#ifdef _WIN32_IE
|
|
#undef _WIN32_IE
|
|
#endif
|
|
#define _WIN32_IE 0x0501
|
|
|
|
#define WIN32_LEAN_AND_MEAN 1
|
|
#ifndef NOMINMAX
|
|
#define NOMINMAX
|
|
#endif
|
|
|
|
#include <io.h> /* for _commit */
|
|
#include <shlobj.h>
|
|
#endif
|
|
|
|
|
|
using namespace std;
|
|
|
|
bool fDebug = false;
|
|
bool fLogTimestamps = true;
|
|
bool fLogTimeMicros = false;
|
|
|
|
|
|
|
|
int LogPrintStr(const std::string &str)
|
|
{
|
|
int ret = 0; // Returns total number of characters written
|
|
// print to console
|
|
ret = fwrite(str.data(), 1, str.size(), stdout);
|
|
fflush(stdout);
|
|
return ret;
|
|
}
|
|
|
|
|