~ubuntu-branches/ubuntu/dapper/groff/dapper

« back to all changes in this revision

Viewing changes to src/include/nonposix.h

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2002-03-17 04:11:50 UTC
  • Revision ID: james.westby@ubuntu.com-20020317041150-wkgfawjc3gxlk0o5
Tags: upstream-1.17.2
ImportĀ upstreamĀ versionĀ 1.17.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2000 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
# define setmode(f,m) _setmode(f,m)
 
28
#endif
 
29
 
 
30
#if defined(__MSDOS__) \
 
31
    || (defined(_WIN32) && !defined(_UWIN) && !defined(__CYGWIN32__))
 
32
 
 
33
/* Binary I/O nuisances.  Note: "setmode" is right for DJGPP and
 
34
   Borland; Windows compilers might need _setmode or some such.  */
 
35
# include <fcntl.h>
 
36
# include <io.h>
 
37
# ifdef HAVE_UNISTD_H
 
38
#  include <unistd.h>
 
39
# endif
 
40
# define SET_BINARY(f) do {if (!isatty(f)) setmode(f,O_BINARY);} while(0)
 
41
# define FOPEN_RB      "rb"
 
42
# define FOPEN_WB      "wb"
 
43
# define FOPEN_RWB     "wb+"
 
44
# ifdef _MSC_VER
 
45
#  define POPEN_RT     "rt"
 
46
#  define POPEN_WT     "wt"
 
47
#  define popen(c,m)   _popen(c,m)
 
48
#  define pclose(p)    _pclose(p)
 
49
#  define getpid()     (1)
 
50
# endif
 
51
# ifndef O_BINARY
 
52
#  ifdef _O_BINARY
 
53
#   define O_BINARY    (_O_BINARY)
 
54
#  endif
 
55
# endif
 
56
 
 
57
/* The system shell.  Groff assumes a Unixy shell, but non-Posix
 
58
   systems don't have standard places where it lives, and might not
 
59
   have it installed to begin with.  We want to give them some leeway.  */
 
60
# define BSHELL        (system_shell_name())
 
61
# define BSHELL_DASH_C (system_shell_dash_c())
 
62
# define IS_BSHELL(s)  (is_system_shell(s))
 
63
 
 
64
/* The separator for directories in PATH and other environment
 
65
   variables.  */
 
66
# define PATH_SEP      ";"
 
67
 
 
68
/* Characters that separate directories in a path name.  */
 
69
# define DIR_SEPS      "/\\:"
 
70
 
 
71
/* How to tell if the argument is an absolute file name.  */
 
72
# define IS_ABSOLUTE(f) \
 
73
 ((f)[0] == '/' || (f)[0] == '\\' || (f)[0] && (f)[1] == ':')
 
74
 
 
75
/* The executable extension.  */
 
76
# define EXE_EXT       ".exe"
 
77
 
 
78
/* The system null device.  */
 
79
# define NULL_DEV      "NUL"
 
80
 
 
81
/* Prototypes.  */
 
82
# ifdef __cplusplus
 
83
  extern "C" {
 
84
# endif
 
85
    const char * system_shell_name(void);
 
86
    const char * system_shell_dash_c(void);
 
87
    int          is_system_shell(const char *);
 
88
# ifdef __cplusplus
 
89
  }
 
90
# endif
 
91
 
 
92
#endif
 
93
 
 
94
/* Defaults, for Posix systems.  */
 
95
 
 
96
#ifndef FOPEN_RB
 
97
# define FOPEN_RB      "r"
 
98
#endif
 
99
#ifndef FOPEN_WB
 
100
# define FOPEN_WB      "w"
 
101
#endif
 
102
#ifndef FOPEN_RWB
 
103
# define FOPEN_RWB     "w+"
 
104
#endif
 
105
#ifndef POPEN_RT
 
106
# define POPEN_RT      "r"
 
107
#endif
 
108
#ifndef POPEN_WT
 
109
# define POPEN_WT      "w"
 
110
#endif
 
111
#ifndef O_BINARY
 
112
# define O_BINARY      0
 
113
#endif
 
114
#ifndef BSHELL
 
115
# define BSHELL        "/bin/sh"
 
116
#endif
 
117
#ifndef BSHELL_DASH_C
 
118
# define BSHELL_DASH_C "-c"
 
119
#endif
 
120
#ifndef IS_BSHELL
 
121
# define IS_BSHELL(s)  ((s) && strcmp(s,BSHELL) == 0)
 
122
#endif
 
123
#ifndef PATH_SEP
 
124
# define PATH_SEP      ":"
 
125
#endif
 
126
#ifndef DIR_SEPS
 
127
# define DIR_SEPS      "/"
 
128
#endif
 
129
#ifndef IS_ABSOLUTE
 
130
# define IS_ABSOLUTE(f) ((f)[0] == '/')
 
131
#endif
 
132
#ifndef EXE_EXT
 
133
# define EXE_EXT       ""
 
134
#endif
 
135
#ifndef NULL_DEV
 
136
# define NULL_DEV      "/dev/null"
 
137
#endif