MAKEDEV2manpage.sh revision 1.4 1 1.1 dillo #!/bin/sh
2 1.1 dillo #
3 1.4 jdolecek # $NetBSD: MAKEDEV2manpage.sh,v 1.4 2003/10/24 20:26:57 jdolecek Exp $
4 1.1 dillo #
5 1.1 dillo # Copyright (c) 2002
6 1.3 grant # Dieter Baron <dillo (at] NetBSD.org>. All rights reserved.
7 1.1 dillo #
8 1.1 dillo # Redistribution and use in source and binary forms, with or without
9 1.1 dillo # modification, are permitted provided that the following conditions
10 1.1 dillo # are met:
11 1.1 dillo # 1. Redistributions of source code must retain the above copyright
12 1.1 dillo # notice, this list of conditions and the following disclaimer.
13 1.1 dillo # 2. Redistributions in binary form must reproduce the above copyright
14 1.1 dillo # notice, this list of conditions and the following disclaimer in the
15 1.1 dillo # documentation and/or other materials provided with the distribution.
16 1.1 dillo # 3. Neither the name of the University nor the names of its contributors
17 1.1 dillo # may be used to endorse or promote products derived from this software
18 1.1 dillo # without specific prior written permission.
19 1.1 dillo #
20 1.1 dillo # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 1.1 dillo # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 1.1 dillo # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 1.1 dillo # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 1.1 dillo # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 1.1 dillo # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 1.1 dillo # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 1.1 dillo # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 1.1 dillo # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 1.1 dillo # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 1.1 dillo # SUCH DAMAGE.
31 1.1 dillo #
32 1.1 dillo #
33 1.1 dillo ###########################################################################
34 1.1 dillo #
35 1.1 dillo # Convert src/etc/etc.${ARCH}/MAKEDEV and
36 1.1 dillo # src/share/man/man8/MAKEDEV.8.template to
37 1.1 dillo # src/share/man/man8/man8.${ARCH}/MAKEDEV.8, replacing
38 1.1 dillo # - @@@SPECIAL@@@ with all targets in the first section (all, std, ...)
39 1.1 dillo # - @@@DEVICES@@@ with the remaining targets
40 1.1 dillo # - @@@DATE@@@ with the date from the previous version, if found
41 1.1 dillo # - @@@ARCH@@@ with the architecture name
42 1.1 dillo # using src/share/man/man8/MAKEDEV2manpage.awk
43 1.1 dillo #
44 1.1 dillo
45 1.1 dillo AWK=${AWK:-awk}
46 1.1 dillo DIFF=${DIFF:-diff}
47 1.1 dillo
48 1.4 jdolecek manpage="MAKEDEV.8";
49 1.4 jdolecek tmpfile="${manpage}.$$";
50 1.1 dillo
51 1.4 jdolecek ${AWK} -f MAKEDEV2manpage.awk MAKEDEV.8.template \
52 1.4 jdolecek > ${tmpfile} || { rm ${tmpfile}; exit 1; }
53 1.4 jdolecek if ${DIFF} -I'^\.Dd ' -I'^\.\\" $NetBSD' -q ${manpage} ${tmpfile} \
54 1.4 jdolecek >/dev/null
55 1.4 jdolecek then
56 1.4 jdolecek result='unchanged';
57 1.4 jdolecek rm ${tmpfile};
58 1.4 jdolecek else
59 1.4 jdolecek result='updated';
60 1.4 jdolecek if [ `wc -l < ${tmpfile}` -ne `wc -l < ${manpage}` ]; then
61 1.4 jdolecek LC_ALL=C LC_CTYPE=C date=`date +"%B %e, %Y`
62 1.1 dillo else
63 1.4 jdolecek date=`sed -n 's/^\.Dd //p' ${manpage}`
64 1.1 dillo fi
65 1.4 jdolecek sed "s/@@@DATE@@@/$date/" ${tmpfile} > ${tmpfile}.2
66 1.4 jdolecek rm ${tmpfile}
67 1.4 jdolecek mv ${tmpfile}.2 ${manpage}
68 1.1 dillo fi
69 1.4 jdolecek echo "$manpage: ${result}"
70