1fa2b3b63Smrg/*
2fa2b3b63Smrg
3fa2b3b63SmrgCopyright 1991, 1998  The Open Group
4fa2b3b63Smrg
5fa2b3b63SmrgPermission to use, copy, modify, distribute, and sell this software and its
6fa2b3b63Smrgdocumentation for any purpose is hereby granted without fee, provided that
7fa2b3b63Smrgthe above copyright notice appear in all copies and that both that
8fa2b3b63Smrgcopyright notice and this permission notice appear in supporting
9fa2b3b63Smrgdocumentation.
10fa2b3b63Smrg
11fa2b3b63SmrgThe above copyright notice and this permission notice shall be included in
12fa2b3b63Smrgall copies or substantial portions of the Software.
13fa2b3b63Smrg
14fa2b3b63SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15fa2b3b63SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16fa2b3b63SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
17fa2b3b63SmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18fa2b3b63SmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19fa2b3b63SmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20fa2b3b63Smrg
21fa2b3b63SmrgExcept as contained in this notice, the name of The Open Group shall not be
22fa2b3b63Smrgused in advertising or otherwise to promote the sale, use or other dealings
23fa2b3b63Smrgin this Software without prior written authorization from The Open Group.
24fa2b3b63Smrg
25fa2b3b63Smrg*/
26fa2b3b63Smrg
27fa2b3b63Smrg/*
28fa2b3b63Smrg * Author:  Keith Packard, MIT X Consortium
29fa2b3b63Smrg */
30fa2b3b63Smrg
31fa2b3b63Smrg#ifdef HAVE_CONFIG_H
32fa2b3b63Smrg#include <config.h>
33fa2b3b63Smrg#endif
34fa2b3b63Smrg#include "fntfilio.h"
35fa2b3b63Smrg#include <X11/Xos.h>
36fa2b3b63Smrg#ifndef O_BINARY
37fa2b3b63Smrg#define O_BINARY	0
38fa2b3b63Smrg#endif
39fa2b3b63Smrg#ifndef O_CLOEXEC
40fa2b3b63Smrg#define O_CLOEXEC	0
41fa2b3b63Smrg#endif
42fa2b3b63Smrg
43fa2b3b63SmrgFontFilePtr
44e24f450bSmrgFontFileOpenWrite(const char *name)
45fa2b3b63Smrg{
46e24f450bSmrg    int fd;
47fa2b3b63Smrg
48e24f450bSmrg    fd = open(name, O_CREAT | O_TRUNC | O_RDWR | O_BINARY | O_CLOEXEC, 0666);
49fa2b3b63Smrg    if (fd < 0)
50e24f450bSmrg        return 0;
51e24f450bSmrg    return (FontFilePtr) BufFileOpenWrite(fd);
52fa2b3b63Smrg}
53fa2b3b63Smrg
54fa2b3b63SmrgFontFilePtr
55e24f450bSmrgFontFileOpenWriteFd(int fd)
56fa2b3b63Smrg{
57e24f450bSmrg    return (FontFilePtr) BufFileOpenWrite(fd);
58fa2b3b63Smrg}
59fa2b3b63Smrg
60fa2b3b63SmrgFontFilePtr
61e24f450bSmrgFontFileOpenFd(int fd)
62fa2b3b63Smrg{
63e24f450bSmrg    return (FontFilePtr) BufFileOpenRead(fd);
64fa2b3b63Smrg}
65