1 /* Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
2 Written by Eli Zaretskii (eliz@is.elta.co.il)
4 This file is part of groff.
6 groff is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2, or (at your option) any later
11 groff is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 You should have received a copy of the GNU General Public License along
17 with groff; see the file COPYING. If not, write to the Free Software
18 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
20 /* This header file compartmentalize all idiosyncrasies of non-Posix
21 systems, such as MS-DOS, MS-Windows, etc. */
29 #if defined(__MSDOS__) || defined(__EMX__) \
30 || (defined(_WIN32) && !defined(_UWIN) && !defined(__CYGWIN__))
32 /* Binary I/O nuisances. Note: "setmode" is right for DJGPP and
33 Borland; Windows compilers might need _setmode or some such. */
40 # define STDIN_FILENO 0
41 # define STDOUT_FILENO 1
42 # define STDERR_FILENO 2
47 # ifdef HAVE_PROCESS_H
50 # if defined(_MSC_VER) || defined(__MINGW32__)
51 # define POPEN_RT "rt"
52 # define POPEN_WT "wt"
53 # define popen(c,m) _popen(c,m)
54 # define pclose(p) _pclose(p)
55 # define pipe(pfd) _pipe((pfd),0,_O_BINARY|_O_NOINHERIT)
56 # define mkdir(p,m) _mkdir(p)
57 # define setmode(f,m) _setmode(f,m)
58 # define WAIT(s,p,m) _cwait(s,p,m)
59 # define creat(p,m) _creat(p,m)
60 # define read(f,b,s) _read(f,b,s)
62 # define SET_BINARY(f) do {if (!isatty(f)) setmode(f,O_BINARY);} while(0)
63 # define FOPEN_RB "rb"
64 # define FOPEN_WB "wb"
65 # define FOPEN_RWB "wb+"
68 # define O_BINARY (_O_BINARY)
72 /* The system shell. Groff assumes a Unixy shell, but non-Posix
73 systems don't have standard places where it lives, and might not
74 have it installed to begin with. We want to give them some leeway. */
76 # define getcwd(b,s) _getcwd2(b,s)
78 # define BSHELL (system_shell_name())
79 # define BSHELL_DASH_C (system_shell_dash_c())
80 # define IS_BSHELL(s) (is_system_shell(s))
83 /* The separator for directories in PATH and other environment
86 # define PATH_SEP_CHAR ';'
88 /* Characters that separate directories in a path name. */
89 # define DIR_SEPS "/\\:"
91 /* How to tell if the argument is an absolute file name. */
92 # define IS_ABSOLUTE(f) \
93 ((f)[0] == '/' || (f)[0] == '\\' || (f)[0] && (f)[1] == ':')
95 /* The executable extension. */
96 # define EXE_EXT ".exe"
98 /* The system null device. */
99 # define NULL_DEV "NUL"
101 /* The default place to create temporary files. */
104 # define P_tmpdir _P_tmpdir
106 # define P_tmpdir "c:/temp"
114 const char * system_shell_name(void);
115 const char * system_shell_dash_c(void);
116 int is_system_shell(const char *);
123 /* Defaults, for Posix systems. */
126 # define SET_BINARY(f) do {} while(0)
129 # define FOPEN_RB "r"
132 # define FOPEN_WB "w"
135 # define FOPEN_RWB "w+"
138 # define POPEN_RT "r"
141 # define POPEN_WT "w"
147 # define BSHELL "/bin/sh"
149 #ifndef BSHELL_DASH_C
150 # define BSHELL_DASH_C "-c"
153 # define IS_BSHELL(s) ((s) && strcmp(s,BSHELL) == 0)
156 # define PATH_SEP ":"
157 # define PATH_SEP_CHAR ':'
160 # define DIR_SEPS "/"
163 # define IS_ABSOLUTE(f) ((f)[0] == '/')
169 # define NULL_DEV "/dev/null"
172 # define GS_NAME "gs"
175 # define WAIT(s,p,m) wait(s)
178 # define _WAIT_CHILD 0