17c478bd9Sstevel@tonic-gate#!/bin/sh
27c478bd9Sstevel@tonic-gate#
37c478bd9Sstevel@tonic-gate# CDDL HEADER START
47c478bd9Sstevel@tonic-gate#
57c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
67c478bd9Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only
77c478bd9Sstevel@tonic-gate# (the "License").  You may not use this file except in compliance
87c478bd9Sstevel@tonic-gate# with the License.
97c478bd9Sstevel@tonic-gate#
107c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
117c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
127c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
137c478bd9Sstevel@tonic-gate# and limitations under the License.
147c478bd9Sstevel@tonic-gate#
157c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
167c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
177c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
187c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
197c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
207c478bd9Sstevel@tonic-gate#
217c478bd9Sstevel@tonic-gate# CDDL HEADER END
227c478bd9Sstevel@tonic-gate#
237c478bd9Sstevel@tonic-gate#
247c478bd9Sstevel@tonic-gate# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
257c478bd9Sstevel@tonic-gate# Use is subject to license terms.
267c478bd9Sstevel@tonic-gate#
270e8139c7SGarrett D'Amore
280e8139c7SGarrett D'Amore#
290e8139c7SGarrett D'Amore# Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
300e8139c7SGarrett D'Amore#
317c478bd9Sstevel@tonic-gate
327c478bd9Sstevel@tonic-gateXGETTEXT=xgettext
337c478bd9Sstevel@tonic-gateMSGDIR=$1
347c478bd9Sstevel@tonic-gate
357c478bd9Sstevel@tonic-gate#
367c478bd9Sstevel@tonic-gate# Change Directory
377c478bd9Sstevel@tonic-gate#
387c478bd9Sstevel@tonic-gate	cd ./port/gen
397c478bd9Sstevel@tonic-gate	rm -f *.po
407c478bd9Sstevel@tonic-gate
417c478bd9Sstevel@tonic-gate#
427c478bd9Sstevel@tonic-gate#	get list of files
437c478bd9Sstevel@tonic-gate#
447c478bd9Sstevel@tonic-gateFILES=`grep gettext *.c | sed "s/:.*//" | sort | sed "s/\.c//" | uniq`
457c478bd9Sstevel@tonic-gate
467c478bd9Sstevel@tonic-gate
477c478bd9Sstevel@tonic-gate#
487c478bd9Sstevel@tonic-gate#	Create po files
497c478bd9Sstevel@tonic-gate#		No need for options for xgettext
507c478bd9Sstevel@tonic-gate#
517c478bd9Sstevel@tonic-gatefor	i in ${FILES}
527c478bd9Sstevel@tonic-gatedo
537c478bd9Sstevel@tonic-gate	cat ${i}.c | sed "s/_libc_gettext/gettext/" > ${i}.i
547c478bd9Sstevel@tonic-gate	${XGETTEXT} ${i}.i
557c478bd9Sstevel@tonic-gate	cat messages.po | sed "/^domain/d" > ${i}.po
567c478bd9Sstevel@tonic-gate	rm -f ${i}.i messages.po
577c478bd9Sstevel@tonic-gatedone
587c478bd9Sstevel@tonic-gate
597c478bd9Sstevel@tonic-gate#
607c478bd9Sstevel@tonic-gate#	Create po files
617c478bd9Sstevel@tonic-gate#		Use -a
627c478bd9Sstevel@tonic-gate#
637c478bd9Sstevel@tonic-gate
647c478bd9Sstevel@tonic-gate# First, create errlst.c, if it doesn't exist.
657c478bd9Sstevel@tonic-gate# new_list.c is created as a side effect
667c478bd9Sstevel@tonic-gateif [ ! -f errlst.c ]; then
677c478bd9Sstevel@tonic-gate	awk -f errlist.awk errlist
687c478bd9Sstevel@tonic-gate	rmerr="errlst.c new_list.c"
697c478bd9Sstevel@tonic-gateelse
707c478bd9Sstevel@tonic-gate	rmerr=
717c478bd9Sstevel@tonic-gatefi
727c478bd9Sstevel@tonic-gate
737c478bd9Sstevel@tonic-gatefor	i in siglist errlst
747c478bd9Sstevel@tonic-gatedo
757c478bd9Sstevel@tonic-gate	cat ${i}.c | sed "s/_libc_gettext/gettext/" > ${i}.i
767c478bd9Sstevel@tonic-gate	${XGETTEXT} -a  ${i}.i
777c478bd9Sstevel@tonic-gate	cat messages.po | sed "/^domain/d" > ${i}.po
787c478bd9Sstevel@tonic-gate	rm -f ${i}.i messages.po
797c478bd9Sstevel@tonic-gatedone
807c478bd9Sstevel@tonic-gate
817c478bd9Sstevel@tonic-gate#
827c478bd9Sstevel@tonic-gate# 	Copy .po files
837c478bd9Sstevel@tonic-gate#
847c478bd9Sstevel@tonic-gate	cp *.po		${MSGDIR}
857c478bd9Sstevel@tonic-gate
867c478bd9Sstevel@tonic-gate#
877c478bd9Sstevel@tonic-gate#	And remove them
887c478bd9Sstevel@tonic-gate#
897c478bd9Sstevel@tonic-gate	rm -f *.po ${rmerr}
907c478bd9Sstevel@tonic-gate
917c478bd9Sstevel@tonic-gate#
927c478bd9Sstevel@tonic-gate# Change Directory
937c478bd9Sstevel@tonic-gate#
94*1d8d40bdSYuri Pankov	cd ../regex
950e8139c7SGarrett D'Amore	rm -f messages.po regerror.po
967c478bd9Sstevel@tonic-gate
970e8139c7SGarrett D'Amore	${XGETTEXT} -a regerror.c
980e8139c7SGarrett D'Amore	cat messages.po | sed "/^domain/d" > regerror.po
990e8139c7SGarrett D'Amore	rm -f regerror.i messages.po
1007c478bd9Sstevel@tonic-gate
1017c478bd9Sstevel@tonic-gate#
1027c478bd9Sstevel@tonic-gate# Copy .po file
1037c478bd9Sstevel@tonic-gate#
1040e8139c7SGarrett D'Amore	cp regerror.po ${MSGDIR}
1057c478bd9Sstevel@tonic-gate
1067c478bd9Sstevel@tonic-gate# And remove it
1077c478bd9Sstevel@tonic-gate
1080e8139c7SGarrett D'Amore	rm -f regerror.po
109