Fix build under Cygwin.

This commit is contained in:
Ivan Vanyushkin 2016-09-29 21:46:45 +03:00
parent 258cab91ab
commit c278559083
9 changed files with 24 additions and 11 deletions

View file

@ -451,7 +451,7 @@ expr_t::func_t global_scope_t::look_for_command(scope_t& scope,
void global_scope_t::visit_man_page() const
{
#ifndef _WIN32
#if !defined(_WIN32) && !defined(__CYGWIN__)
int pid = fork();
if (pid < 0) {
throw std::logic_error(_("Failed to fork child process"));

View file

@ -74,7 +74,7 @@ int main(int argc, char * argv[], char * envp[])
#endif
std::signal(SIGINT, sigint_handler);
#ifndef _WIN32
#if !defined(_WIN32) && !defined(__CYGWIN__)
std::signal(SIGPIPE, sigpipe_handler);
#endif

View file

@ -62,7 +62,7 @@ commodity_quote_from_script(commodity_t& commodity,
DEBUG("commodity.download", "invoking command: " << getquote_cmd);
bool success = true;
#ifndef _WIN32
#if !defined(_WIN32) && !defined(__CYGWIN__)
if (FILE * fp = popen(getquote_cmd.c_str(), "r")) {
if (std::feof(fp) || ! std::fgets(buf, 255, fp))
success = false;

View file

@ -794,7 +794,7 @@ public:
OPTION(report_t, output_); // -o
// setenv() is not available on WIN32
#if defined(HAVE_ISATTY) and !defined(_WIN32)
#if defined(HAVE_ISATTY) and !defined(_WIN32) and !defined(__CYGWIN__)
OPTION__
(report_t, pager_,
CTOR(report_t, pager_) {

View file

@ -58,7 +58,7 @@ namespace {
*/
int do_fork(std::ostream ** os, const path& pager_path)
{
#ifndef _WIN32
#if !defined(_WIN32) && !defined(__CYGWIN__)
int pfd[2];
int status = pipe(pfd);
@ -115,7 +115,7 @@ void output_stream_t::initialize(const optional<path>& output_file,
void output_stream_t::close()
{
#ifndef _WIN32
#if !defined(_WIN32) && !defined(__CYGWIN__)
if (os != &std::cout) {
checked_delete(os);
os = &std::cout;

View file

@ -12,8 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#ifdef _WIN32
#if defined(_WIN32) || defined(__CYGWIN__)
// Implement strptime under windows
#include "strptime.h"
@ -22,6 +21,20 @@
#include <ctype.h>
#include <string.h>
// Define strnicmp for Cygwin.
#ifndef strcmpi
#define strcmpi strcasecmp
#endif
#ifndef stricmp
#define stricmp strcasecmp
#endif
#ifndef strncmpi
#define strncmpi strncasecmp
#endif
#ifndef strnicmp
#define strnicmp strncasecmp
#endif
static const char* kWeekFull[] = {
"Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday"

View file

@ -144,7 +144,7 @@ typedef std::ostream::pos_type ostream_pos_type;
#endif
#include <sys/stat.h>
#if defined(_WIN32)
#if defined(_WIN32) || defined(__CYGWIN__)
#include <io.h>
#else
#include <unistd.h>

View file

@ -33,7 +33,7 @@
#include "times.h"
#ifdef _WIN32
#if defined(_WIN32) || defined(__CYGWIN__)
#include "strptime.h"
#endif

View file

@ -6,7 +6,7 @@
#include "value.h"
#ifdef _WIN32
#if defined(_WIN32) || defined(__CYGWIN__)
#include "strptime.h"
#endif