Add missing "return(error)".
[dragonfly.git] / contrib / libpam / modules / register_static
1 #!/bin/bash
2 # $FreeBSD: src/contrib/libpam/modules/register_static,v 1.1.1.1.6.1 2001/06/11 15:28:16 markm Exp $
3 # $DragonFly: src/contrib/libpam/modules/Attic/register_static,v 1.2 2003/06/17 04:24:03 dillon Exp $
4
5 if [ `basename $PWD` != "modules" ]; then
6         echo "$0 must be run from the .../modules directory"
7         exit 1
8 fi
9
10 merge_line ()
11 {
12         if [ $# != 3 ]; then
13                 echo "usage: merge_line token filename 'new line'"
14         fi
15         if [ -f $2 ]; then
16 # remove any existing entry...
17                 grep -v "$1" $2 > tmp.$2
18                 rm -f $2
19                 mv {tmp.,}$2
20         fi
21         cat << EOT >> $2
22 $3
23 EOT
24
25 }
26
27
28 if [ $# -ne 2 ]; then
29
30         cat << EOT 2>&1
31 $0:     this script takes TWO arguments:
32         the 'alphanumeric label' of the module and the location of
33         its object file from the .../modules/ directory
34 EOT
35         exit 1
36
37 else
38         echo "
39  *> registering static module: $1 ($2) <*
40 "
41         merge_line "$1" _static_module_list "\
42 extern struct pam_module _$1_modstruct;"
43
44         merge_line "$1" _static_module_entry "    &_$1_modstruct,"
45         if [ -n "$2" ]; then
46                 merge_line "$2" _static_module_objects "../modules/$2"
47         fi
48
49 fi
50
51 exit 0