From 5f85085d76749a9f1874fb203ae7857d906f728b Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Fri, 20 Apr 2018 16:40:06 +0800 Subject: [PATCH] src/psl.c: Fix build on Visual Studio Visual Studio does not come with unistd.h, so only include it when we have HAVE_UNISTD_H. It also does not like including locale.h within main() for some reason, so include that with the other system headers. --- tools/psl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/psl.c b/tools/psl.c index 04b2b30..0167fb0 100644 --- a/tools/psl.c +++ b/tools/psl.c @@ -32,10 +32,14 @@ # include #endif -#include +#ifdef HAVE_UNISTD_H +# include +#endif + #include #include #include +#include #include @@ -78,7 +82,6 @@ int main(int argc, const char *const *argv) psl_ctx_t *psl = (psl_ctx_t *) psl_latest(NULL); /* set current locale according to the environment variables */ - #include setlocale(LC_ALL, ""); for (arg = argv + 1; arg < argv + argc; arg++) {