summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/global.cc2
-rw-r--r--src/main.cc2
-rw-r--r--src/quotes.cc2
-rw-r--r--src/report.h2
-rw-r--r--src/stream.cc4
-rw-r--r--src/strptime.cc17
-rw-r--r--src/system.hh.in2
-rw-r--r--src/times.cc2
-rw-r--r--test/unit/t_value.cc2
9 files changed, 24 insertions, 11 deletions
diff --git a/src/global.cc b/src/global.cc
index a3f84409..882840de 100644
--- a/src/global.cc
+++ b/src/global.cc
@@ -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"));
diff --git a/src/main.cc b/src/main.cc
index df1933f9..07192651 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -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
diff --git a/src/quotes.cc b/src/quotes.cc
index 0dd9c4ed..cef9b713 100644
--- a/src/quotes.cc
+++ b/src/quotes.cc
@@ -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;
diff --git a/src/report.h b/src/report.h
index cdff13ae..e943de1d 100644
--- a/src/report.h
+++ b/src/report.h
@@ -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_) {
diff --git a/src/stream.cc b/src/stream.cc
index 0c3ed995..e07fd61d 100644
--- a/src/stream.cc
+++ b/src/stream.cc
@@ -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;
diff --git a/src/strptime.cc b/src/strptime.cc
index b9d485d2..c0aed41c 100644
--- a/src/strptime.cc
+++ b/src/strptime.cc
@@ -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"
diff --git a/src/system.hh.in b/src/system.hh.in
index 105436f6..331f7a0e 100644
--- a/src/system.hh.in
+++ b/src/system.hh.in
@@ -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>
diff --git a/src/times.cc b/src/times.cc
index 01b89848..8b0490ff 100644
--- a/src/times.cc
+++ b/src/times.cc
@@ -33,7 +33,7 @@
#include "times.h"
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__CYGWIN__)
#include "strptime.h"
#endif
diff --git a/test/unit/t_value.cc b/test/unit/t_value.cc
index 398e075b..a31c84c8 100644
--- a/test/unit/t_value.cc
+++ b/test/unit/t_value.cc
@@ -6,7 +6,7 @@
#include "value.h"
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__CYGWIN__)
#include "strptime.h"
#endif