Drop main() prototype. Syncs with NetBSD-8
[minix.git] / external / bsd / less / less2netbsd
blob22640783d4522bd7e6365a78080c48ec3e938104
1 #!/bin/sh
3 # $NetBSD: less2netbsd,v 1.5 2011/07/03 23:25:01 tron Exp $
5 # Copyright (c) 2011 The NetBSD Foundation, Inc.
6 # All rights reserved.
8 # This code is derived from software contributed to The NetBSD Foundation
9 # by Matthias Scheler.
11 # Redistribution and use in source and binary forms, with or without
12 # modification, are permitted provided that the following conditions
13 # are met:
14 # 1. Redistributions of source code must retain the above copyright
15 # notice, this list of conditions and the following disclaimer.
16 # 2. Redistributions in binary form must reproduce the above copyright
17 # notice, this list of conditions and the following disclaimer in the
18 # documentation and/or other materials provided with the distribution.
20 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 # POSSIBILITY OF SUCH DAMAGE.
33 # less2netbsd:
34 # Prepare a less source tree for import into the NetBSD source repository.
36 PROGNAME=$(basename "$0")
37 if [ $# -ne 1 ]
38 then
39 echo "Usage: $PROGNAME <dir>" >&2
40 exit 1
42 DIRNAME="$1"
44 # Change to the source directory.
45 if [ -d "$DIRNAME" ] && cd "$DIRNAME"
46 then
48 else
49 echo "${PROGNAME}: cannot access directory \"$DIRNAME\"." >&2
50 exit
53 # Check whether the source directory looks sane.
54 CHECK_FILES="LICENSE configure less.h version.c"
55 for FILENAME in $CHECK_FILES
57 if [ ! -f "$FILENAME" ]
58 then
59 echo "${PROGNAME}: less distribution incomplete." >&2
60 exit
62 done
64 # Check whether the "configure" was run.
65 REQUIRED_HEADERS=defines.h
66 for FILENAME in $REQUIRED_HEADERS
68 if [ ! -f "$FILENAME" ]
69 then
70 echo "${PROGNAME}: Please run \"./configure\"." >&2
71 exit
73 done
75 # Fix the permissions.
76 find . -type d -print0 | xargs -0 chmod 755
77 find . -type f -print0 | xargs -0 chmod 644
78 chmod 755 configure
80 # Remove files generated by "configure".
81 REMOVE_FILES="Makefile config.log config.status configure.lineno"
82 rm -f $REMOVE_FILES
84 # Add NetBSD RCS Ids.
85 find . -type f -name "*.[ch]" -print |
86 while read FILENAME
88 if ! grep -q '\$NetBSD' "$FILENAME"
89 then
90 NEW_FILENAME="${FILENAME}.new"
91 rm -f "${NEW_FILENAME}"
92 (echo "/* \$NetBSD\$ */"
93 echo ""
94 cat "$FILENAME") >"${NEW_FILENAME}"
95 mv -f "${NEW_FILENAME}" "$FILENAME"
97 done
99 # Remove formatted manual pages.
100 find . -type f -name "*.man" -delete
102 # Rename unformatted manual pages.
103 find . -type f -name "*.nro" -print |
104 while read FILENAME
106 mv "$FILENAME" "${FILENAME%.nro}.1"
107 done
109 # Determine the version number.
110 VERSION=$(sed -n -e 's#char version\[\] = "\(.*\)";#\1#p' version.c)
112 # Print out information for the import.
113 cat <<EOF
114 You can import now.
116 Path: src/external/bsd/less/dist
117 Vendortag: GREENWOODSOFTWARE
118 Releasetag: LESS-$VERSION
121 exit 0