summaryrefslogtreecommitdiff
path: root/Build/source/texk/kpathsea/mingw32.h
blob: f05935cef1da4fd74f0ab24d142ced178c6fb2ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/* mingw32.h: declarations for mingw32.

   Copyright 2009-2014 Taco Hoekwater <taco@luatex.org>.

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public License
   along with this library; if not, see <http://www.gnu.org/licenses/>.  */

#ifndef _MINGW32_H_
#define _MINGW32_H_

/* We need GetLongPathName and perhaps others.  */
#if !defined WINVER || WINVER < 0x0500
#undef WINVER
#define WINVER 0x0500
#endif

#include <stdlib.h>
/* The embedded rndnpc.h defines boolean as 'unsigned char',
   and we do not want that.
   This should be safe as long as we don't use npc ourselves. */
#define boolean saved_boolean
/* With WINVER >= 0x0403 winuser.h declares INPUT as `struct tagINPUT`,
   and we do not want that. */
#define INPUT saved_INPUT
#include <windows.h>
#include <winerror.h>
#include <winnt.h>
#undef boolean
#undef INPUT
#include <dirent.h>
#include <direct.h>
#include <fcntl.h>
#include <ctype.h>

/* sys/types.h defines off_t as `long' and we do not want that.
   We need to include unistd.h and sys/stat.h using off_t
   before defining off_t (no need to include wchar.h).  */
#include <unistd.h>
#include <sys/stat.h>
#define off_t off64_t
#define ftello ftello64
#define fseeko fseeko64

#ifndef MAXPATHLEN
#define MAXPATHLEN _MAX_PATH
#endif

#ifndef MAX_PIPES
#define MAX_PIPES 128
#endif

#ifdef __cplusplus
extern "C" {
#endif

#ifdef MAKE_KPSE_DLL /* libkpathsea internal only */

extern void init_user_info (void);
extern BOOL look_for_cmd (const char *, char **);
extern char *quote_args(char **);

#endif /* MAKE_KPSE_DLL */

extern KPSEDLL BOOL win32_get_long_filename (char *, char *, int);
extern KPSEDLL void texlive_gs_init(void);

static inline FILE *
win32_popen (const char *command, const char *fmode)
{
  char mode[3];

  /* We always use binary mode */
  mode[0] = fmode[0];
  mode[1] = 'b';
  mode[2] = '\0';

  return _popen (command, mode);
}
#undef popen
#define popen(cmd, mode) win32_popen(cmd, mode)

#ifdef __cplusplus
}
#endif

#endif