Expand PMF_FN_* macros.
[netbsd-mini2440.git] / dist / pppd / ppp2netbsd
blobe7a3059b69e6e44fae9cd3c30938a327e62758d4
1 #!/bin/sh
3 # $NetBSD: ppp2netbsd,v 1.3 2007/09/10 10:35:51 cube Exp $
5 # Copyright (c) 2005 The NetBSD Foundation.
6 # All rights reserved.
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions
10 # are met:
11 # 1. Redistributions of source code must retain the above copyright
12 # notice, this list of conditions and the following disclaimer.
13 # 2. Redistributions in binary form must reproduce the above copyright
14 # notice, this list of conditions and the following disclaimer in the
15 # documentation and/or other materials provided with the distribution.
17 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 # POSSIBILITY OF SUCH DAMAGE.
30 # Execute this at the top of the ppp distribution
31 # then import it.
33 # cvs import src/dist/pppd MACKERRAS PPP2_4_X
35 # Stuff we don't need
36 UNUSED_DIRS="common contrib etc.ppp include linux modules solaris scripts"
37 UNUSED_FILES="Changes-2.3 README.linux README.pppoe README.sol2 configure"
38 UNUSED_FILES="${UNUSED_FILES} pppd/md[45].* pppd/sha1.* pppd/srp-entry.*"
39 UNUSED_FILES="${UNUSED_FILES} pppd/sys-linux.c pppd/sys-solaris.c"
40 UNUSED_FILES="${UNUSED_FILES} pppdump/zlib.* pppdump/ppp-comp.h"
42 # Stuff we don't want
43 GPL_DIRS="pppd/plugins/pppoatm pppd/plugins/radius pppd/plugins/rp-pppoe"
44 GPL_FILES="pppd/tdb.* pppd/spinlock.* pppd/plugins/passprompt.c
45 pppd/plugins/winbind.c"
47 echo -n "Removing unwanted stuf... "
48 for obj in ${UNUSED_DIRS} ${GPL_DIRS} ${UNUSED_FILES} ${GPL_FILES}; do
49 rm -Rf ${obj}
50 echo -n "${obj} "
51 done
52 echo; echo
54 # Remove Makefiles
55 echo -n "Removing Makefiles... "
56 find . -type f -name 'Makefile*' | while read m; do
57 rm -f ${m}
58 echo -n "${m} "
59 done
60 echo; echo
62 # Changing RCS Ids
63 echo -n "Fixing RCS Ids... "
64 find . -type f | while read f; do
65 sed -e 's/\$\(Id:.*\) \$/\1/' < ${f} > /tmp/ppp2netbsd.$$ && \
66 echo -n "${f} " && \
67 mv /tmp/ppp2netbsd.$$ ${f}
68 done
69 echo; echo
71 # Add NetBSD RCS Ids
73 # Man pages
74 echo -n "Adding NetBSD Ids to manpages... "
75 find . -type f -name '*.[1-8]' | while read f; do
76 (echo ".\\\" \$NetBSD\$"; echo '.\"'; cat ${f}) > /tmp/ppp2netbsd.$$ && \
77 echo -n "${f} " && \
78 mv /tmp/ppp2netbsd.$$ ${f}
79 done
80 echo; echo
82 # Source files
83 echo -n "Adding NetBSD Ids to C source files and headers... "
84 find . -type f -name '*.[ch]' | while read f; do
85 (echo "/* \$NetBSD\$ */"; echo; cat ${f}) \
86 > /tmp/ppp2netbsd.$$ && echo -n "${f} " && \
87 mv /tmp/ppp2netbsd.$$ ${f}
88 done
89 echo; echo
91 # RCSID management
92 echo -n "Fixing RCSID references... "
93 find . -type f -name '*.c' | while read f; do
94 sed -e '{
95 /^#define[ ]RCSID/{i\
96 #include <sys/cdefs.h>\
97 #ifndef lint\
98 #if 0
100 #else\
101 __RCSID("\$NetBSD\$");\
102 #endif\
103 #endif
105 /= RCSID/{i\
106 #ifdef RCSID
108 #endif
110 /^#ifndef[ ]lint$/,/^#endif$/{
111 /^#ifndef[ ]lint/i\
112 #include <sys/cdefs.h>
113 /^static const char rcsid\[\] = "/{i\
114 #if 0
116 #else\
117 __RCSID("\$NetBSD\$");\
118 #endif
119 };};}' < ${f} > /tmp/ppp2netbsd.$$ && echo -n "${f} " && \
120 mv /tmp/ppp2netbsd.$$ ${f}
121 done
122 echo; echo
123 #\(#ifndef[ ]lint\n\)\(static const char rcsid\[\] = .*\)$/\
124 ##include <sys\/cdefs.h>\n\
125 #\1\
126 ##if 0\n\
127 #\2\n\
128 ##else\n\
129 #__RCSID("\$NetBSD\$");\n\
130 ##endif/