Sync usage with man page.
[netbsd-mini2440.git] / crypto / dist / heimdal / heimdal2netbsd
blob87cb5f848ba98a9ba0f68b199198090c0926177e
1 #! /bin/sh
3 # $NetBSD: heimdal2netbsd,v 1.11 2008/03/22 08:36:49 mlelstv Exp $
5 if [ \! -f kuser/kinit.c ]; then
6 echo "`basename $0`: should be run in top src directory" 1>&2
7 exit 1
8 fi
10 if ! type perl > /dev/null 2>&1 ; then
11 echo "`basename $0`: you need perl to run this" 1>&2
12 exit 1
15 echo 'Removing saved orig files.'
16 find . -name '*~' | xargs rm -f
18 echo 'Removing preformatted man pages.'
19 find . -name '*.cat[1358]' | xargs rm -f
20 rm doc/heimdal.info doc/hx509.info
22 echo 'Fixing .Os in man pages.'
24 update_man() {
25 echo " fixing $1 leaving old file in $1~"
26 mv $1 $1~
27 < $1~ > $1 \
28 sed -e 's,\.Os HEIMDAL,.Os,' \
29 -e 's,\.Pa krb5.h,.Pa krb5/krb5.h,' \
30 -e 's,\.In krb5.h,.In krb5/krb5.h,' \
31 -e 's,\.Pa gssapi.h,.Pa gssapi/gssapi.h,' \
32 -e 's,\.In gssapi.h,.In gssapi/gssapi.h,' \
33 -e 's,#include <krb5.h>,#include <krb5/krb5.h>,'
36 for f in `find . -name '*.[1358]'`; do
37 update_man $f
38 done
40 echo 'Changing CVS Id tags to Heimdal tags.'
42 perl -i~ -p -e '
43 s,RCSID *\("\$Id([^\$]*)\$"\),__RCSID("\$Heimdal\1\$"\n "\$NetBSD\$"),;
44 s,/\* \$Id([^\$]*)\$ \*/,/* \$Heimdal\1\$\n \$NetBSD\$ */,;
45 s,# \$Id([^\$]*)\$,# \$Heimdal\1\$\n# \$NetBSD\$,;
46 s,\.\\" \$Id([^\$]*)\$,.\\" \$Heimdal\1\$\n.\\" \$NetBSD\$,;
47 s,dnl \$Id([^\$]*)\$,dnl \$Heimdal\1\$\ndnl \$NetBSD\$,;
48 ' `find . -type f`
50 echo 'Inlining <krb5-types.h>'
52 perl -i~ -p -e '
53 s{#include <krb5-types.h>}
54 {#ifndef __krb5_types_h__
55 #define __krb5_types_h__
56 #include <sys/types.h>
57 #include <inttypes.h>
58 #include <sys/socket.h>
59 typedef socklen_t krb5_socklen_t;
60 typedef ssize_t krb5_ssize_t;
61 #endif}
62 ' lib/gssapi/gssapi/gssapi.h \
63 lib/krb5/krb5.h \
64 lib/krb5/krb5_ccapi.h
66 echo 'Fixing up include paths:'
68 update_inc() {
69 echo " fixing $1 leaving old file in $1~"
70 mv $1 $1~
71 < $1~ > $1 \
72 sed -e 's,#include <asn1_err.h>,#include <krb5/asn1_err.h>,' \
73 -e 's,#include <krb5_err.h>,#include <krb5/krb5_err.h>,' \
74 -e 's,#include <heim_err.h>,#include <krb5/heim_err.h>,' \
75 -e 's,#include <k524_err.h>,#include <krb5/k524_err.h>,' \
76 -e 's,#include <krb5_asn1.h>,#include <krb5/krb5_asn1.h>,' \
77 -e 's,#include <hdb-protos.h>,#include <krb5/hdb-protos.h>,' \
78 -e 's,#include <krb5-protos.h>,#include <krb5/krb5-protos.h>,' \
79 -e 's,#include <com_right.h>,#include <krb5/com_right.h>,' \
80 -e 's,#include <gssapi.h>,#include <gssapi/gssapi.h>,' \
81 -e 's,#include <sl.h>,#include <krb5/sl.h>,'
84 update_inc lib/krb5/krb5.h
85 update_inc lib/hdb/hdb.h
86 update_inc lib/com_err/com_err.h
87 update_inc lib/sl/ss.h
88 update_inc lib/gssapi/gssapi/gssapi_spnego.h
90 echo 'Fixup toupper usage'
91 perl -i~ -p -e '
92 s,toupper\(,toupper((unsigned char),
93 ' lib/hcrypto/imath/imath.c
95 echo 'Fixup PACKAGE_BUGREPORT'
97 perl -i~ -p -e '
98 s,.*PACKAGE_BUGREPORT.*,#ifdef PACKAGE_BUGREPORT\n$&\n#endif,
99 ' lib/vers/print_version.c
102 echo 'commands to run:'
103 echo ' ( cd admin; slc ktutil-commands.in )'
104 echo ' ( cd kadmin; slc kadmin-commands.in )'
105 echo ' ( cd kuser; slc kdigest-commands.in )'
106 echo ' ( cd lib/gssapi; slc gss-commands.in )'
107 echo ' ( cd lib/hx509; slc hxtool-commands.in )'
108 echo ' ( cd lib/kadm5; slc iprop-commands.in )'
109 echo 'Remember to update files in src/include/heimdal/.'
111 exit 0