xref: /titanic_41/usr/src/lib/libc/makelibccatalog.sh (revision 4496171313bed39e96f21bc2f9faf2868e267ae3)
1#!/bin/sh
2#
3# CDDL HEADER START
4#
5# The contents of this file are subject to the terms of the
6# Common Development and Distribution License, Version 1.0 only
7# (the "License").  You may not use this file except in compliance
8# with the License.
9#
10# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11# or http://www.opensolaris.org/os/licensing.
12# See the License for the specific language governing permissions
13# and limitations under the License.
14#
15# When distributing Covered Code, include this CDDL HEADER in each
16# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17# If applicable, add the following below this CDDL HEADER, with the
18# fields enclosed by brackets "[]" replaced with your own identifying
19# information: Portions Copyright [yyyy] [name of copyright owner]
20#
21# CDDL HEADER END
22#
23#
24# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
25# Use is subject to license terms.
26#
27# ident	"%Z%%M%	%I%	%E% SMI"
28
29XGETTEXT=xgettext
30MSGDIR=$1
31
32#
33# Change Directory
34#
35	cd ./port/gen
36	rm -f *.po
37
38#
39#	get list of files
40#
41FILES=`grep gettext *.c | sed "s/:.*//" | sort | sed "s/\.c//" | uniq`
42
43
44#
45#	Create po files
46#		No need for options for xgettext
47#
48for	i in ${FILES}
49do
50	cat ${i}.c | sed "s/_libc_gettext/gettext/" > ${i}.i
51	${XGETTEXT} ${i}.i
52	cat messages.po | sed "/^domain/d" > ${i}.po
53	rm -f ${i}.i messages.po
54done
55
56#
57#	Create po files
58#		Use -a
59#
60
61# First, create errlst.c, if it doesn't exist.
62# new_list.c is created as a side effect
63if [ ! -f errlst.c ]; then
64	awk -f errlist.awk errlist
65	rmerr="errlst.c new_list.c"
66else
67	rmerr=
68fi
69
70for	i in siglist errlst
71do
72	cat ${i}.c | sed "s/_libc_gettext/gettext/" > ${i}.i
73	${XGETTEXT} -a  ${i}.i
74	cat messages.po | sed "/^domain/d" > ${i}.po
75	rm -f ${i}.i messages.po
76done
77
78#
79# 	Copy .po files
80#
81	cp *.po		${MSGDIR}
82
83#
84#	And remove them
85#
86	rm -f *.po ${rmerr}
87
88#
89# Change Directory
90#
91	cd ../i18n
92	rm -f messages.po regerror_msg.po
93
94#
95# regerror_msg.h
96#
97
98sed "s/_MSG/gettext/" regerror_msg.h > regerror_msg.i
99${XGETTEXT} regerror_msg.i
100cat messages.po | sed "/^domain/d" > regerror_msg.po
101rm -f regerror_msg.i messages.po
102
103#
104# Copy .po file
105#
106	cp regerror_msg.po ${MSGDIR}
107
108# And remove it
109
110	rm -f regerror_msg.po
111