xref: /illumos-gate/usr/src/cmd/msgfmt/check_header.c (revision 2a8bcb4e)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright (c) 2001 by Sun Microsystems, Inc.
24*7c478bd9Sstevel@tonic-gate  * All rights reserved.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #include "sun_msgfmt.h"
28*7c478bd9Sstevel@tonic-gate 
29*7c478bd9Sstevel@tonic-gate static const char	*mandatory_fields[] = {
30*7c478bd9Sstevel@tonic-gate 	"Project-Id-Version",
31*7c478bd9Sstevel@tonic-gate 	"PO-Revision-Date",
32*7c478bd9Sstevel@tonic-gate 	"Last-Translator",
33*7c478bd9Sstevel@tonic-gate 	"Language-Team",
34*7c478bd9Sstevel@tonic-gate 	"Content-Type",
35*7c478bd9Sstevel@tonic-gate 	"Content-Transfer-Encoding",
36*7c478bd9Sstevel@tonic-gate 	NULL
37*7c478bd9Sstevel@tonic-gate };
38*7c478bd9Sstevel@tonic-gate 
39*7c478bd9Sstevel@tonic-gate static const char	*mandatory_fields_new[] = {
40*7c478bd9Sstevel@tonic-gate 	"POT-Creation-Date",
41*7c478bd9Sstevel@tonic-gate 	"Plural-Forms",
42*7c478bd9Sstevel@tonic-gate 	NULL
43*7c478bd9Sstevel@tonic-gate };
44*7c478bd9Sstevel@tonic-gate 
45*7c478bd9Sstevel@tonic-gate extern int	verbose;
46*7c478bd9Sstevel@tonic-gate 
47*7c478bd9Sstevel@tonic-gate extern void	invoke_gnu_msgfmt(void);
48*7c478bd9Sstevel@tonic-gate 
49*7c478bd9Sstevel@tonic-gate static size_t
get_one_line(char ** bufhead,char ** mbuf,size_t * fsize)50*7c478bd9Sstevel@tonic-gate get_one_line(char **bufhead, char **mbuf, size_t *fsize)
51*7c478bd9Sstevel@tonic-gate {
52*7c478bd9Sstevel@tonic-gate 	size_t	len;
53*7c478bd9Sstevel@tonic-gate 	char	*p = *mbuf;
54*7c478bd9Sstevel@tonic-gate 	char	*q, *tmp;
55*7c478bd9Sstevel@tonic-gate 
56*7c478bd9Sstevel@tonic-gate 	if (*bufhead) {
57*7c478bd9Sstevel@tonic-gate 		free(*bufhead);
58*7c478bd9Sstevel@tonic-gate 		*bufhead = NULL;
59*7c478bd9Sstevel@tonic-gate 	}
60*7c478bd9Sstevel@tonic-gate 
61*7c478bd9Sstevel@tonic-gate 	if (*fsize == 0) {
62*7c478bd9Sstevel@tonic-gate 		/* eof */
63*7c478bd9Sstevel@tonic-gate 		return (0);
64*7c478bd9Sstevel@tonic-gate 	}
65*7c478bd9Sstevel@tonic-gate 
66*7c478bd9Sstevel@tonic-gate 	q = p;
67*7c478bd9Sstevel@tonic-gate 	while (((*fsize) != 0) && (*p++ != '\n')) {
68*7c478bd9Sstevel@tonic-gate 		(*fsize)--;
69*7c478bd9Sstevel@tonic-gate 	}
70*7c478bd9Sstevel@tonic-gate 	len = p - q;
71*7c478bd9Sstevel@tonic-gate 	if (len == 0) {
72*7c478bd9Sstevel@tonic-gate 		return (0);
73*7c478bd9Sstevel@tonic-gate 	}
74*7c478bd9Sstevel@tonic-gate 	tmp = (char *)Xmalloc(len + 1);
75*7c478bd9Sstevel@tonic-gate 	(void) memcpy(tmp, q, len);
76*7c478bd9Sstevel@tonic-gate 	tmp[len] = '\0';
77*7c478bd9Sstevel@tonic-gate 	*bufhead = tmp;
78*7c478bd9Sstevel@tonic-gate 	*mbuf = p;
79*7c478bd9Sstevel@tonic-gate 	return (len);
80*7c478bd9Sstevel@tonic-gate }
81*7c478bd9Sstevel@tonic-gate 
82*7c478bd9Sstevel@tonic-gate void
check_gnu(char * addr,size_t fsize)83*7c478bd9Sstevel@tonic-gate check_gnu(char *addr, size_t fsize)
84*7c478bd9Sstevel@tonic-gate {
85*7c478bd9Sstevel@tonic-gate 	int	i;
86*7c478bd9Sstevel@tonic-gate 	char	c, mc;
87*7c478bd9Sstevel@tonic-gate 	char	*linebuf;
88*7c478bd9Sstevel@tonic-gate 	char	*mbuf, *p, *buf;
89*7c478bd9Sstevel@tonic-gate 	unsigned int	n;
90*7c478bd9Sstevel@tonic-gate 	size_t	ln_size;
91*7c478bd9Sstevel@tonic-gate 	size_t	bufsize, index;
92*7c478bd9Sstevel@tonic-gate 	size_t	size = fsize;
93*7c478bd9Sstevel@tonic-gate 	int	quotefound = 0;
94*7c478bd9Sstevel@tonic-gate 	const char	*field;
95*7c478bd9Sstevel@tonic-gate 
96*7c478bd9Sstevel@tonic-gate 	buf = NULL;
97*7c478bd9Sstevel@tonic-gate 	linebuf = NULL;
98*7c478bd9Sstevel@tonic-gate 	mbuf = addr;
99*7c478bd9Sstevel@tonic-gate 
100*7c478bd9Sstevel@tonic-gate loop:
101*7c478bd9Sstevel@tonic-gate 	ln_size = get_one_line(&linebuf, &mbuf, &size);
102*7c478bd9Sstevel@tonic-gate 	if ((ln_size == (size_t)-1) ||
103*7c478bd9Sstevel@tonic-gate 		(ln_size == 0)) {
104*7c478bd9Sstevel@tonic-gate 		goto no_gnu;
105*7c478bd9Sstevel@tonic-gate 	}
106*7c478bd9Sstevel@tonic-gate 	p = linebuf;
107*7c478bd9Sstevel@tonic-gate 
108*7c478bd9Sstevel@tonic-gate 	while ((*p == '#') || (*p == '\n')) {
109*7c478bd9Sstevel@tonic-gate 		ln_size = get_one_line(&linebuf, &mbuf, &size);
110*7c478bd9Sstevel@tonic-gate 		if ((ln_size == (size_t)-1) ||
111*7c478bd9Sstevel@tonic-gate 			(ln_size == 0)) {
112*7c478bd9Sstevel@tonic-gate 			goto no_gnu;
113*7c478bd9Sstevel@tonic-gate 		}
114*7c478bd9Sstevel@tonic-gate 		p = linebuf;
115*7c478bd9Sstevel@tonic-gate 	}
116*7c478bd9Sstevel@tonic-gate 
117*7c478bd9Sstevel@tonic-gate 	if (strncmp(p, "domain", 6) == 0)
118*7c478bd9Sstevel@tonic-gate 		goto loop;
119*7c478bd9Sstevel@tonic-gate 
120*7c478bd9Sstevel@tonic-gate 	if (strncmp(p, "msgid", 5) != 0) {
121*7c478bd9Sstevel@tonic-gate 		/* error */
122*7c478bd9Sstevel@tonic-gate 		goto no_gnu;
123*7c478bd9Sstevel@tonic-gate 	}
124*7c478bd9Sstevel@tonic-gate 
125*7c478bd9Sstevel@tonic-gate 	p += 5;
126*7c478bd9Sstevel@tonic-gate 	if ((*p != ' ') && (*p != '\t') &&
127*7c478bd9Sstevel@tonic-gate 		(*p != '\n') && (*p != '\0')) {
128*7c478bd9Sstevel@tonic-gate 		/* no space after msgid */
129*7c478bd9Sstevel@tonic-gate 		goto no_gnu;
130*7c478bd9Sstevel@tonic-gate 	}
131*7c478bd9Sstevel@tonic-gate 	/* skip spaces */
132*7c478bd9Sstevel@tonic-gate 	while ((*p == ' ') || (*p == '\t'))
133*7c478bd9Sstevel@tonic-gate 		p++;
134*7c478bd9Sstevel@tonic-gate 
135*7c478bd9Sstevel@tonic-gate 	/* check if this entry is an empty string */
136*7c478bd9Sstevel@tonic-gate 	if ((*p != '\"') || (*(p + 1) != '\"')) {
137*7c478bd9Sstevel@tonic-gate 		/* this is not an empty string */
138*7c478bd9Sstevel@tonic-gate 		goto no_gnu;
139*7c478bd9Sstevel@tonic-gate 	}
140*7c478bd9Sstevel@tonic-gate 	p += 2;
141*7c478bd9Sstevel@tonic-gate 	while (*p && ((*p == ' ') || (*p == '\t'))) {
142*7c478bd9Sstevel@tonic-gate 		p++;
143*7c478bd9Sstevel@tonic-gate 	}
144*7c478bd9Sstevel@tonic-gate 	if ((*p != '\n') && (*p != '\0')) {
145*7c478bd9Sstevel@tonic-gate 		/* other characters than '\n' and '\0' found */
146*7c478bd9Sstevel@tonic-gate 		goto no_gnu;
147*7c478bd9Sstevel@tonic-gate 	}
148*7c478bd9Sstevel@tonic-gate 
149*7c478bd9Sstevel@tonic-gate 	for (; ; ) {
150*7c478bd9Sstevel@tonic-gate 		ln_size = get_one_line(&linebuf, &mbuf, &size);
151*7c478bd9Sstevel@tonic-gate 		if ((ln_size == (size_t)-1) ||
152*7c478bd9Sstevel@tonic-gate 			(ln_size == 0)) {
153*7c478bd9Sstevel@tonic-gate 			goto no_gnu;
154*7c478bd9Sstevel@tonic-gate 		}
155*7c478bd9Sstevel@tonic-gate 		p = linebuf;
156*7c478bd9Sstevel@tonic-gate 		/* skip leading spaces */
157*7c478bd9Sstevel@tonic-gate 		while ((*p == ' ') || (*p == '\t'))
158*7c478bd9Sstevel@tonic-gate 			p++;
159*7c478bd9Sstevel@tonic-gate 
160*7c478bd9Sstevel@tonic-gate 		if (*p != '\"') {
161*7c478bd9Sstevel@tonic-gate 			if (strncmp(p, "msgstr", 6) == 0) {
162*7c478bd9Sstevel@tonic-gate 				break;
163*7c478bd9Sstevel@tonic-gate 			}
164*7c478bd9Sstevel@tonic-gate 			/* not a valid entry */
165*7c478bd9Sstevel@tonic-gate 			goto no_gnu;
166*7c478bd9Sstevel@tonic-gate 		}
167*7c478bd9Sstevel@tonic-gate 		if (*(p + 1) != '\"') {
168*7c478bd9Sstevel@tonic-gate 			/* not an empty string */
169*7c478bd9Sstevel@tonic-gate 			goto no_gnu;
170*7c478bd9Sstevel@tonic-gate 		}
171*7c478bd9Sstevel@tonic-gate 		p += 2;
172*7c478bd9Sstevel@tonic-gate 		while ((*p == ' ') || (*p == '\t'))
173*7c478bd9Sstevel@tonic-gate 			p++;
174*7c478bd9Sstevel@tonic-gate 
175*7c478bd9Sstevel@tonic-gate 		if ((*p != '\n') && (*p != '\0')) {
176*7c478bd9Sstevel@tonic-gate 			/* other characters than '\n' and '\0' found */
177*7c478bd9Sstevel@tonic-gate 			goto no_gnu;
178*7c478bd9Sstevel@tonic-gate 		}
179*7c478bd9Sstevel@tonic-gate 	}
180*7c478bd9Sstevel@tonic-gate 
181*7c478bd9Sstevel@tonic-gate 	/*
182*7c478bd9Sstevel@tonic-gate 	 * msgid for the header entry found
183*7c478bd9Sstevel@tonic-gate 	 * Now p points to "msgstr"
184*7c478bd9Sstevel@tonic-gate 	 */
185*7c478bd9Sstevel@tonic-gate 	p += 6;
186*7c478bd9Sstevel@tonic-gate 	if ((*p != ' ') && (*p != '\t') &&
187*7c478bd9Sstevel@tonic-gate 		(*p != '\n') && (*p != '\0')) {
188*7c478bd9Sstevel@tonic-gate 		/* no space after msgid */
189*7c478bd9Sstevel@tonic-gate 		goto no_gnu;
190*7c478bd9Sstevel@tonic-gate 	}
191*7c478bd9Sstevel@tonic-gate 
192*7c478bd9Sstevel@tonic-gate 	/* skip spaces */
193*7c478bd9Sstevel@tonic-gate 	while ((*p == ' ') || (*p == '\t'))
194*7c478bd9Sstevel@tonic-gate 		p++;
195*7c478bd9Sstevel@tonic-gate 
196*7c478bd9Sstevel@tonic-gate 	if (*p != '\"') {
197*7c478bd9Sstevel@tonic-gate 		/* no quote */
198*7c478bd9Sstevel@tonic-gate 		goto no_gnu;
199*7c478bd9Sstevel@tonic-gate 	}
200*7c478bd9Sstevel@tonic-gate 
201*7c478bd9Sstevel@tonic-gate 	bufsize = ln_size + 1;
202*7c478bd9Sstevel@tonic-gate 	index = 0;
203*7c478bd9Sstevel@tonic-gate 	buf = (char *)Xmalloc(bufsize);
204*7c478bd9Sstevel@tonic-gate 
205*7c478bd9Sstevel@tonic-gate 	for (; ; ) {
206*7c478bd9Sstevel@tonic-gate 		if (*p != '\"') {
207*7c478bd9Sstevel@tonic-gate 			/* msgstr entry ends */
208*7c478bd9Sstevel@tonic-gate 			buf[index] = '\0';
209*7c478bd9Sstevel@tonic-gate 			break;
210*7c478bd9Sstevel@tonic-gate 		}
211*7c478bd9Sstevel@tonic-gate 
212*7c478bd9Sstevel@tonic-gate 		if (*p++ != '\"') {
213*7c478bd9Sstevel@tonic-gate 			/* no beginning quote */
214*7c478bd9Sstevel@tonic-gate 			goto no_gnu;
215*7c478bd9Sstevel@tonic-gate 		}
216*7c478bd9Sstevel@tonic-gate 		while (*p) {
217*7c478bd9Sstevel@tonic-gate 			switch (mc = *p++) {
218*7c478bd9Sstevel@tonic-gate 			case '\n':
219*7c478bd9Sstevel@tonic-gate 				if (!quotefound) {
220*7c478bd9Sstevel@tonic-gate 					/* error */
221*7c478bd9Sstevel@tonic-gate 					goto no_gnu;
222*7c478bd9Sstevel@tonic-gate 				}
223*7c478bd9Sstevel@tonic-gate 				break;
224*7c478bd9Sstevel@tonic-gate 			case '\"':
225*7c478bd9Sstevel@tonic-gate 				quotefound = 1;
226*7c478bd9Sstevel@tonic-gate 				break;
227*7c478bd9Sstevel@tonic-gate 			case '\\':
228*7c478bd9Sstevel@tonic-gate 				if (!*p)
229*7c478bd9Sstevel@tonic-gate 					break;
230*7c478bd9Sstevel@tonic-gate 				switch (c = *p++) {
231*7c478bd9Sstevel@tonic-gate 				case 'b':
232*7c478bd9Sstevel@tonic-gate 					buf[index++] = '\b';
233*7c478bd9Sstevel@tonic-gate 					break;
234*7c478bd9Sstevel@tonic-gate 				case 'f':
235*7c478bd9Sstevel@tonic-gate 					buf[index++] = '\f';
236*7c478bd9Sstevel@tonic-gate 					break;
237*7c478bd9Sstevel@tonic-gate 				case 'n':
238*7c478bd9Sstevel@tonic-gate 					buf[index++] = '\n';
239*7c478bd9Sstevel@tonic-gate 					break;
240*7c478bd9Sstevel@tonic-gate 				case 'r':
241*7c478bd9Sstevel@tonic-gate 					buf[index++] = '\r';
242*7c478bd9Sstevel@tonic-gate 					break;
243*7c478bd9Sstevel@tonic-gate 				case 't':
244*7c478bd9Sstevel@tonic-gate 					buf[index++] = '\t';
245*7c478bd9Sstevel@tonic-gate 					break;
246*7c478bd9Sstevel@tonic-gate 				case 'v':
247*7c478bd9Sstevel@tonic-gate 					buf[index++] = '\v';
248*7c478bd9Sstevel@tonic-gate 					break;
249*7c478bd9Sstevel@tonic-gate 				case 'a':
250*7c478bd9Sstevel@tonic-gate 					buf[index++] = '\a';
251*7c478bd9Sstevel@tonic-gate 					break;
252*7c478bd9Sstevel@tonic-gate 				case '\"':
253*7c478bd9Sstevel@tonic-gate 				case '\\':
254*7c478bd9Sstevel@tonic-gate 				case '\'':
255*7c478bd9Sstevel@tonic-gate 				case '?':
256*7c478bd9Sstevel@tonic-gate 					buf[index++] = c;
257*7c478bd9Sstevel@tonic-gate 					break;
258*7c478bd9Sstevel@tonic-gate 				default:
259*7c478bd9Sstevel@tonic-gate 					if (isdigit((unsigned char)c)) {
260*7c478bd9Sstevel@tonic-gate 						unsigned int	x;
261*7c478bd9Sstevel@tonic-gate 						unsigned char	*up =
262*7c478bd9Sstevel@tonic-gate 							(unsigned char *)p;
263*7c478bd9Sstevel@tonic-gate 						n = c - '0';
264*7c478bd9Sstevel@tonic-gate 						if (isdigit(*up)) {
265*7c478bd9Sstevel@tonic-gate 							x = *up++ - '0';
266*7c478bd9Sstevel@tonic-gate 							n = 8 * n + x;
267*7c478bd9Sstevel@tonic-gate 							if (isdigit(*up)) {
268*7c478bd9Sstevel@tonic-gate 								x = *up++ - '0';
269*7c478bd9Sstevel@tonic-gate 								n = 8 * n + x;
270*7c478bd9Sstevel@tonic-gate 							}
271*7c478bd9Sstevel@tonic-gate 						}
272*7c478bd9Sstevel@tonic-gate 						p = (char *)up;
273*7c478bd9Sstevel@tonic-gate 						buf[index++] = n;
274*7c478bd9Sstevel@tonic-gate 					}
275*7c478bd9Sstevel@tonic-gate 					break;
276*7c478bd9Sstevel@tonic-gate 				}
277*7c478bd9Sstevel@tonic-gate 				break;
278*7c478bd9Sstevel@tonic-gate 			default:
279*7c478bd9Sstevel@tonic-gate 				buf[index++] = mc;
280*7c478bd9Sstevel@tonic-gate 				break;
281*7c478bd9Sstevel@tonic-gate 			}
282*7c478bd9Sstevel@tonic-gate 			if (quotefound) {
283*7c478bd9Sstevel@tonic-gate 				while (*p && ((*p == ' ') || (*p == '\t'))) {
284*7c478bd9Sstevel@tonic-gate 					p++;
285*7c478bd9Sstevel@tonic-gate 				}
286*7c478bd9Sstevel@tonic-gate 				if ((*p != '\n') && (*p != '\0')) {
287*7c478bd9Sstevel@tonic-gate 					goto no_gnu;
288*7c478bd9Sstevel@tonic-gate 				}
289*7c478bd9Sstevel@tonic-gate 				quotefound = 0;
290*7c478bd9Sstevel@tonic-gate 				break;
291*7c478bd9Sstevel@tonic-gate 			}
292*7c478bd9Sstevel@tonic-gate 		}
293*7c478bd9Sstevel@tonic-gate 		ln_size = get_one_line(&linebuf, &mbuf, &size);
294*7c478bd9Sstevel@tonic-gate 		if ((ln_size == (size_t)-1) ||
295*7c478bd9Sstevel@tonic-gate 			(ln_size == 0)) {
296*7c478bd9Sstevel@tonic-gate 			goto no_gnu;
297*7c478bd9Sstevel@tonic-gate 		}
298*7c478bd9Sstevel@tonic-gate 		p = linebuf;
299*7c478bd9Sstevel@tonic-gate 		/* skip spaces */
300*7c478bd9Sstevel@tonic-gate 		while ((*p == ' ') || (*p == '\t'))
301*7c478bd9Sstevel@tonic-gate 			p++;
302*7c478bd9Sstevel@tonic-gate 		bufsize += ln_size;
303*7c478bd9Sstevel@tonic-gate 		buf = (char *)Xrealloc(buf, bufsize);
304*7c478bd9Sstevel@tonic-gate 	}
305*7c478bd9Sstevel@tonic-gate 
306*7c478bd9Sstevel@tonic-gate 	for (i = 0; (field = mandatory_fields[i]) != NULL; i++) {
307*7c478bd9Sstevel@tonic-gate 		if (strstr(buf, field) == NULL)
308*7c478bd9Sstevel@tonic-gate 			continue;
309*7c478bd9Sstevel@tonic-gate 		/* one of mandatory fields found */
310*7c478bd9Sstevel@tonic-gate 		free(linebuf);
311*7c478bd9Sstevel@tonic-gate 		free(buf);
312*7c478bd9Sstevel@tonic-gate 		(void) munmap(addr, fsize);
313*7c478bd9Sstevel@tonic-gate 		if (verbose)
314*7c478bd9Sstevel@tonic-gate 			diag(gettext(DIAG_GNU_FOUND));
315*7c478bd9Sstevel@tonic-gate 		invoke_gnu_msgfmt();
316*7c478bd9Sstevel@tonic-gate 		/* NOTREACHED */
317*7c478bd9Sstevel@tonic-gate 	}
318*7c478bd9Sstevel@tonic-gate 	for (i = 0; (field = mandatory_fields_new[i]) != NULL; i++) {
319*7c478bd9Sstevel@tonic-gate 		if (strstr(buf, field) == NULL)
320*7c478bd9Sstevel@tonic-gate 			continue;
321*7c478bd9Sstevel@tonic-gate 		/* one of mandatory fields found */
322*7c478bd9Sstevel@tonic-gate 		free(linebuf);
323*7c478bd9Sstevel@tonic-gate 		free(buf);
324*7c478bd9Sstevel@tonic-gate 		(void) munmap(addr, fsize);
325*7c478bd9Sstevel@tonic-gate 		if (verbose)
326*7c478bd9Sstevel@tonic-gate 			diag(gettext(DIAG_GNU_FOUND));
327*7c478bd9Sstevel@tonic-gate 		invoke_gnu_msgfmt();
328*7c478bd9Sstevel@tonic-gate 		/* NOTREACHED */
329*7c478bd9Sstevel@tonic-gate 	}
330*7c478bd9Sstevel@tonic-gate 
331*7c478bd9Sstevel@tonic-gate no_gnu:
332*7c478bd9Sstevel@tonic-gate 	free(linebuf);
333*7c478bd9Sstevel@tonic-gate 	if (buf)
334*7c478bd9Sstevel@tonic-gate 		free(buf);
335*7c478bd9Sstevel@tonic-gate }
336