xref: /openbsd/include/nl_types.h (revision d874cce4)
1 /*	$OpenBSD: nl_types.h,v 1.8 2008/06/26 05:42:04 ray Exp $	*/
2 /*	$NetBSD: nl_types.h,v 1.6 1996/05/13 23:11:15 jtc Exp $	*/
3 
4 /*-
5  * Copyright (c) 1996 The NetBSD Foundation, Inc.
6  * All rights reserved.
7  *
8  * This code is derived from software contributed to The NetBSD Foundation
9  * by J.T. Conklin.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the
18  *    documentation and/or other materials provided with the distribution.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
24  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef _NL_TYPES_H_
34 #define _NL_TYPES_H_
35 #include <sys/cdefs.h>
36 
37 #ifdef _NLS_PRIVATE
38 /*
39  * MESSAGE CATALOG FILE FORMAT.
40  *
41  * The NetBSD message catalog format is similar to the format used by
42  * Svr4 systems.  The differences are:
43  *   * fixed byte order (big endian)
44  *   * fixed data field sizes
45  *
46  * A message catalog contains four data types: a catalog header, one
47  * or more set headers, one or more message headers, and one or more
48  * text strings.
49  */
50 
51 #define _NLS_MAGIC	0xff88ff89
52 
53 struct _nls_cat_hdr {
54 	int32_t __magic;
55 	int32_t __nsets;
56 	int32_t __mem;
57 	int32_t __msg_hdr_offset;
58 	int32_t __msg_txt_offset;
59 } ;
60 
61 struct _nls_set_hdr {
62 	int32_t __setno;	/* set number: 0 < x <= NL_SETMAX */
63 	int32_t __nmsgs;	/* number of messages in the set  */
64 	int32_t __index;	/* index of first msg_hdr in msg_hdr table */
65 } ;
66 
67 struct _nls_msg_hdr {
68 	int32_t __msgno;	/* msg number: 0 < x <= NL_MSGMAX */
69 	int32_t __msglen;
70 	int32_t __offset;
71 } ;
72 
73 #endif
74 
75 #define	NL_SETD		1
76 #define NL_CAT_LOCALE   1
77 
78 typedef struct _nl_catd {
79 	void	*__data;
80 	int	__size;
81 } *nl_catd;
82 
83 typedef long	nl_item;
84 
85 __BEGIN_DECLS
86 extern nl_catd 	catopen(const char *, int);
87 extern char    *catgets(nl_catd, int, int, const char *);
88 extern int	catclose(nl_catd);
89 __END_DECLS
90 
91 #endif	/* _NL_TYPES_H_ */
92