xref: /titanic_50/usr/src/cmd/msgfmt/common.h (revision 0a0e9771ca0211c15f3ac4466b661c145feeb9e4)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <stdio.h>
33 #include <string.h>
34 #include <stdarg.h>
35 #include <libintl.h>
36 #include <stdlib.h>
37 
38 #ifdef	__cplusplus
39 extern "C" {
40 #endif
41 
42 /* implementation dependent default domain name */
43 #define	DEFAULT_DOMAIN	"messages"
44 #define	DEFAULT_DOMAIN_MO	"messages.mo"
45 
46 #define	ERR_ERROR \
47 	"ERROR: "
48 
49 #define	WARN_WARNING \
50 	"WARNING: "
51 
52 #define	ERR_MALLOC \
53 	"failed to allocate memory\n"
54 
55 #define	ERR_OPEN_FAILED \
56 	"Cannot open file %s.\n"
57 
58 #define	ERR_READ_FAILED \
59 	"Error in reading %s.\n"
60 
61 #define	DIAG_START_PROC \
62 	"Processing file \"%s\"...\n"
63 
64 struct flags {
65 	char	*idir;
66 	char	*ofile;
67 	int	fuzzy;
68 	int	verbose;
69 	int	strict;
70 	int	gnu_p;
71 	int	sun_p;
72 };
73 
74 extern int	parse_option(int *, char ***, struct flags *);
75 
76 extern void	error(char *, ...);
77 extern void	warning(char *, ...);
78 extern void	diag(char *, ...);
79 extern void *Xmalloc(size_t);
80 extern void *Xcalloc(size_t, size_t);
81 extern void *Xrealloc(void *, size_t);
82 extern char *Xstrdup(const char *);
83 
84 #ifdef	__cplusplus
85 }
86 #endif
87 
88 #endif	/* _COMMON_H */
89