]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/groff/src/include/nonposix.h
This commit was generated by cvs2svn to compensate for changes in r147455,
[FreeBSD/FreeBSD.git] / contrib / groff / src / include / nonposix.h
1 /* Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
2      Written by Eli Zaretskii (eliz@is.elta.co.il)
3
4 This file is part of groff.
5
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
9 version.
10
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
14 for more details.
15
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. */
19
20 /* This header file compartmentalize all idiosyncrasies of non-Posix
21    systems, such as MS-DOS, MS-Windows, etc.  */
22
23 #if defined _MSC_VER
24 # ifndef _WIN32
25 #  define _WIN32
26 # endif
27 #endif
28
29 #if defined(__MSDOS__) || defined(__EMX__) \
30     || (defined(_WIN32) && !defined(_UWIN) && !defined(__CYGWIN__))
31
32 /* Binary I/O nuisances.  Note: "setmode" is right for DJGPP and
33    Borland; Windows compilers might need _setmode or some such.  */
34 # include <fcntl.h>
35 # include <io.h>
36 # ifdef HAVE_UNISTD_H
37 #  include <unistd.h>
38 # endif
39 # ifdef _MSC_VER
40 #  define POPEN_RT     "rt"
41 #  define POPEN_WT     "wt"
42 #  define popen(c,m)   _popen(c,m)
43 #  define pclose(p)    _pclose(p)
44 #  define getpid()     (1)
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)
49 # endif
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+"
54 # ifndef O_BINARY
55 #  ifdef _O_BINARY
56 #   define O_BINARY    (_O_BINARY)
57 #  endif
58 # endif
59
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.  */
63 # ifdef __EMX__
64 #  define getcwd(b,s)  _getcwd2(b,s)
65 # else
66 #  define BSHELL        (system_shell_name())
67 #  define BSHELL_DASH_C (system_shell_dash_c())
68 #  define IS_BSHELL(s)  (is_system_shell(s))
69 # endif
70
71 /* The separator for directories in PATH and other environment
72    variables.  */
73 # define PATH_SEP      ";"
74
75 /* Characters that separate directories in a path name.  */
76 # define DIR_SEPS      "/\\:"
77
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] == ':')
81
82 /* The executable extension.  */
83 # define EXE_EXT       ".exe"
84
85 /* The system null device.  */
86 # define NULL_DEV      "NUL"
87
88 /* Prototypes.  */
89 # ifdef __cplusplus
90   extern "C" {
91 # endif
92     const char * system_shell_name(void);
93     const char * system_shell_dash_c(void);
94     int          is_system_shell(const char *);
95 # ifdef __cplusplus
96   }
97 # endif
98
99 #endif
100
101 /* Defaults, for Posix systems.  */
102
103 #ifndef SET_BINARY
104 # define SET_BINARY(f) do {} while(0)
105 #endif
106 #ifndef FOPEN_RB
107 # define FOPEN_RB      "r"
108 #endif
109 #ifndef FOPEN_WB
110 # define FOPEN_WB      "w"
111 #endif
112 #ifndef FOPEN_RWB
113 # define FOPEN_RWB     "w+"
114 #endif
115 #ifndef POPEN_RT
116 # define POPEN_RT      "r"
117 #endif
118 #ifndef POPEN_WT
119 # define POPEN_WT      "w"
120 #endif
121 #ifndef O_BINARY
122 # define O_BINARY      0
123 #endif
124 #ifndef BSHELL
125 # define BSHELL        "/bin/sh"
126 #endif
127 #ifndef BSHELL_DASH_C
128 # define BSHELL_DASH_C "-c"
129 #endif
130 #ifndef IS_BSHELL
131 # define IS_BSHELL(s)  ((s) && strcmp(s,BSHELL) == 0)
132 #endif
133 #ifndef PATH_SEP
134 # define PATH_SEP      ":"
135 #endif
136 #ifndef DIR_SEPS
137 # define DIR_SEPS      "/"
138 #endif
139 #ifndef IS_ABSOLUTE
140 # define IS_ABSOLUTE(f) ((f)[0] == '/')
141 #endif
142 #ifndef EXE_EXT
143 # define EXE_EXT       ""
144 #endif
145 #ifndef NULL_DEV
146 # define NULL_DEV      "/dev/null"
147 #endif
148 #ifndef GS_NAME
149 # define GS_NAME       "gs"
150 #endif
151 #ifndef WAIT
152 # define WAIT(s,p,m)   wait(s)
153 #endif
154 #ifndef _WAIT_CHILD
155 # define _WAIT_CHILD   0
156 #endif