summaryrefslogtreecommitdiff
path: root/nonposix.h
blob: 2cffc505a2282073e373ec0dbdee719a6b4492f5 (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
/*
 * nonposix.h --- definitions needed on non-POSIX systems.
 */

/*
 * Copyright (C) 2012, 2013, 2016, 2017, 2018, 2019, 2022
 * the Free Software Foundation, Inc.
 *
 * This file is part of GAWK, the GNU implementation of the
 * AWK Programming Language.
 *
 * GAWK is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * GAWK 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 */

/*
 * This is for fake directory file descriptors on systems that don't
 * allow to open() a directory.
 */

#define FAKE_FD_VALUE 42

#ifdef __MINGW32__
/* Replacements for sys/wait.h macros.  */
# define WEXITSTATUS(stv) (((unsigned)(stv)) & ~0xC0000000)
/* MS-Windows programs that crash due to a fatal exception exit with
   an exit code whose 2 MSB bits are set.  */
# define WIFEXITED(stv)   ((((unsigned)(stv)) & 0xC0000000) == 0)
# define WIFSIGNALED(stv) ((((unsigned)(stv)) & 0xC0000000) == 0xC0000000)
# define WTERMSIG(stv)    w32_status_to_termsig ((unsigned)stv)
# define WIFSTOPPED(stv)  (0)
# define WSTOPSIG(stv)    (0)

int w32_status_to_termsig (unsigned);

/* Prototypes of for Posix functions for which we define replacements
   in pc/ files.  */

/* getid.c */
unsigned int getuid (void);
unsigned int geteuid (void);
unsigned int getgid (void);
unsigned int getegid (void);

/* gawkmisc.pc */
int unsetenv (const char *);
int setenv (const char *, const char *, int);
char *w32_setlocale (int, const char *);
/* libintl.h from GNU gettext defines setlocale to redirect that to
   its own function.  Note: this will have to be revisited if MinGW
   Gawk will support ENABLE_NLS at some point.  */
#ifdef setlocale
# undef setlocale
#endif
#define setlocale(c,v) w32_setlocale(c,v)

char *strsignal (int);

#endif	/* __MINGW32__ */

#if defined(VMS) || defined(__MINGW32__)
int getpgrp(void);
#endif

#if defined(__MINGW32__)
int getppid(void);
#endif