Imported Upstream version 1.1.11
[platform/upstream/cdrkit.git] / include / unixstd.h
1 /*
2  * This file has been modified for the cdrkit suite.
3  *
4  * The behaviour and appearence of the program code below can differ to a major
5  * extent from the version distributed by the original author(s).
6  *
7  * For details, see Changelog file distributed with the cdrkit package. If you
8  * received this file from another source then ask the distributing person for
9  * a log of modifications.
10  *
11  */
12
13 /* @(#)unixstd.h        1.12 04/06/17 Copyright 1996 J. Schilling */
14 /*
15  *      Definitions for unix system interface
16  *
17  *      Copyright (c) 1996 J. Schilling
18  */
19 /*
20  * This program is free software; you can redistribute it and/or modify
21  * it under the terms of the GNU General Public License version 2
22  * as published by the Free Software Foundation.
23  *
24  * This program is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
27  * GNU General Public License for more details.
28  *
29  * You should have received a copy of the GNU General Public License along with
30  * this program; see the file COPYING.  If not, write to the Free Software
31  * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
32  */
33
34 #ifndef _UNIXSTD_H
35 #define _UNIXSTD_H
36
37 #ifndef _MCONFIG_H
38 #include <mconfig.h>
39 #endif
40
41 #ifdef  HAVE_UNISTD_H
42
43 #ifndef _INCL_SYS_TYPES_H
44 #include <sys/types.h>
45 #define _INCL_SYS_TYPES_H
46 #endif
47 #ifndef _INCL_UNISTD_H
48 #include <unistd.h>
49 #define _INCL_UNISTD_H
50 #endif
51
52 #ifndef _SC_PAGESIZE
53 #ifdef  _SC_PAGE_SIZE   /* HP/UX & OSF */
54 #define _SC_PAGESIZE    _SC_PAGE_SIZE
55 #endif
56 #endif
57
58 #else   /* HAVE_UNISTD_H */
59
60 /*
61  * unistd.h grants things like off_t to be typedef'd.
62  */
63 #ifndef _INCL_SYS_TYPES_H
64 #include <sys/types.h>
65 #define _INCL_SYS_TYPES_H
66 #endif
67
68 #endif  /* HAVE_UNISTD_H */
69
70 #ifndef STDIN_FILENO
71 #       ifdef   JOS
72 #               ifndef  _JOS_IO_H
73 #               include <jos_io.h>
74 #               endif
75 #       else
76 #               define  STDIN_FILENO    0
77 #               define  STDOUT_FILENO   1
78 #               define  STDERR_FILENO   2
79 #       endif
80 #endif
81
82 #ifndef R_OK
83 /* Symbolic constants for the "access" routine: */
84 #define R_OK    4       /* Test for Read permission */
85 #define W_OK    2       /* Test for Write permission */
86 #define X_OK    1       /* Test for eXecute permission */
87 #define F_OK    0       /* Test for existence of File */
88 #endif
89 #ifndef E_OK
90 #ifdef  HAVE_ACCESS_E_OK
91 #ifdef  EFF_ONLY_OK
92 #define E_OK    EFF_ONLY_OK /* Irix */
93 #else
94 #ifdef  EUID_OK
95 #define E_OK    EUID_OK /* UNICOS (0400) */
96 #else
97 #define E_OK    010     /* Test effective uids */
98 #endif  /* EUID_OK */
99 #endif  /* EFF_ONLY_OK */
100 #else
101 #define E_OK    0
102 #endif  /* HAVE_ACCESS_E_OK */
103 #endif  /* !E_OK */
104
105 /* Symbolic constants for the "lseek" routine: */
106 #ifndef SEEK_SET
107 #define SEEK_SET        0       /* Set file pointer to "offset" */
108 #endif
109 #ifndef SEEK_CUR
110 #define SEEK_CUR        1       /* Set file pointer to current plus "offset" */
111 #endif
112 #ifndef SEEK_END
113 #define SEEK_END        2       /* Set file pointer to EOF plus "offset" */
114 #endif
115
116 #if     !defined(HAVE_UNISTD_H) || !defined(_POSIX_VERSION)
117 /*
118  * Maybe we need a lot more definitions here...
119  * It is not clear whether we should have prototyped definitions.
120  */
121 extern  int     access(const char *, int);
122 extern  int     close(int);
123 extern  int     dup(int);
124 extern  int     dup2(int, int);
125 extern  void    _exit(int);
126 extern  int     link(const char *, const char *);
127 extern  int     read(int, void *, size_t);
128 extern  int     unlink(const char *);
129 extern  int     write(int, void *, size_t);
130 #endif
131
132 #endif  /* _UNIXSTD_H */