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 POPEN_RT "rt"
41 # define POPEN_WT "wt"
42 # define popen(c,m) _popen(c,m)
43 # define pclose(p) _pclose(p)
45 # define mkdir(p,m) _mkdir(p)
46 # define setmode(f,m) _setmode(f,m)
47 # define WAIT(s,p,m) _cwait(s,p,m)
48 # define creat(p,m) _creat(p,m)
50 # define SET_BINARY(f) do {if (!isatty(f)) setmode(f,O_BINARY);} while(0)
51 # define FOPEN_RB "rb"
52 # define FOPEN_WB "wb"
53 # define FOPEN_RWB "wb+"
56 # define O_BINARY (_O_BINARY)
60 /* The system shell. Groff assumes a Unixy shell, but non-Posix
61 systems don't have standard places where it lives, and might not
62 have it installed to begin with. We want to give them some leeway. */
64 # define getcwd(b,s) _getcwd2(b,s)
66 # define BSHELL (system_shell_name())
67 # define BSHELL_DASH_C (system_shell_dash_c())
68 # define IS_BSHELL(s) (is_system_shell(s))
71 /* The separator for directories in PATH and other environment
75 /* Characters that separate directories in a path name. */
76 # define DIR_SEPS "/\\:"
78 /* How to tell if the argument is an absolute file name. */
79 # define IS_ABSOLUTE(f) \
80 ((f)[0] == '/' || (f)[0] == '\\' || (f)[0] && (f)[1] == ':')
82 /* The executable extension. */
83 # define EXE_EXT ".exe"
85 /* The system null device. */
86 # define NULL_DEV "NUL"
92 const char * system_shell_name(void);
93 const char * system_shell_dash_c(void);
94 int is_system_shell(const char *);
101 /* Defaults, for Posix systems. */
104 # define SET_BINARY(f) do {} while(0)
107 # define FOPEN_RB "r"
110 # define FOPEN_WB "w"
113 # define FOPEN_RWB "w+"
116 # define POPEN_RT "r"
119 # define POPEN_WT "w"
125 # define BSHELL "/bin/sh"
127 #ifndef BSHELL_DASH_C
128 # define BSHELL_DASH_C "-c"
131 # define IS_BSHELL(s) ((s) && strcmp(s,BSHELL) == 0)
134 # define PATH_SEP ":"
137 # define DIR_SEPS "/"
140 # define IS_ABSOLUTE(f) ((f)[0] == '/')
146 # define NULL_DEV "/dev/null"
149 # define GS_NAME "gs"
152 # define WAIT(s,p,m) wait(s)
155 # define _WAIT_CHILD 0