1109998Smarkm// -*- C++ -*-
2280304Sjkim/* Copyright (C) 1992, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
3280304Sjkim     Written by James Clark (jjc@jclark.com)
4280304Sjkim
5109998SmarkmThis file is part of groff.
6109998Smarkm
7109998Smarkmgroff is free software; you can redistribute it and/or modify it under
8109998Smarkmthe terms of the GNU General Public License as published by the Free
9109998SmarkmSoftware Foundation; either version 2, or (at your option) any later
10109998Smarkmversion.
11109998Smarkm
12109998Smarkmgroff is distributed in the hope that it will be useful, but WITHOUT ANY
13109998SmarkmWARRANTY; without even the implied warranty of MERCHANTABILITY or
14280304SjkimFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15109998Smarkmfor more details.
16109998Smarkm
17109998SmarkmYou should have received a copy of the GNU General Public License along
18109998Smarkmwith groff; see the file COPYING.  If not, write to the Free Software
19109998SmarkmFoundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */
20109998Smarkm
21109998Smarkm#include <sys/types.h>
22109998Smarkm#include <sys/stat.h>
23109998Smarkm
24109998Smarkm#ifdef HAVE_CC_OSFCN_H
25109998Smarkm#include <osfcn.h>
26109998Smarkm#else
27109998Smarkm#include <fcntl.h>
28109998Smarkm#ifdef HAVE_UNISTD_H
29109998Smarkm#include <unistd.h>
30109998Smarkm#endif
31109998Smarkm#endif
32109998Smarkm
33109998Smarkm#ifndef S_IRUSR
34109998Smarkm#define S_IRUSR 0400
35109998Smarkm#endif
36109998Smarkm
37109998Smarkm#ifndef S_IRGRP
38109998Smarkm#define S_IRGRP 0040
39109998Smarkm#endif
40109998Smarkm
41109998Smarkm#ifndef S_IROTH
42109998Smarkm#define S_IROTH 0004
43109998Smarkm#endif
44109998Smarkm
45109998Smarkm#ifndef S_IWUSR
46109998Smarkm#define S_IWUSR 0200
47109998Smarkm#endif
48109998Smarkm
49109998Smarkm#ifndef S_IXUSR
50109998Smarkm#define S_IXUSR 0100
51109998Smarkm#endif
52109998Smarkm
53109998Smarkm#ifndef S_ISREG
54109998Smarkm#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
55109998Smarkm#endif
56109998Smarkm
57109998Smarkm#ifndef O_RDONLY
58109998Smarkm#define O_RDONLY 0
59109998Smarkm#endif
60109998Smarkm
61109998Smarkm#ifndef F_OK
62109998Smarkm#define F_OK 0
63109998Smarkm#endif
64109998Smarkm
65109998Smarkm#ifndef HAVE_ISATTY
66109998Smarkm#define isatty(n) (1)
67109998Smarkm#endif
68109998Smarkm