Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / programs / dtudcfonted / libfal / _falrmI.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* XrmI.h 1.1 - Fujitsu source for CDEnext    95/11/06 20:32:12         */ 
24 /* $XConsortium: _falrmI.h /main/1 1996/04/08 15:22:08 cde-fuj $ */
25 /*
26
27 Copyright (c) 1990  X Consortium
28
29 Permission is hereby granted, free of charge, to any person obtaining
30 a copy of this software and associated documentation files (the
31 "Software"), to deal in the Software without restriction, including
32 without limitation the rights to use, copy, modify, merge, publish,
33 distribute, sublicense, and/or sell copies of the Software, and to
34 permit persons to whom the Software is furnished to do so, subject to
35 the following conditions:
36
37 The above copyright notice and this permission notice shall be included
38 in all copies or substantial portions of the Software.
39
40 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
41 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
42 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
43 IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
44 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
45 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
46 OTHER DEALINGS IN THE SOFTWARE.
47
48 Except as contained in this notice, the name of the X Consortium shall
49 not be used in advertising or otherwise to promote the sale, use or
50 other dealings in this Software without prior written authorization
51 from the X Consortium.
52
53 */
54
55
56 /*
57  * Macros to abstract out reading the file, and getting its size.
58  *
59  * You may need to redefine these for various other operating systems. 
60  */
61
62 #include        <X11/Xos.h>
63 #include        <sys/stat.h>                        
64
65 #ifdef WIN32
66 #define OpenFile(name)          open((name), O_RDONLY|O_TEXT)
67 #else
68 #define OpenFile(name)          open((name), O_RDONLY)
69 #endif
70 #define CloseFile(fd)           close((fd))
71 #define ReadFile(fd,buf,size)   read((fd), (buf), (size))
72 #define GetSizeOfFile(name,size)                    \
73 {                                                   \
74     struct stat status_buffer;                      \
75     if ( (stat((name), &status_buffer)) == -1 )     \
76         size = -1;                                  \
77     else                                            \
78         size = status_buffer.st_size;               \
79 }