xref: /illumos-gate/usr/src/cmd/msgfmt/common.h (revision 6e6545bfaed3bab9ce836ee82d1abd8f2edba89a)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 2001 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef	_COMMON_H
28 #define	_COMMON_H
29 
30 #include <stdio.h>
31 #include <string.h>
32 #include <stdarg.h>
33 #include <libintl.h>
34 #include <stdlib.h>
35 
36 #ifdef	__cplusplus
37 extern "C" {
38 #endif
39 
40 /* implementation dependent default domain name */
41 #define	DEFAULT_DOMAIN	"messages"
42 #define	DEFAULT_DOMAIN_MO	"messages.mo"
43 
44 #define	ERR_ERROR \
45 	"ERROR: "
46 
47 #define	WARN_WARNING \
48 	"WARNING: "
49 
50 #define	ERR_MALLOC \
51 	"failed to allocate memory\n"
52 
53 #define	ERR_OPEN_FAILED \
54 	"Cannot open file %s.\n"
55 
56 #define	ERR_READ_FAILED \
57 	"Error in reading %s.\n"
58 
59 #define	DIAG_START_PROC \
60 	"Processing file \"%s\"...\n"
61 
62 struct flags {
63 	char	*idir;
64 	char	*ofile;
65 	int	fuzzy;
66 	int	verbose;
67 	int	strict;
68 	int	gnu_p;
69 	int	sun_p;
70 };
71 
72 extern int	parse_option(int *, char ***, struct flags *);
73 
74 extern void	error(char *, ...) __NORETURN;
75 extern void	warning(char *, ...);
76 extern void	diag(char *, ...);
77 extern void *Xmalloc(size_t);
78 extern void *Xcalloc(size_t, size_t);
79 extern void *Xrealloc(void *, size_t);
80 extern char *Xstrdup(const char *);
81 
82 #ifdef	__cplusplus
83 }
84 #endif
85 
86 #endif	/* _COMMON_H */
87