xref: /netbsd-src/external/gpl2/grep/grep2netbsd (revision 5b28f239895d55856221c590945769250e289f5f)
1fb69a85aSchristos#! /bin/sh
2fb69a85aSchristos#
3*5b28f239Srillig#	$NetBSD: grep2netbsd,v 1.3 2024/09/08 09:36:46 rillig Exp $
4fb69a85aSchristos#
5fb69a85aSchristos# Copyright (c) 2003 The NetBSD Foundation, Inc.
6fb69a85aSchristos# All rights reserved.
7fb69a85aSchristos#
8fb69a85aSchristos# Redistribution and use in source and binary forms, with or without
9fb69a85aSchristos# modification, are permitted provided that the following conditions
10fb69a85aSchristos# are met:
11fb69a85aSchristos# 1. Redistributions of source code must retain the above copyright
12fb69a85aSchristos#    notice, this list of conditions and the following disclaimer.
13fb69a85aSchristos# 2. Redistributions in binary form must reproduce the above copyright
14fb69a85aSchristos#    notice, this list of conditions and the following disclaimer in the
15fb69a85aSchristos#    documentation and/or other materials provided with the distribution.
16fb69a85aSchristos#
17fb69a85aSchristos# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18fb69a85aSchristos# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19fb69a85aSchristos# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20fb69a85aSchristos# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21fb69a85aSchristos# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22fb69a85aSchristos# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23fb69a85aSchristos# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24fb69a85aSchristos# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25fb69a85aSchristos# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26fb69a85aSchristos# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27fb69a85aSchristos# POSSIBILITY OF SUCH DAMAGE.
28fb69a85aSchristos#
29*5b28f239Srillig# grep2netbsd:  convert a grep source tree into a
30fb69a85aSchristos# format suitable for commit.  Works on current dir.
31fb69a85aSchristos#
32fb69a85aSchristos
33fb69a85aSchristos# delete some superfluous files
34fb69a85aSchristosecho deleting some superfluous files
35fb69a85aSchristosrm -rf bootstrap djgpp m4 tests vms autom4te-2.53.cache
36fb69a85aSchristosfind . -type f -name .cvsignore -exec rm {} \;
37fb69a85aSchristos
38fb69a85aSchristosecho done
39fb69a85aSchristos
40fb69a85aSchristos### Remove the $'s around RCS tags
41fb69a85aSchristoscleantags .
42fb69a85aSchristos
43fb69a85aSchristos### Add our NetBSD RCS Id
44fb69a85aSchristosfind . -type f -name '*.[chly]' -print | while read c; do
45fb69a85aSchristos	sed 1q < $c | grep -q '\$NetBSD' || (
46fb69a85aSchristosecho "/*	\$NetBSD\$	*/" >/tmp/grep3$$
47fb69a85aSchristosecho "" >>/tmp/grep3$$
48fb69a85aSchristoscat $c  >> /tmp/grep3$$
49fb69a85aSchristosmv /tmp/grep3$$ $c && echo added NetBSD RCS tag to $c
50fb69a85aSchristos	)
51fb69a85aSchristosdone
52fb69a85aSchristos
53fb69a85aSchristosfind . -type f -name '*.[0-9]' -print | while read m; do
54fb69a85aSchristos	sed 1q < $m | grep -q '\$NetBSD' || (
55fb69a85aSchristosecho ".\\\"	\$NetBSD\$" >/tmp/grep4$$
56fb69a85aSchristosecho ".\\\"" >>/tmp/grep4$$
57fb69a85aSchristoscat $m >> /tmp/grep4$$
58fb69a85aSchristosmv /tmp/grep4$$ $m && echo added NetBSD RCS tag to $m
59fb69a85aSchristos	)
60fb69a85aSchristosdone
61fb69a85aSchristos
62fb69a85aSchristosfind . -type f -name '*.texi' -print | while read t; do
63fb69a85aSchristos        sed "2 s/^/@c \$NetBSD\$\\
64fb69a85aSchristos/" < $t > /tmp/grep5$$
65fb69a85aSchristos	mv /tmp/grep5$$ $t && echo added NetBSD RCS tag to $t
66fb69a85aSchristosdone
67fb69a85aSchristos
68fb69a85aSchristosecho done
69fb69a85aSchristos
70fb69a85aSchristoscat << EOF
71fb69a85aSchristosTo import:
72fb69a85aSchristoscvs -d cvs.netbsd.org:/cvsroot import src/external/gpl2/grep/dist FSF grep-X-Y
73d571953cSchristos
74d571953cSchristosThen run configure, make, merge the config.h file and the gmo files in the po
75d571953cSchristosdir.
76fb69a85aSchristosEOF
77fb69a85aSchristosexit 0
78