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.
This commit is contained in:
Chun-wei Fan 2018-04-20 16:40:06 +08:00 committed by Tim Rühsen
parent 9620b13374
commit 5f85085d76
1 changed files with 5 additions and 2 deletions

View File

@ -32,10 +32,14 @@
# include <config.h>
#endif
#include <unistd.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <locale.h>
#include <libpsl.h>
@ -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 <locale.h>
setlocale(LC_ALL, "");
for (arg = argv + 1; arg < argv + argc; arg++) {