154de7444SAlexey Zelkin /* $NetBSD: nl_types.h,v 1.9 2000/10/03 19:53:32 sommerfeld Exp $ */ 254de7444SAlexey Zelkin 3be6180cfSMike Barcroft /*- 4b61a5730SWarner Losh * SPDX-License-Identifier: BSD-2-Clause 5e58eb3c4SPedro F. Giffuni * 654de7444SAlexey Zelkin * Copyright (c) 1996 The NetBSD Foundation, Inc. 754de7444SAlexey Zelkin * All rights reserved. 8be6180cfSMike Barcroft * 954de7444SAlexey Zelkin * This code is derived from software contributed to The NetBSD Foundation 1054de7444SAlexey Zelkin * by J.T. Conklin. 11be6180cfSMike Barcroft * 1254de7444SAlexey Zelkin * Redistribution and use in source and binary forms, with or without 1354de7444SAlexey Zelkin * modification, are permitted provided that the following conditions 1454de7444SAlexey Zelkin * are met: 1554de7444SAlexey Zelkin * 1. Redistributions of source code must retain the above copyright 1654de7444SAlexey Zelkin * notice, this list of conditions and the following disclaimer. 1754de7444SAlexey Zelkin * 2. Redistributions in binary form must reproduce the above copyright 1854de7444SAlexey Zelkin * notice, this list of conditions and the following disclaimer in the 1954de7444SAlexey Zelkin * documentation and/or other materials provided with the distribution. 20be6180cfSMike Barcroft * 2154de7444SAlexey Zelkin * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 2254de7444SAlexey Zelkin * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2354de7444SAlexey Zelkin * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2454de7444SAlexey Zelkin * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 2554de7444SAlexey Zelkin * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2654de7444SAlexey Zelkin * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2754de7444SAlexey Zelkin * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2854de7444SAlexey Zelkin * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2954de7444SAlexey Zelkin * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 3054de7444SAlexey Zelkin * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 3154de7444SAlexey Zelkin * POSSIBILITY OF SUCH DAMAGE. 32be6180cfSMike Barcroft */ 3303060874SJordan K. Hubbard 3403060874SJordan K. Hubbard #ifndef _NL_TYPES_H_ 3503060874SJordan K. Hubbard #define _NL_TYPES_H_ 36be6180cfSMike Barcroft 3754de7444SAlexey Zelkin #include <sys/types.h> 3854de7444SAlexey Zelkin 3954de7444SAlexey Zelkin #ifdef _NLS_PRIVATE 4054de7444SAlexey Zelkin /* 4154de7444SAlexey Zelkin * MESSAGE CATALOG FILE FORMAT. 4254de7444SAlexey Zelkin * 4354de7444SAlexey Zelkin * The NetBSD/FreeBSD message catalog format is similar to the format used by 4454de7444SAlexey Zelkin * Svr4 systems. The differences are: 4554de7444SAlexey Zelkin * * fixed byte order (big endian) 4654de7444SAlexey Zelkin * * fixed data field sizes 4754de7444SAlexey Zelkin * 4854de7444SAlexey Zelkin * A message catalog contains four data types: a catalog header, one 4954de7444SAlexey Zelkin * or more set headers, one or more message headers, and one or more 5054de7444SAlexey Zelkin * text strings. 5154de7444SAlexey Zelkin */ 5254de7444SAlexey Zelkin 5354de7444SAlexey Zelkin #define _NLS_MAGIC 0xff88ff89 5454de7444SAlexey Zelkin 5554de7444SAlexey Zelkin struct _nls_cat_hdr { 5654de7444SAlexey Zelkin int32_t __magic; 5754de7444SAlexey Zelkin int32_t __nsets; 5854de7444SAlexey Zelkin int32_t __mem; 5954de7444SAlexey Zelkin int32_t __msg_hdr_offset; 6054de7444SAlexey Zelkin int32_t __msg_txt_offset; 6154de7444SAlexey Zelkin } ; 6254de7444SAlexey Zelkin 6354de7444SAlexey Zelkin struct _nls_set_hdr { 6454de7444SAlexey Zelkin int32_t __setno; /* set number: 0 < x <= NL_SETMAX */ 6554de7444SAlexey Zelkin int32_t __nmsgs; /* number of messages in the set */ 6654de7444SAlexey Zelkin int32_t __index; /* index of first msg_hdr in msg_hdr table */ 6754de7444SAlexey Zelkin } ; 6854de7444SAlexey Zelkin 6954de7444SAlexey Zelkin struct _nls_msg_hdr { 7054de7444SAlexey Zelkin int32_t __msgno; /* msg number: 0 < x <= NL_MSGMAX */ 7154de7444SAlexey Zelkin int32_t __msglen; 7254de7444SAlexey Zelkin int32_t __offset; 7354de7444SAlexey Zelkin } ; 7454de7444SAlexey Zelkin 7554de7444SAlexey Zelkin #endif /* _NLS_PRIVATE */ 7603060874SJordan K. Hubbard 7703060874SJordan K. Hubbard #define NL_SETD 0 783f5fb481SAndrey A. Chernov #define NL_CAT_LOCALE 1 7903060874SJordan K. Hubbard 8054de7444SAlexey Zelkin typedef struct __nl_cat_d { 8154de7444SAlexey Zelkin void *__data; 8254de7444SAlexey Zelkin int __size; 8354de7444SAlexey Zelkin } *nl_catd; 84be6180cfSMike Barcroft 85f4a1f909SMike Barcroft #ifndef _NL_ITEM_DECLARED 86f4a1f909SMike Barcroft typedef __nl_item nl_item; 87f4a1f909SMike Barcroft #define _NL_ITEM_DECLARED 88f4a1f909SMike Barcroft #endif 89f4a1f909SMike Barcroft 90da8f43d1SJordan K. Hubbard __BEGIN_DECLS 9154de7444SAlexey Zelkin nl_catd catopen(const char *, int); 923acb8d3fSStefan Farfeleder char *catgets(nl_catd, int, int, const char *) __format_arg(4); 93be6180cfSMike Barcroft int catclose(nl_catd); 94da8f43d1SJordan K. Hubbard __END_DECLS 9503060874SJordan K. Hubbard 9654de7444SAlexey Zelkin #endif /* _NL_TYPES_H_ */ 97