diff options
author | Adam Jackson <ajax@redhat.com> | 2017-10-24 13:54:47 -0400 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2017-10-24 15:14:23 -0400 |
commit | 102696da8737fcb324034f673cd5815f28923311 (patch) | |
tree | 360e49b700b617768f4289c6d9d23da7641791b1 /filewr.c | |
parent | e12c03d50a634a98e4560c7117a3bec3349561e9 (diff) |
Import libXfont's BDF-to-PCF code
bdftopcf is the only consumer of libXfont 1.x's read/write support, and
we'd like 1.x to go away entirely. Copy in the BDF read and PCF write
support so there's one fewer consumer of 1.x.
Signed-off-by: Adam Jackson <ajax@redhat.com>
Acked-by: Julien Cristau <jcristau@debian.org>
Diffstat (limited to 'filewr.c')
-rw-r--r-- | filewr.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/filewr.c b/filewr.c new file mode 100644 index 0000000..859a0be --- /dev/null +++ b/filewr.c @@ -0,0 +1,64 @@ +/* + +Copyright 1991, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +/* + * Author: Keith Packard, MIT X Consortium + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif +#include <X11/fonts/fntfilio.h> +#include <X11/Xos.h> +#ifndef O_BINARY +#define O_BINARY 0 +#endif +#ifndef O_CLOEXEC +#define O_CLOEXEC 0 +#endif + +FontFilePtr +FontFileOpenWrite (const char *name) +{ + int fd; + + fd = open (name, O_CREAT|O_TRUNC|O_RDWR|O_BINARY|O_CLOEXEC, 0666); + if (fd < 0) + return 0; + return (FontFilePtr) BufFileOpenWrite (fd); +} + +FontFilePtr +FontFileOpenWriteFd (int fd) +{ + return (FontFilePtr) BufFileOpenWrite (fd); +} + +FontFilePtr +FontFileOpenFd (int fd) +{ + return (FontFilePtr) BufFileOpenRead (fd); +} |